Add conveniance HDrawer.normalOrForceCollapse prop

This commit is contained in:
miruka 2021-04-10 01:00:20 -04:00
parent 4925b5a134
commit 46e058f2de
3 changed files with 8 additions and 11 deletions

View File

@ -49,17 +49,19 @@ Drawer {
requireDefaultSize ? defaultSize : minimumSize requireDefaultSize ? defaultSize : minimumSize
readonly property int calculatedSizeNoRequiredMinimum: readonly property int calculatedSizeNoRequiredMinimum:
collapse || forceCollapse ? normalOrForceCollapse ?
peekSizeWhileCollapsed : peekSizeWhileCollapsed :
Math.max(minimumSize, Math.min(preferredSize, maximumSize)) Math.max(minimumSize, Math.min(preferredSize, maximumSize))
readonly property int calculatedSize: readonly property int calculatedSize:
collapse || forceCollapse ? normalOrForceCollapse ?
peekSizeWhileCollapsed : peekSizeWhileCollapsed :
Math.max(calculatedMinimumSize, Math.min(preferredSize, maximumSize)) Math.max(calculatedMinimumSize, Math.min(preferredSize, maximumSize))
// //
readonly property bool normalOrForceCollapse: collapse || forceCollapse
readonly property int visibleSize: visible ? width * position : 0 readonly property int visibleSize: visible ? width * position : 0
readonly property bool horizontal: readonly property bool horizontal:
@ -81,7 +83,7 @@ Drawer {
// FIXME: https://bugreports.qt.io/browse/QTBUG-59141 // FIXME: https://bugreports.qt.io/browse/QTBUG-59141
// dragMargin: parent.width / 2 // dragMargin: parent.width / 2
// interactive: collapse || forceCollapse // interactive: normalOrForceCollapse
dragMargin: 0 dragMargin: 0
interactive: false interactive: false

View File

@ -27,10 +27,7 @@ DragHandler {
signal closeRequest() signal closeRequest()
target: null target: null
enabled: drawer.normalOrForceCollapse && drawer.visible
enabled:
(drawer.collapse || drawer.forceCollapse) &&
drawer.visible
onTranslationChanged: { onTranslationChanged: {
if (hide.running || cancel.running) return if (hide.running || cancel.running) return

View File

@ -26,7 +26,7 @@ Rectangle {
RoomHeaderButton { RoomHeaderButton {
id: goToMainPaneButton id: goToMainPaneButton
show: mainUI.mainPane.collapse || mainUI.mainPane.forceCollapse show: mainUI.mainPane.normalOrForceCollapse
padded: false padded: false
backgroundColor: "transparent" backgroundColor: "transparent"
icon.name: "go-back-to-main-pane" icon.name: "go-back-to-main-pane"
@ -216,9 +216,7 @@ Rectangle {
RoomHeaderButton { RoomHeaderButton {
id: goToRoomPaneButton id: goToRoomPaneButton
show: show: chat.roomPane && chat.roomPane.normalOrForceCollapse
chat.roomPane &&
(chat.roomPane.collapse || chat.roomPane.forceCollapse)
padded: false padded: false
backgroundColor: "transparent" backgroundColor: "transparent"