styled drawer

This commit is contained in:
Benjamin Palko 2025-08-27 11:16:07 -04:00
parent 41fe72522b
commit a3ef488434
2 changed files with 109 additions and 7 deletions

View file

@ -0,0 +1,26 @@
import qs.config
import QtQuick
import QtQuick.Controls
Drawer {
id: control
dim: false
background: Rectangle {
Component.onCompleted: {
if (control.edge == Qt.TopEdge) {
bottomLeftRadius = 8;
bottomRightRadius = 8;
} else if (control.edge == Qt.LeftEdge) {
topRightRadius = 8;
bottomRightRadius = 8;
} else if (control.edge == Qt.RightEdge) {
topLeftRadius = 8;
bottomLeftRadius = 8;
} else if (control.edge == Qt.BottomEdge) {
topLeftRadius = 8;
topRightRadius = 8;
}
}
color: Theme.palette.base200
}
}

View file

@ -26,6 +26,8 @@ StyledWindow {
id: rect
color: Theme.palette.base300
implicitWidth: 800
implicitHeight: 1200
leftMargin: 48
rightMargin: 48
topMargin: 24
@ -41,15 +43,89 @@ StyledWindow {
}
ColumnLayout {
StyledSwitch {}
Button {
id: toolTipButton
text: "Hello world!"
StyledToolTip {
visible: toolTipButton.hovered
text: qsTr("Save the active project")
spacing: 12
ColumnLayout {
StyledText {
text: "Switch"
font.pixelSize: 18
}
StyledSwitch {}
}
ColumnLayout {
StyledText {
text: "ToolTip"
font.pixelSize: 18
}
Button {
id: toolTipButton
text: "Hello world!"
StyledToolTip {
visible: toolTipButton.hovered
text: qsTr("Save the active project")
}
}
}
ColumnLayout {
StyledText {
text: "Drawer"
font.pixelSize: 18
}
RowLayout {
Button {
text: "Top"
onClicked: {
drawer.x = root.width / 2 - drawer.width / 2;
drawer.y = 0;
drawer.edge = Qt.TopEdge;
drawer.open();
}
}
Button {
text: "Left"
onClicked: {
drawer.y = root.height / 2 - drawer.height / 2;
drawer.x = 0;
drawer.edge = Qt.LeftEdge;
drawer.open();
}
}
Button {
text: "Right"
onClicked: {
drawer.y = root.height / 2 - drawer.height / 2;
drawer.x = 0;
drawer.edge = Qt.RightEdge;
drawer.open();
}
}
Button {
text: "Bottom"
onClicked: {
drawer.x = root.width / 2 - drawer.width / 2;
drawer.y = 0;
drawer.edge = Qt.BottomEdge;
drawer.open();
}
}
}
}
}
}
StyledDrawer {
id: drawer
edge: Qt.TopEdge
width: 400
height: 200
Button {
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
text: "Close"
onClicked: drawer.close()
}
}
}