Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.14.0
-
None
Description
Resizing the width of a tableView with columnWidthProvider results in the contentX property having the wrong value. The following video demonstrate how the red rectangle, which has a fixed x of zero, jumps to the right as you resize the table view:
import QtQuick 2.12 import QtQml.Models 2.12 import QtQuick.Layouts 1.12 import QtQuick.Shapes 1.12 import QtQuick.Controls 2.12 import Qt.labs.qmlmodels 1.0 Rectangle { id: root TableView { id: table anchors.fill: parent // This "overlay" element doesn't stay put. // https://doc.qt.io/qt-5/qml-qtquick-tableview.html#overlays-and-underlays Rectangle { width: 20 height: table.contentHeight color: 'red' } onWidthChanged: { forceLayout() // columnWidthProvider calls are being triggered from this. print('contentX', contentX) // shows that contextX does not match what is displayed. } // bug only occurs with column width provider columnWidthProvider: function(col) { if(table.width > 150) { return col % 2 == 0 ? 30 : 40 } else { return col % 2 == 0 ? 0 : 40 } } delegate: Text { text: 'here' width: 50 } model: TableModel { TableModelColumn { display: 'buddy' } TableModelColumn { display: 'date' } TableModelColumn { display: 'dateTime' } TableModelColumn { display: 'unsure' } TableModelColumn { display: 'description' } TableModelColumn { display: 'location' } TableModelColumn { display: 'person' } TableModelColumn { display: 'logged' } TableModelColumn { display: 'color' } TableModelColumn { display: 'nodal' } rows: [ { buddy: '', date: (new Date), dateTime: (new Date), unsure: 'true', description: 'Good times', location: 'Anchorage', person: 'Patrick', logged: (new Date), color: '#00000000', nodal: 'false' }, { buddy: '', date: (new Date), dateTime: (new Date), unsure: 'true', description: 'Good times', location: 'Anchorage', person: 'Patrick', logged: (new Date), color: '#00000000', nodal: 'false' }, { buddy: '', date: (new Date), dateTime: (new Date), unsure: 'true', description: 'Good times', location: 'Anchorage', person: 'Patrick', logged: (new Date), color: '#00000000', nodal: 'false' }, { buddy: '', date: (new Date), dateTime: (new Date), unsure: 'true', description: 'Good times', location: 'Anchorage', person: 'Patrick', logged: (new Date), color: '#00000000', nodal: 'false' }, { buddy: '', date: (new Date), dateTime: (new Date), unsure: 'true', description: 'Good times', location: 'Anchorage', person: 'Patrick', logged: (new Date), color: '#00000000', nodal: 'false' }, ] } } }
Attachments
Issue Links
- relates to
-
QTBUG-83612 earmarked by richard
- Closed