Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.6.2, 4.7.0
-
None
-
Ubuntu 8.04
-
f86007175d7d9d592e9cf6499704ad4f17944ce4
Description
When using QHeaderView::ResizeToContents on a QTableView with a fairly large model, hiding the QTableView becomes very slow (which is very annoying if the view is part of a QTabWidget).
The problem seems to be related to
http://bugreports.qt.nokia.com/browse/QTBUG-5003
though I have not tested it with QTreeWidget/QTreeView. Sample code (partially taken from the #5003) attached. With resize mode Stretch, hiding the view is very fast, with resize mode ResizeToContents it takes > 2 seconds.
A backtrace shows that QHeaderView::resizeSections() is called on hide, which causes a call to QTableView::sizeHintForColumn(). There the lines
if (!isVisible() || bottom == -1) // the table don't have enough rows to fill the viewport
bottom = d->model->rowCount(d->root) - 1;
cause all rows of the model to be checked, which is of course slow for large models (and seems kinda pointless if the view is not visible anyway...)