Details
-
Bug
-
Resolution: Won't Do
-
P2: Important
-
None
-
4.7.0
-
None
Description
QAbstractItemView::doItemsLayout() calling d->viewport()->update() causes a performance issue which can be reproduced with the following test case:
#include <QApplication> #include <QTreeWidget> #include <QTime> #define NUM 3000 class Work : public QObject { public: Work() :num(0) { tree = new QTreeWidget; tree->show(); time.start(); for( int i = 0; i < NUM; i++) { new QTreeWidgetItem(tree, QStringList(QString("item: %1").arg(i))); qApp->processEvents(); } qDebug("Finish. Time elapsed: %d ms", time.elapsed()); } private: QTreeWidget *tree; int num; QTime time; }; int main(int argc, char* argv[]) { QApplication a(argc, argv); Work work; return a.exec(); }
By removing the d->viewport()->update() the performance promotes dramatically (26s to 3s in my test environment). And it doesn't seem to influence the ui updates (at least for this test case).