Hello high_flyer,
Thanks for the suggestion, I ran a couple of tests and it turns out the delay is comming for the following commands:
parentItem->setCheckState(Qt::Checked);
parentItem->setCheckState(Qt::Checked);
To copy to clipboard, switch view to plain text mode
and:
parentItem->setCheckState(Qt::Unchecked);
parentItem->setCheckState(Qt::Unchecked);
To copy to clipboard, switch view to plain text mode
When i changed the code to the one shown below the for loop takes about 30 msec on every run:
for (int i=0;i<emailModel->rowCount();i++) {
//qApp->processEvents();
parentItem = emailModel->item(i,0);
if (emails.contains(parentItem->data(0).toString())){}
//parentItem->setCheckState(Qt::Checked);
else{}
//parentItem->setCheckState(Qt::Unchecked);
}
qDebug() << "Benchmark4: " << time1.msecsTo(time2);
QTime time1 = QTime::currentTime();
for (int i=0;i<emailModel->rowCount();i++) {
//qApp->processEvents();
parentItem = emailModel->item(i,0);
if (emails.contains(parentItem->data(0).toString())){}
//parentItem->setCheckState(Qt::Checked);
else{}
//parentItem->setCheckState(Qt::Unchecked);
}
QTime time2 = QTime::currentTime();
qDebug() << "Benchmark4: " << time1.msecsTo(time2);
To copy to clipboard, switch view to plain text mode
Is there a workaround to this ? or maybe a more efficient way to achieve what i'm trying to do ?
Bookmarks