diff options
author | Jan Holthuis <jholthuis@mixxx.org> | 2021-12-15 00:25:17 +0100 |
---|---|---|
committer | Jan Holthuis <jholthuis@mixxx.org> | 2021-12-15 00:25:17 +0100 |
commit | 82fd3656f4e1f2580fa967ba69de400650139821 (patch) | |
tree | 6c52f49b6fd8e403303ed691d6d0c24584cd9bc1 /res/qml | |
parent | 978dc31ac1d3d9e4e2fa762f16b8f5aa0fb18837 (diff) |
QML: Add support for sorting/filtering control table in DeveloperToolsWindow
Diffstat (limited to 'res/qml')
-rw-r--r-- | res/qml/DeveloperToolsWindow.qml | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/res/qml/DeveloperToolsWindow.qml b/res/qml/DeveloperToolsWindow.qml index 3683c22bad..59b3d4a8b5 100644 --- a/res/qml/DeveloperToolsWindow.qml +++ b/res/qml/DeveloperToolsWindow.qml @@ -1,7 +1,7 @@ import Mixxx 0.1 as Mixxx import Qt.labs.qmlmodels 1.0 import QtQuick 2.12 -import QtQuick.Controls 2.12 +import QtQuick.Controls 2.15 import QtQuick.Layouts 1.12 import QtQuick.Window 2.12 import "Theme" @@ -21,6 +21,38 @@ Window { Layout.fillWidth: true placeholderText: "Search Term..." + onTextChanged: controlModel.setFilterFixedString(text) + } + + HorizontalHeaderView { + id: horizontalHeader + + Layout.fillWidth: true + syncView: tableView + + delegate: Rectangle { + implicitHeight: columnName.contentHeight + 5 + implicitWidth: columnName.contentWidth + 5 + color: Theme.backgroundColor + visible: column < 3 + + Text { + id: columnName + + text: display + color: Theme.blue + anchors.fill: parent + anchors.margins: 5 + elide: Text.ElideRight + verticalAlignment: Text.AlignVCenter + } + + TapHandler { + onTapped: controlModel.toggleSortColumn(column) + } + + } + } TableView { @@ -35,6 +67,13 @@ Window { model: Mixxx.ControlSortFilterModel { id: controlModel + + function toggleSortColumn(column) { + const descending = (sortColumn == column) ? !sortDescending : false; + sortByColumn(column, descending); + } + + Component.onCompleted: toggleSortColumn(0) } delegate: DelegateChooser { |