Details
-
Suggestion
-
Resolution: Unresolved
-
P5: Not important
-
None
-
5.5.1
-
None
Description
This improvement idea was noticed on Qt 5.5.1 but seems to affect later Qt versions also. The improvement would change QTableView from calculating its size unnecessarily as it seems to do currently when it gets hidden. I'll try explain the current behavior below and let developers with better understanding about Qt internals decide is this worthy taking into account - or maybe this is intentional behavior also I fail to see reason for.
1. When user sets QHeaderView for QTableView using the setHorizontalHeader or setVerticalHeader accessors the parent QTableView hooks itself to listen QHeaderView::geometriesChanged() signal:
http://code.qt.io/cgit/qt/qtbase.git/tree/src/widgets/itemviews/qtableview.cpp?h=v5.8.0#n1254
2. This leads to situation, if I've understood correctly, such that when QTableWidget::setVisible(false) is called it causes eventually a call to QHeaderView::viewportEvent(QEvent* --> QEvent::Hide). This comes via children visibility setting change QTableView holds.
In QHeaderView::viewportEvent(QEvent*) this QEvent::Hide event causes emitting geometriesChanged() signal:
http://code.qt.io/cgit/qt/qtbase.git/tree/src/widgets/itemviews/qheaderview.cpp?h=v5.8.0#n2673
And this signal handled in QTableView::updateGeometries does rather much calculation about its size despite it is itself hidden already. But as said maybe this is intentional behavior, yet leaves me wondering is there need to execute update geometries sizes too much in such case.