State control Drawer or SplitView
Solved
QML and Qt Quick
-
Hi I am still transitioning from QtWidgets to QtQuick so I apologize if this has been asked before.
I am developing a desktop ticketing app where I would like to toggle an item between being in a SplitView or a Drawer.
My reasoning is if the window is not wide enough, I want to slide the details panel out in front of the ticket list, but if it is wider I would like to have the details panel as an item in a SplitView (As shown here)What is the preferred way of doing this?
(Excuse the unstyled UI) -
I have figured this out, by using states and setting the parent. It's not particularly fluid but it works
StateGroup { id: stateGroup states: [ State { name: "landscape" when: root.width >= 400 PropertyChanges { target: issueDetails parent: issueDetailsSplitViewContainer } PropertyChanges { target: issueDetailsSplitViewContainer visible: true } PropertyChanges { target: issueDetailsDrawer visible: false position: 0 } }, State { name: "portrait" when: root.width < 400 PropertyChanges { target: issueDetails parent: issueDetailsDrawerContainer } PropertyChanges { target: issueDetailsSplitViewContainer visible: false } } ] }