Compare commits
No commits in common. "11d0e4a8380c382d44349579bbc5f839edc78ea0" and "75f780753f9cf0ad4cc0ab42bfb86a730f722e2a" have entirely different histories.
11d0e4a838
...
75f780753f
6 changed files with 245 additions and 146 deletions
34
components/StyledMenu.qml
Normal file
34
components/StyledMenu.qml
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
import qs.config
|
||||||
|
import qs.services
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
|
||||||
|
Menu {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
palette.window: Theme.palette.base100
|
||||||
|
palette.base: Theme.palette.base100
|
||||||
|
|
||||||
|
focus: true
|
||||||
|
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
|
||||||
|
popupType: Popup.Window
|
||||||
|
|
||||||
|
function toggle() {
|
||||||
|
visible ? close() : open();
|
||||||
|
}
|
||||||
|
|
||||||
|
enter: Transition {
|
||||||
|
NumberAnimation {
|
||||||
|
property: "opacity"
|
||||||
|
from: 0.0
|
||||||
|
to: 1.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exit: Transition {
|
||||||
|
NumberAnimation {
|
||||||
|
property: "opacity"
|
||||||
|
from: 1.0
|
||||||
|
to: 0.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
9
components/StyledMenuItem.qml
Normal file
9
components/StyledMenuItem.qml
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
import qs.config
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
|
||||||
|
MenuItem {
|
||||||
|
palette.text: Theme.palette.basecontent
|
||||||
|
palette.highlight: Theme.palette.primary
|
||||||
|
palette.highlightedText: Theme.palette.primarycontent
|
||||||
|
}
|
||||||
9
components/StyledMenuSeparator.qml
Normal file
9
components/StyledMenuSeparator.qml
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
import qs.config
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
|
||||||
|
MenuSeparator {
|
||||||
|
palette.text: Theme.palette.basecontent
|
||||||
|
palette.highlight: Theme.palette.primary
|
||||||
|
palette.highlightedText: Theme.palette.primarycontent
|
||||||
|
}
|
||||||
|
|
@ -6,10 +6,9 @@ import Quickshell.Hyprland
|
||||||
PopupWindow {
|
PopupWindow {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
implicitWidth: contentItem.children.reduce((prev, child) => Math.max(prev, child.width), 0)
|
implicitWidth: background.implicitWidth
|
||||||
implicitHeight: contentItem.children.reduce((prev, child) => prev + child.height, 0)
|
implicitHeight: background.implicitHeight
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
contentItem.focus: visible
|
|
||||||
|
|
||||||
function open() {
|
function open() {
|
||||||
visible = true;
|
visible = true;
|
||||||
|
|
@ -19,10 +18,8 @@ PopupWindow {
|
||||||
visible = false;
|
visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// WlrLayershell.layer: WlrLayer.Top
|
|
||||||
// WlrLayershell.keyboardFocus: root.visible ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None
|
|
||||||
HyprlandFocusGrab {
|
HyprlandFocusGrab {
|
||||||
active: root.visible
|
id: grab
|
||||||
windows: [root]
|
windows: [root]
|
||||||
onCleared: {
|
onCleared: {
|
||||||
root.close();
|
root.close();
|
||||||
|
|
@ -31,7 +28,9 @@ PopupWindow {
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: background
|
id: background
|
||||||
anchors.fill: parent
|
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
|
color: Theme.palette.base200
|
||||||
radius: 8
|
radius: 8
|
||||||
}
|
}
|
||||||
|
|
@ -78,11 +78,7 @@ Variants {
|
||||||
Launcher {}
|
Launcher {}
|
||||||
Pomodoro {}
|
Pomodoro {}
|
||||||
PowerMenu {}
|
PowerMenu {}
|
||||||
Storybook {
|
Storybook {}
|
||||||
anchor.window: topWindow
|
|
||||||
anchor.rect.x: topWindow.width / 2 - width / 2
|
|
||||||
anchor.rect.y: topWindow.height / 4
|
|
||||||
}
|
|
||||||
Drawers {}
|
Drawers {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,14 +4,35 @@ import qs.components
|
||||||
import qs.config
|
import qs.config
|
||||||
import qs.constants
|
import qs.constants
|
||||||
import qs.services
|
import qs.services
|
||||||
|
import Quickshell.Hyprland
|
||||||
|
import Quickshell.Wayland
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
|
||||||
StyledPopupWindow {
|
StyledWindow {
|
||||||
id: root
|
id: root
|
||||||
|
name: "storybook"
|
||||||
|
|
||||||
visible: Visibility.storybook
|
visible: Visibility.storybook
|
||||||
|
implicitWidth: rect.width
|
||||||
|
implicitHeight: rect.height
|
||||||
|
|
||||||
|
WlrLayershell.layer: WlrLayer.Top
|
||||||
|
WlrLayershell.keyboardFocus: root.visible ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None
|
||||||
|
|
||||||
|
HyprlandFocusGrab {
|
||||||
|
active: Visibility.storybook
|
||||||
|
windows: [root]
|
||||||
|
onCleared: {
|
||||||
|
Visibility.storybook = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StyledWrapperRectangle {
|
||||||
|
id: rect
|
||||||
|
|
||||||
|
margin: 48
|
||||||
|
|
||||||
GridLayout {
|
GridLayout {
|
||||||
id: grid
|
id: grid
|
||||||
|
|
@ -131,6 +152,36 @@ StyledPopupWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
StyledText {
|
||||||
|
text: "Popup"
|
||||||
|
font.pixelSize: 18
|
||||||
|
}
|
||||||
|
Button {
|
||||||
|
id: fileButton
|
||||||
|
text: "File"
|
||||||
|
onPressed: menu.visible ? menu.close() : menu.open()
|
||||||
|
|
||||||
|
StyledPopup {
|
||||||
|
id: menu
|
||||||
|
|
||||||
|
anchor.item: fileButton
|
||||||
|
|
||||||
|
Column {
|
||||||
|
StyledButton {
|
||||||
|
text: "New..."
|
||||||
|
}
|
||||||
|
StyledButton {
|
||||||
|
text: "Open..."
|
||||||
|
}
|
||||||
|
StyledText {
|
||||||
|
text: "Close"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
StyledText {
|
StyledText {
|
||||||
text: "Drawer"
|
text: "Drawer"
|
||||||
|
|
@ -176,6 +227,7 @@ StyledPopupWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
StyledDrawer {
|
StyledDrawer {
|
||||||
id: drawer
|
id: drawer
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue