diff --git a/examples/quick/controls/tableview/images/sort-up.png b/examples/quick/controls/tableview/images/sort-up.png new file mode 100644 index 0000000000000000000000000000000000000000..27fcb19153992dbc4003103460fd74004e6778e8 Binary files /dev/null and b/examples/quick/controls/tableview/images/sort-up.png differ diff --git a/examples/quick/controls/tableview/main.qml b/examples/quick/controls/tableview/main.qml index e90e11043b1adde09d15f7117330910bbec667c4..b85f2d1d98ea0d3e3354afbc8b2116a7ac8c7fc2 100644 --- a/examples/quick/controls/tableview/main.qml +++ b/examples/quick/controls/tableview/main.qml @@ -310,6 +310,7 @@ Window { } } TableView { + id: delegatesView model: largeModel anchors.margins: 12 anchors.fill:parent @@ -338,10 +339,27 @@ Window { source: "images/header.png" border{left:2;right:2;top:2;bottom:2} Text { + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.right: indicator.visible ? indicator.left : parent.right + anchors.margins: 6 text: styleData.value - anchors.centerIn:parent + elide: Text.ElideRight color:"#333" } + // Sort indicator + Image { + id: indicator + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.rightMargin: 6 + source: "images/sort-up.png" + visible: delegatesView.sortIndicatorVisible && + styleData.column === delegatesView.sortIndicatorColumn + rotation: delegatesView.sortIndicatorOrder === Qt.AscendingOrder ? 180 : 0 + Behavior on rotation { NumberAnimation { } } + } + } rowDelegate: Rectangle { diff --git a/examples/quick/controls/tableview/resources.qrc b/examples/quick/controls/tableview/resources.qrc index f395013f5a4532638aeba382b1ce450ee5bcf3d7..83d3f6a76c31f2ec3b0d1a8be27f540093b5a6f0 100644 --- a/examples/quick/controls/tableview/resources.qrc +++ b/examples/quick/controls/tableview/resources.qrc @@ -3,5 +3,6 @@ <file>main.qml</file> <file>images/selectedrow.png</file> <file>images/header.png</file> + <file>images/sort-up.png</file> </qresource> </RCC>