Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.15.3
-
None
Description
On a TableView the ItemDelegate indicator rectangles will always be drawn, even if all columns width are set to 0 in the columnWidthProvider.
On hiding the 0 column ItemDelegates will be pooled and immediately reused, even if the contentWidthProvider width is 0.
Reproducer:
import QtQuick 2.15 import QtQuick.Window 2.15 import QtQuick.Controls 2.15 import Qt.labs.qmlmodels 1.0 Window { width: 640 height: 480 visible: true TableView { id: tableView anchors.left: parent.left anchors.right: parent.right anchors.top: parent.top anchors.bottom: button.top property var sizes: [100,100] columnWidthProvider: function( col ) { return tableView.sizes[col]; } model: TableModel { TableModelColumn { display: "name" } rows: [ { "name": "cat", }, { "name": "dog", }, { "name": "bird", } ] } delegate: ItemDelegate { id: delegate text: model.column + " " + model.display indicator: Rectangle { width: 20 height: 20 color: "blue" } onWidthChanged: { console.debug("column:", model.column, "row:", model.row, "width", width) } TableView.onReused: { console.debug( "REUSED", model.display ) } TableView.onPooled: { console.debug( "POOLED", model.display ) } } } Button { id: button anchors.bottom: parent.bottom checkable: true checked: false text: button.checked ? "Column 0 Hidden" : "Column 0 Shown" onCheckedChanged: { if( button.checked ) { tableView.sizes[0] = 0; } else { tableView.sizes[0] = 100; } Qt.callLater( tableView.forceLayout ); } } }
Attachments
Issue Links
- is required for
-
QTBUG-92070 Feature parity for item views in Qt Quick compared to Widgets
- In Progress