wip
This commit is contained in:
parent
13dc798565
commit
75f1fc1905
2 changed files with 65 additions and 23 deletions
37
components/StyledPopup.qml
Normal file
37
components/StyledPopup.qml
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
import qs.config
|
||||||
|
import QtQuick
|
||||||
|
import Quickshell
|
||||||
|
import Quickshell.Hyprland
|
||||||
|
|
||||||
|
PopupWindow {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
implicitWidth: background.implicitWidth
|
||||||
|
implicitHeight: background.implicitHeight
|
||||||
|
color: "transparent"
|
||||||
|
|
||||||
|
function open() {
|
||||||
|
visible = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function close() {
|
||||||
|
visible = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
HyprlandFocusGrab {
|
||||||
|
id: grab
|
||||||
|
windows: [root]
|
||||||
|
onCleared: {
|
||||||
|
root.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: background
|
||||||
|
anchors.centerIn: root
|
||||||
|
implicitWidth: root.contentItem.children.reduce((prev, child) => Math.max(prev, child.width), 0)
|
||||||
|
implicitHeight: root.contentItem.children.reduce((prev, child) => prev + child.height, 0)
|
||||||
|
color: Theme.palette.base200
|
||||||
|
radius: 8
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
pragma ComponentBehavior: Bound
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import qs.widgets
|
|
||||||
import qs.components
|
import qs.components
|
||||||
import qs.config
|
import qs.config
|
||||||
import qs.constants
|
import qs.constants
|
||||||
|
|
@ -22,11 +21,6 @@ StyledWindow {
|
||||||
WlrLayershell.layer: WlrLayer.Top
|
WlrLayershell.layer: WlrLayer.Top
|
||||||
WlrLayershell.keyboardFocus: root.visible ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None
|
WlrLayershell.keyboardFocus: root.visible ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None
|
||||||
|
|
||||||
StyledWrapperRectangle {
|
|
||||||
id: rect
|
|
||||||
|
|
||||||
margin: 48
|
|
||||||
|
|
||||||
HyprlandFocusGrab {
|
HyprlandFocusGrab {
|
||||||
active: Visibility.storybook
|
active: Visibility.storybook
|
||||||
windows: [root]
|
windows: [root]
|
||||||
|
|
@ -35,11 +29,20 @@ StyledWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
StyledWrapperRectangle {
|
||||||
|
id: rect
|
||||||
|
|
||||||
spacing: 12
|
margin: 48
|
||||||
|
|
||||||
|
GridLayout {
|
||||||
|
id: grid
|
||||||
|
|
||||||
|
flow: GridLayout.TopToBottom
|
||||||
|
columns: 2
|
||||||
|
rows: 10
|
||||||
|
|
||||||
StyledText {
|
StyledText {
|
||||||
|
Layout.columnSpan: grid.columns
|
||||||
Layout.alignment: Qt.AlignHCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
text: "Components"
|
text: "Components"
|
||||||
font.pixelSize: 24
|
font.pixelSize: 24
|
||||||
|
|
@ -151,7 +154,7 @@ StyledWindow {
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
StyledText {
|
StyledText {
|
||||||
text: "Menu"
|
text: "Popup"
|
||||||
font.pixelSize: 18
|
font.pixelSize: 18
|
||||||
}
|
}
|
||||||
Button {
|
Button {
|
||||||
|
|
@ -159,23 +162,25 @@ StyledWindow {
|
||||||
text: "File"
|
text: "File"
|
||||||
onPressed: menu.visible ? menu.close() : menu.open()
|
onPressed: menu.visible ? menu.close() : menu.open()
|
||||||
|
|
||||||
StyledMenu {
|
StyledPopup {
|
||||||
id: menu
|
id: menu
|
||||||
y: fileButton.height
|
|
||||||
|
|
||||||
StyledMenuItem {
|
anchor.item: fileButton
|
||||||
|
|
||||||
|
Column {
|
||||||
|
StyledButton {
|
||||||
text: "New..."
|
text: "New..."
|
||||||
}
|
}
|
||||||
StyledMenuItem {
|
StyledButton {
|
||||||
text: "Open..."
|
text: "Open..."
|
||||||
}
|
}
|
||||||
StyledMenuSeparator {}
|
StyledText {
|
||||||
StyledMenuItem {
|
|
||||||
text: "Close"
|
text: "Close"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
StyledText {
|
StyledText {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue