summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@digia.com>2014-06-05 18:01:57 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-06-06 12:20:16 +0200
commitf04f0b8b4ed83025c02fdbed6ebb8105dee51479 (patch)
tree5d84e42e5a08c578421d55c56c373a4cd9220a9b
parentc3fe8736a8cd00581a33cbea62a752331e6bd619 (diff)
downloadqtquickcontrols-f04f0b8b4ed83025c02fdbed6ebb8105dee51479.tar.gz
TableView: Allow resizing and scrolling single-column tables
Also makes sure the resize handle is visible in desktop style. Task-number: QTBUG-39393 Change-Id: I44410c65e76b0a3221ea5fce713c1f1b69079947 Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
-rw-r--r--src/controls/Styles/Desktop/TableViewStyle.qml6
-rw-r--r--src/controls/TableView.qml9
2 files changed, 8 insertions, 7 deletions
diff --git a/src/controls/Styles/Desktop/TableViewStyle.qml b/src/controls/Styles/Desktop/TableViewStyle.qml
index 33cc6779..5ad1f394 100644
--- a/src/controls/Styles/Desktop/TableViewStyle.qml
+++ b/src/controls/Styles/Desktop/TableViewStyle.qml
@@ -77,9 +77,9 @@ ScrollViewStyle {
hints: control.styleHints
properties: {"headerpos": headerPosition, "textalignment": styleData.textAlignment}
property string itemSort: (control.sortIndicatorVisible && styleData.column === control.sortIndicatorColumn) ? (control.sortIndicatorOrder == Qt.AscendingOrder ? "up" : "down") : "";
- property string headerPosition: control.columnCount === 1 ? "only" :
- styleData.column === control.columnCount-1 ? "end" :
- styleData.column === 0 ? "beginning" : ""
+ property string headerPosition: !styleData.resizable && control.columnCount === 1 ? "only" :
+ !styleData.resizable && styleData.column === control.columnCount-1 ? "end" :
+ styleData.column === 0 ? "beginning" : ""
}
property Component rowDelegate: BorderImage {
diff --git a/src/controls/TableView.qml b/src/controls/TableView.qml
index de46469b..5feeac01 100644
--- a/src/controls/TableView.qml
+++ b/src/controls/TableView.qml
@@ -951,8 +951,8 @@ ScrollView {
delegate: Item {
id: headerRowDelegate
z:-index
- width: columnCount === 1 ? viewport.width + __verticalScrollBar.width : modelData.width
- implicitWidth: headerStyle.implicitWidth
+ width: modelData.width
+ implicitWidth: columnCount === 1 ? viewport.width + __verticalScrollBar.width : headerStyle.implicitWidth
visible: modelData.visible
height: headerStyle.height
@@ -967,6 +967,7 @@ ScrollView {
readonly property bool containsMouse: headerClickArea.containsMouse
readonly property int column: index
readonly property int textAlignment: modelData.horizontalAlignment
+ readonly property bool resizable: modelData.resizable
}
}
Rectangle{
@@ -1050,13 +1051,13 @@ ScrollView {
MouseArea {
id: headerResizeHandle
property int offset: 0
- property int minimumSize: 20
+ readonly property int minimumSize: 20
preventStealing: true
anchors.rightMargin: -width/2
width: Settings.hasTouchScreen ? Screen.pixelDensity * 3.5 : 16
height: parent.height
anchors.right: parent.right
- enabled: modelData.resizable && columnCount > 1
+ enabled: modelData.resizable && columnCount > 0
onPositionChanged: {
var newHeaderWidth = modelData.width + (mouseX - offset)
modelData.width = Math.max(minimumSize, newHeaderWidth)