moment/src/qml/SidePane/SidePane.qml

64 lines
1.5 KiB
QML
Raw Normal View History

2019-07-08 13:52:41 +10:00
// Copyright 2019 miruka
// This file is part of harmonyqml, licensed under LGPLv3.
import QtQuick 2.12
import QtQuick.Layouts 1.12
import "../Base"
HRectangle {
id: sidePane
clip: true // Avoid artifacts when collapsed
visible: mainUI.accountsPresent
2019-04-29 01:01:38 +10:00
2019-07-16 23:21:45 +10:00
property bool canAutoSize: true
property int parentWidth: parent.width
2019-07-16 23:21:45 +10:00
// Needed for SplitView because it breaks the binding on collapse
onParentWidthChanged: if (canAutoSize) {
width = Qt.binding(() => implicitWidth)
}
2019-07-16 23:21:45 +10:00
property int autoWidth:
Math.min(
parentWidth * theme.sidePane.autoWidthRatio,
theme.sidePane.maximumAutoWidth
)
2019-07-12 12:25:50 +10:00
2019-07-16 23:21:45 +10:00
property bool collapse:
canAutoSize ?
autoWidth < theme.sidePane.autoCollapseBelowWidth :
width < theme.sidePane.autoCollapseBelowWidth
2019-07-16 22:36:11 +10:00
2019-07-16 23:21:45 +10:00
property bool reduce:
window.width < theme.sidePane.autoReduceBelowWindowWidth
2019-07-16 23:21:45 +10:00
property int implicitWidth:
reduce ? 0 :
collapse ? theme.sidePane.collapsedWidth :
autoWidth
2019-07-16 23:21:45 +10:00
property int currentSpacing: collapse ? 0 : theme.spacing
2019-07-16 23:21:45 +10:00
Behavior on currentSpacing { HNumberAnimation {} }
Behavior on implicitWidth { HNumberAnimation {} }
HColumnLayout {
anchors.fill: parent
AccountList {
Layout.fillWidth: true
Layout.fillHeight: true
2019-07-13 07:06:37 +10:00
spacing: currentSpacing
bottomMargin: currentSpacing
}
PaneToolBar {
id: paneToolBar
}
}
}