Custom behavior for Drawer
-
wrote on 7 Jul 2016, 13:08 last edited by
Hi, I have an application with a StackView as main layout and a Drawer. I want the Drawer only be accessed when the StackView has only one component. According to QtQuick Controls 2's documentation I can do it setting the property dragMargin of Drawer to 0 or a less value. So I did this
Drawer {
id: drawer
dragMargin: rootLayout.depth > 1 ? 0 : Qt.styleHints.startDragDistance
...
}StackView {
id: rootLayout
...
}But does not work at all, because you can access dragging your finger from the edge of the phone. The only thing that achievement is to drastically reduce the area to get the Drawer.
I appretiate the help, because I have a Page that insert into the StackView containing a SwipeView with content close to the edges and has conflicts with the Drawer that is not disabled. I tried setting 0 and -10 to dragMargin, but noting -
Hi, I have an application with a StackView as main layout and a Drawer. I want the Drawer only be accessed when the StackView has only one component. According to QtQuick Controls 2's documentation I can do it setting the property dragMargin of Drawer to 0 or a less value. So I did this
Drawer {
id: drawer
dragMargin: rootLayout.depth > 1 ? 0 : Qt.styleHints.startDragDistance
...
}StackView {
id: rootLayout
...
}But does not work at all, because you can access dragging your finger from the edge of the phone. The only thing that achievement is to drastically reduce the area to get the Drawer.
I appretiate the help, because I have a Page that insert into the StackView containing a SwipeView with content close to the edges and has conflicts with the Drawer that is not disabled. I tried setting 0 and -10 to dragMargin, but notingwrote on 7 Jul 2016, 13:23 last edited byHi! How about disabling the Drawer?
Drawer { id: drawer enabled: rootLayout.depth == 0 onEnabledChanged: dragMargin = enabled ? Qt.styleHints.startDragDistance : 0 }
-
Hi! How about disabling the Drawer?
Drawer { id: drawer enabled: rootLayout.depth == 0 onEnabledChanged: dragMargin = enabled ? Qt.styleHints.startDragDistance : 0 }
wrote on 7 Jul 2016, 13:55 last edited by@Wieland
The documentation and the compiler say that the property does not exist, which is strange because all components have always brought this property -
@Wieland
The documentation and the compiler say that the property does not exist, which is strange because all components have always brought this propertywrote on 7 Jul 2016, 13:59 last edited by@Camilo-del-Real Oh, sry. Then maybe
visible
should do the same. -
@Camilo-del-Real Oh, sry. Then maybe
visible
should do the same.wrote on 7 Jul 2016, 14:25 last edited by@Wieland
If I useDrawer {
visible: appContentManager.depth == 1
onVisibleChanged: dragMargin = visible ? Qt.styleHints.startDragDistance : 0
}the drawer is always show at start up (it is not something to be) and with the treatment of onVisibleChanged the Drawer always has 0 in dragMargin when is hidden, which causes only be difficult to show it with draggind
-
wrote on 7 Jul 2016, 15:06 last edited by
If it's possible to drag a drawer open when it has drag margin set to 0, then please report a bug with appropriate details about the platform and device: https://bugreports.qt.io
-
If it's possible to drag a drawer open when it has drag margin set to 0, then please report a bug with appropriate details about the platform and device: https://bugreports.qt.io
wrote on 7 Jul 2016, 16:48 last edited by Camilo del Real 7 Jul 2016, 16:49@jpnurmi
Well, I found a temporary solution while the original idea is fixed with dragMargin. Making the width is 0 can disable the Drawer, but only with the combination of width and dragMargin, if only use width, is still possible show a Drawer (an empty drawer)Drawer { dragMargin: appContentManager.depth > 1 ? 0 : Qt.styleHints.startDragDistance width: appContentManager.depth > 1 ? 0 : Math.min(appRoot.width, appRoot.height) / 3 * 2 }
I also report the bug
https://bugreports.qt.io/browse/QTBUG-54629
1/7