qt-interest@trolltech.com
[Top] [All Lists]

[PATCH] [QT4] Disable updates in TreeView

Subject: [PATCH] [QT4] Disable updates in TreeView
From: Nils Durner
Date: Thu, 30 Mar 2006 15:13:19 +0200
Hi,

to disable repainting of widgets during bigger changes, you usually use QWidget::setUpdatesEnabled(false).

A call of QTreeWidget::setItemWidget() results in a quite expensive call of QTreeView::visualRect() which aborts on invisible or hidden items only.

The attached patch adds this "short way out" for QTreeViews with updatesEnabled == false.

With the patch applied, setItemWidget() got 5 times faster in my application.


Best regards,

--
Nils Durner
software engineer
dmc imagetec GmbH
Rommelstraße 11
70376 Stuttgart (Germany)
Telefon: +49 711 601747-0
Telefax: +49 711 601747-141
Internet: www.dmc-imagetec.de
--- src/gui/itemviews/qtreeview.cpp     Wed Feb 15 16:08:20 2006
+++ src.ndr/gui/itemviews/qtreeview.cpp Thu Mar 30 09:12:59 2006
@@ -616,7 +616,7 @@
 {
     Q_D(const QTreeView);
 
-    if (!index.isValid() || isIndexHidden(index))
+    if (!index.isValid() || isIndexHidden(index) || !updatesEnabled())
         return QRect();
 
     d->executePostedLayout();
<Prev in Thread] Current Thread [Next in Thread>