Refactor Chat/RoomSidePane
This commit is contained in:
@@ -2,9 +2,5 @@ import QtQuick 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
|
||||
ColumnLayout {
|
||||
id: columnLayout
|
||||
spacing: 0
|
||||
|
||||
property int totalSpacing:
|
||||
spacing * Math.max(0, (columnLayout.visibleChildren.length - 1))
|
||||
}
|
||||
|
@@ -5,7 +5,12 @@ import "../utils.js" as Utils
|
||||
Drawer {
|
||||
id: drawer
|
||||
implicitWidth: calculatedWidth
|
||||
implicitHeight: parent.height
|
||||
implicitHeight: referenceSizeParent.height
|
||||
|
||||
topPadding: 0
|
||||
bottomPadding: 0
|
||||
leftPadding: 0
|
||||
rightPadding: 0
|
||||
|
||||
// FIXME: https://bugreports.qt.io/browse/QTBUG-59141
|
||||
// dragMargin: parent.width / 2
|
||||
@@ -21,12 +26,15 @@ Drawer {
|
||||
|
||||
signal userResized(int newWidth)
|
||||
|
||||
property Item referenceSizeParent: parent
|
||||
|
||||
property int normalWidth: 300
|
||||
property int minNormalWidth: resizeAreaWidth
|
||||
property int maxNormalWidth: parent.width
|
||||
property int maxNormalWidth:
|
||||
referenceSizeParent.width - theme.minimumSupportedWidth
|
||||
|
||||
property bool collapse: window.width < 400
|
||||
property int collapseExpandedWidth: parent.width
|
||||
property int collapseExpandedWidth: referenceSizeParent.width
|
||||
|
||||
property alias color: bg.color
|
||||
property alias resizeAreaWidth: resizeArea.width
|
||||
@@ -44,7 +52,7 @@ Drawer {
|
||||
|
||||
Item {
|
||||
id: resizeArea
|
||||
anchors.right: parent.right
|
||||
x: drawer.edge === Qt.LeftEdge ? drawer.width - width : 0
|
||||
width: theme.spacing / 2
|
||||
height: parent.height
|
||||
z: 9999
|
||||
@@ -63,8 +71,11 @@ Drawer {
|
||||
onReleased: { canResize = false; userResized(drawer.normalWidth) }
|
||||
|
||||
onMouseXChanged:
|
||||
if (canResize)
|
||||
drawer.normalWidth = drawer.calculatedWidth + mouseX
|
||||
if (canResize) {
|
||||
drawer.normalWidth =
|
||||
drawer.calculatedWidth +
|
||||
(drawer.edge === Qt.RightEdge ? -mouseX : mouseX)
|
||||
}
|
||||
|
||||
property bool canResize: false
|
||||
}
|
||||
|
36
src/qml/Base/HFlow.qml
Normal file
36
src/qml/Base/HFlow.qml
Normal file
@@ -0,0 +1,36 @@
|
||||
import QtQuick 2.12
|
||||
|
||||
Flow {
|
||||
populate: Transition {
|
||||
id: addTrans
|
||||
|
||||
SequentialAnimation {
|
||||
PropertyAction { property: "opacity"; value: 0 }
|
||||
|
||||
PauseAnimation {
|
||||
duration:
|
||||
addTrans.ViewTransition.index * theme.animationDuration / 2
|
||||
}
|
||||
|
||||
ParallelAnimation {
|
||||
HNumberAnimation { property: "opacity"; to: 1 }
|
||||
HNumberAnimation { properties: "x,y"; from: 0 }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
add: Transition {
|
||||
ParallelAnimation {
|
||||
HNumberAnimation { property: "opacity"; to: 1 }
|
||||
HNumberAnimation { properties: "x,y"; from: 0 }
|
||||
}
|
||||
}
|
||||
|
||||
move: Transition {
|
||||
ParallelAnimation {
|
||||
// Ensure opacity goes to 1 if add transition is interrupted
|
||||
HNumberAnimation { property: "opacity"; to: 1 }
|
||||
HNumberAnimation { properties: "x,y" }
|
||||
}
|
||||
}
|
||||
}
|
@@ -2,10 +2,6 @@ import QtQuick 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
|
||||
GridLayout {
|
||||
id: gridLayout
|
||||
rowSpacing: 0
|
||||
columnSpacing: 0
|
||||
|
||||
property int totalSpacing:
|
||||
spacing * Math.max(0, (gridLayout.visibleChildren.length - 1))
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
import QtQuick 2.12
|
||||
|
||||
Loader {
|
||||
id: loader
|
||||
asynchronous: true
|
||||
visible: status == Loader.Ready
|
||||
}
|
||||
|
@@ -2,9 +2,5 @@ import QtQuick 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
|
||||
RowLayout {
|
||||
id: rowLayout
|
||||
spacing: 0
|
||||
|
||||
property int totalSpacing:
|
||||
spacing * Math.max(0, (rowLayout.visibleChildren.length - 1))
|
||||
}
|
||||
|
@@ -1,24 +0,0 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 1.4 as Controls1
|
||||
|
||||
//https://doc.qt.io/qt-5/qml-qtquick-controls-splitview.html
|
||||
Controls1.SplitView {
|
||||
id: splitView
|
||||
|
||||
property bool anyHovered: false
|
||||
property bool anyPressed: false
|
||||
property bool anyResizing: false
|
||||
|
||||
property bool manuallyResized: false
|
||||
onAnyResizingChanged: manuallyResized = true
|
||||
|
||||
handleDelegate: Item {
|
||||
readonly property bool hovered: styleData.hovered
|
||||
readonly property bool pressed: styleData.pressed
|
||||
readonly property bool resizing: styleData.resizing
|
||||
|
||||
onHoveredChanged: splitView.anyHovered = hovered
|
||||
onPressedChanged: splitView.anyPressed = pressed
|
||||
onResizingChanged: splitView.anyResizing = resizing
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user