From d59356ea7e5f3ab01695f936a409a433deac751b Mon Sep 17 00:00:00 2001 From: Louie S Date: Tue, 30 Jul 2024 16:52:41 -0400 Subject: Create ApplicationWindow with menu --- src/frontend/qtquick/main.qml | 64 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 3 deletions(-) (limited to 'src/frontend') diff --git a/src/frontend/qtquick/main.qml b/src/frontend/qtquick/main.qml index 3775f2b..2a942d0 100644 --- a/src/frontend/qtquick/main.qml +++ b/src/frontend/qtquick/main.qml @@ -1,13 +1,71 @@ import QtQuick 2.15 import QtQuick.Controls 2.15 -import QtQuick.Window 2.15 -Window { +ApplicationWindow { width: 640 height: 480 visible: true - // TODO grab this from config.h title: PROJECT_TITLE + + id: root + + Drawer { + id: drawer + + width: Math.min(root.width, root.height) / 3 * 2 + height: root.height + + ListView { + currentIndex: -1 + anchors.fill: parent + + delegate: ItemDelegate { + width: parent.width + text: model.text + highlighted: ListView.isCurrentItem + onClicked: { + drawer.close() + model.triggered() + } + } + + model: ListModel { + ListElement { + text: qsTr("Preferences...") + triggered: function() { preferencesDialog.open(); } + } + ListElement { + text: qsTr("Reload...") + triggered: function() { /* reload from database */ } + } + ListElement { + text: qsTr("About...") + triggered: function() { aboutDialog.open() } + } + } + + ScrollIndicator.vertical: ScrollIndicator { } + } + } + + header: ToolBar { + ToolButton { + id: menuButton + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + // TODO create icon for the drawer + //icon.source: "..." + onClicked: drawer.open() + } + Label { + anchors.centerIn: parent + // TODO determine what title to set + //text: ... + font.pixelSize: 20 + elide: Label.ElideRight + } + } + // DropDown for groups (including an "all" option) Item { -- cgit