mirror of
https://github.com/QuasarApp/Snake.git
synced 2025-04-28 10:44:42 +00:00
added fixed sidebar
This commit is contained in:
parent
7d85b0101b
commit
cffec96ea9
@ -1,39 +1,35 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls.Material 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Layouts 1.3
|
||||
|
||||
SideBar {
|
||||
id: leftSideBar
|
||||
|
||||
property alias button : closeButton
|
||||
|
||||
anchors.left: parent.left;
|
||||
anchors.top: parent.top;
|
||||
anchors.bottom: parent.bottom;
|
||||
closedWidth: closeButton.width;
|
||||
closedWidth: closeButton.width + padding * 2;
|
||||
openWidth: 10 * metrix.pt;
|
||||
resizeHeight: false;
|
||||
|
||||
header:
|
||||
RowLayout {
|
||||
|
||||
Button {
|
||||
id: closeButton
|
||||
text: leftSideBar.isOpened? "<" : ">"
|
||||
Button {
|
||||
id: closeButton
|
||||
text: leftSideBar.isOpened? "<" : ">"
|
||||
|
||||
height: metrix.controlPtMaterial;
|
||||
width: metrix.controlPtMaterial;
|
||||
Layout.preferredHeight: metrix.controlPtMaterial;
|
||||
Layout.preferredWidth: metrix.controlPtMaterial;
|
||||
|
||||
anchors.right: parent.right;
|
||||
anchors.top: parent.top;
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignTop
|
||||
onClicked: {
|
||||
if (leftSideBar.isOpened)
|
||||
leftSideBar.hide();
|
||||
else
|
||||
leftSideBar.show();
|
||||
}
|
||||
|
||||
anchors.rightMargin: -leftSideBar.padding;
|
||||
anchors.topMargin: -leftSideBar.padding;
|
||||
|
||||
onClicked: {
|
||||
if (leftSideBar.isOpened)
|
||||
leftSideBar.hide();
|
||||
else
|
||||
leftSideBar.show();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ FrameView {
|
||||
property int closedHeight: 1 * metrix.pt
|
||||
property int openWidth: 10 * metrix.pt
|
||||
property int closedWidth: 1 * metrix.pt
|
||||
property int headerHeight : 1 * metrix.controlPtMaterial
|
||||
|
||||
clip: true;
|
||||
|
||||
@ -17,6 +18,7 @@ FrameView {
|
||||
property bool isOpened: true
|
||||
property bool chainAnimation: true
|
||||
property var source: null
|
||||
property var header: null
|
||||
|
||||
readonly property bool openFinished: openHeight === height && openWidth == width;
|
||||
readonly property bool closeFinished: closedHeight === height && closedWidth == width;
|
||||
@ -69,23 +71,33 @@ FrameView {
|
||||
duration: 1000
|
||||
easing.type: Easing.OutBounce
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Item {
|
||||
id: headerVal
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
height: headerHeight
|
||||
}
|
||||
|
||||
Item {
|
||||
id: sourceVal
|
||||
anchors.fill: parent
|
||||
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: headerVal.bottom
|
||||
anchors.bottom: parent.bottom
|
||||
|
||||
}
|
||||
|
||||
onSourceChanged: {
|
||||
source.parent = sourceVal;
|
||||
source.anchors.fill = sourceVal;
|
||||
source.anchors.margins = 0;
|
||||
if (source.close) {
|
||||
closeConnect.target = source;
|
||||
}
|
||||
}
|
||||
|
||||
onHeaderChanged: {
|
||||
header.parent = headerVal;
|
||||
header.anchors.fill = headerVal;
|
||||
}
|
||||
}
|
||||
|
@ -6,10 +6,11 @@ import QtGraphicalEffects 1.12
|
||||
|
||||
|
||||
Flickable {
|
||||
id: userVewFlic
|
||||
|
||||
contentWidth: userVew.width
|
||||
contentHeight: userVew.height
|
||||
// flickingHorizontally: false
|
||||
flickableDirection: Flickable.VerticalFlick;
|
||||
property var model: null
|
||||
signal tryConnect();
|
||||
|
||||
@ -20,8 +21,7 @@ Flickable {
|
||||
Item {
|
||||
id: userVew
|
||||
|
||||
|
||||
width: 7 * metrix.pt
|
||||
width: userVewFlic.width
|
||||
|
||||
ColumnLayout {
|
||||
id: columnLayout
|
||||
|
Loading…
x
Reference in New Issue
Block a user