QListWidget::addItem gives horrendous flickering
-
08-10-2019 - |
Pergunta
This happens when I add items one at a time (adding one item and then returning to the event loop). To illustrate, my code looks roughly like this:
.................... timer = new QTimer(this); timer->setInterval(0); connect(timer, SIGNAL(timeout()), this, SLOT(onTimeout())); .................... void Dialog::onTimeout() { QListWidgetItem* item = new QListWidgetItem; .................... ui->listWidget->addItem(item); }
Solução
The code look OK to me. I ran it on my local machine and it executed without flickering. Are you dealing with intense graphics (even this should be OK due to the way Qt defines timeout(0)... as it waits for event queue to complete)? Most likely there is other code that is the culprit.
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow