diff options
author | Jens Bache-Wiig <jens.bache-wiig@digia.com> | 2014-03-04 16:29:52 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-11 16:34:07 +0100 |
commit | 15b85b154ea1d958c893e35b4d9d2d164c7e0b66 (patch) | |
tree | eb9df2e64904dc2a0dcad568d15a16e5d375e304 | |
parent | c8acc9ef849977f09f26a397de3812f81c740efa (diff) | |
download | qtquickcontrols-15b85b154ea1d958c893e35b4d9d2d164c7e0b66.tar.gz |
Fixed offset for overlay in moveable TableViewColumns
The Loader needs to be reparented in order to draw the overlay on
top of everything. In addition we need to take both the item offset and
the contentX into account. Note I also tweaked the actual drop offset
by headerRowDelegate.width/2 as that feels a bit more balanced.
[ChangeLog][QtQuickControls][TableView] Fixed an issue with
the header overlay offset while re-arranging TableViewColumns
Task-number: QTBUG-37180
Change-Id: Ia80049616bb30e1391948fdeaf3f8d68afd7ce3e
Reviewed-by: Caroline Chao <caroline.chao@digia.com>
Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
-rw-r--r-- | src/controls/TableView.qml | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/controls/TableView.qml b/src/controls/TableView.qml index 63687d9d..1ca45a7f 100644 --- a/src/controls/TableView.qml +++ b/src/controls/TableView.qml @@ -929,6 +929,7 @@ ScrollView { model: columnModel delegate: Item { + id: headerRowDelegate z:-index width: columnCount === 1 ? viewport.width + __verticalScrollBar.width : modelData.width implicitWidth: headerStyle.implicitWidth @@ -974,7 +975,7 @@ ScrollView { onPositionChanged: { if (modelData.movable && pressed && columnCount > 1) { // only do this while dragging for (var h = columnCount-1 ; h >= 0 ; --h) { - if (drag.target.x > headerrow.children[h].x) { + if (drag.target.x + listView.contentX + headerRowDelegate.width/2 > headerrow.children[h].x) { repeater.targetIndex = h break } @@ -984,7 +985,6 @@ ScrollView { onPressed: { repeater.dragIndex = index - draghandle.x = parent.x } onReleased: { @@ -1012,8 +1012,8 @@ ScrollView { readonly property int column: index readonly property int textAlignment: modelData.horizontalAlignment } - parent: tableHeader + x: headerRowDelegate.x - listView.contentX width: modelData.width height: parent.height sourceComponent: root.headerDelegate |