Skip to content

Commit

Permalink
Work on the desktop sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
emericg committed Nov 4, 2024
1 parent b83f54e commit 8162f88
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 15 deletions.
7 changes: 0 additions & 7 deletions qml/DesktopApplication.qml
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,6 @@ ApplicationWindow {
//console.log("activeFocusItem:" + activeFocusItem)
}

onClosing: (close) => {
if (Qt.platform.os === "osx") {
close.accepted = false
appWindow.hide()
}
}

// User generated events handling //////////////////////////////////////////

function backAction() {
Expand Down
84 changes: 80 additions & 4 deletions qml/DesktopSidebar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Rectangle {
anchors.bottom: parent.bottom

z: 10
width: isHdpi ? 72 : 80
//width: isHdpi ? 72 : 80
width: 220
color: Theme.colorSidebar

////////////
Expand All @@ -30,6 +31,81 @@ Rectangle {

////////////

Column { // top menu
anchors.top: parent.top
anchors.topMargin: 16
anchors.left: parent.left
anchors.leftMargin: 12
anchors.right: parent.right
anchors.rightMargin: 12
spacing: 6

DesktopSidebarMenu {
text: "Desktop"
source: "qrc:/assets/icons/material-symbols/hardware/computer.svg"
checked: (appContent.state === "DesktopComponents")

onClicked: screenDesktopComponents.loadScreen()
}
DesktopSidebarMenu {
text: "Mobile"
source: "qrc:/assets/icons/material-symbols/hardware/smartphone-fill.svg"
checked: (appContent.state === "MobileComponents")

onClicked: screenMobileComponents.loadScreen()
}
DesktopSidebarSubMenu {
text: "Tools"
source: "qrc:/assets/icons/material-icons/duotone/touch_app.svg"
checked: (appContent.state === "Playground" ||
appContent.state === "HostInfos" ||
appContent.state === "FontInfos")
onClicked: screenPlayground.loadScreen()

submenus: [
{ text: "playground", onClicked: function() { screenPlayground.loadScreen() } },
{ text: "host", onClicked: function() { screenHostInfos.loadScreen() } },
{ text: "fonts", onClicked: function() { screenFontInfos.loadScreen() } }
]
}
}

////////////

Column { // bottom menu
anchors.left: parent.left
anchors.leftMargin: 12
anchors.right: parent.right
anchors.rightMargin: 12
anchors.bottom: parent.bottom
anchors.bottomMargin: 16
spacing: 6

DesktopSidebarMenu {
text: "Settings"
source: "qrc:/assets/icons/material-icons/duotone/tune.svg"
checked: (appContent.state === "Settings")

onClicked: screenSettings.loadScreen()
}

DesktopSidebarMenu {
text: "Settings"
source: "qrc:/assets/icons/material-icons/duotone/info.svg"
checked: (appContent.state === "About")

onClicked: screenAbout.loadScreen()
}

DesktopSidebarMenu {
text: "Exit"
source: "qrc:/assets/icons/material-icons/duotone/exit_to_app.svg"
onClicked: Qt.quit()
}
}

////////////
/*
Column { // top menu
anchors.top: parent.top
anchors.topMargin: 32
Expand Down Expand Up @@ -80,9 +156,9 @@ Rectangle {
onClicked: screenFontInfos.loadScreen()
}
}

*/
////////////

/*
Column { // bottom menu
anchors.left: parent.left
anchors.right: parent.right
Expand Down Expand Up @@ -116,7 +192,7 @@ Rectangle {
onClicked: Qt.quit()
}
}

*/
////////////
/*
Rectangle { // shadow
Expand Down
16 changes: 12 additions & 4 deletions thirdparty/ComponentLibrary/menus/DesktopSidebarSubMenu.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,21 @@ Column {
anchors.right: parent.right
spacing: 8

//height: checked ? cccccc.height : Theme.componentHeight
//Behavior on height { NumberAnimation { duration: 333 } }

property string category
property string text: "menu"
property string source: "qrc:/assets/icons/material-symbols/menu.svg"

property bool checked: false
property int selected: 0

signal clicked()

/////////

property var submenu
property var submenus

////////

Expand All @@ -33,18 +37,22 @@ Column {
////////

Repeater {
model: sidebarSubMenu.submenu
model: sidebarSubMenu.submenus
delegate: DesktopSidebarMenu {
height: Theme.componentHeight

text: modelData.text
font.bold: checked
//visible: sidebarSubMenu.checked

source: "qrc:/assets/icons/material-symbols/arrow_right.svg"
sourceSize: 20

checked: false
onClicked: modelData.clicked()
checked: sidebarSubMenu.checked && sidebarSubMenu.selected === index
onClicked: {
sidebarSubMenu.selected = index
modelData.onClicked()
}
}
}

Expand Down

0 comments on commit 8162f88

Please sign in to comment.