simplify StyledPopupWindow
This commit is contained in:
parent
fdcaa77581
commit
a9518df97f
4 changed files with 6 additions and 24 deletions
|
|
@ -1,22 +1,16 @@
|
||||||
|
import qs.config
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Hyprland
|
import Quickshell.Hyprland
|
||||||
import Quickshell.Widgets
|
|
||||||
|
|
||||||
PopupWindow {
|
PopupWindow {
|
||||||
id: root
|
id: root
|
||||||
property bool opened: false
|
|
||||||
property int animationDuration: 200
|
|
||||||
property alias margins: background.margin
|
|
||||||
property alias backgroundColor: background.color
|
|
||||||
property alias radius: background.radius
|
|
||||||
property alias state: background.state
|
|
||||||
required property Component content
|
required property Component content
|
||||||
|
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
|
||||||
function toggle() {
|
function toggle() {
|
||||||
root.state = root.state == "opened" ? "closed" : "opened";
|
background.state = background.state == "opened" ? "closed" : "opened";
|
||||||
}
|
}
|
||||||
|
|
||||||
HyprlandFocusGrab {
|
HyprlandFocusGrab {
|
||||||
|
|
@ -24,16 +18,17 @@ PopupWindow {
|
||||||
active: root.visible
|
active: root.visible
|
||||||
windows: [root]
|
windows: [root]
|
||||||
onCleared: {
|
onCleared: {
|
||||||
root.state = "closed";
|
background.state = "closed";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
implicitWidth: background.width
|
implicitWidth: background.width
|
||||||
implicitHeight: background.height
|
implicitHeight: background.height
|
||||||
|
|
||||||
WrapperRectangle {
|
StyledWrapperRectangle {
|
||||||
id: background
|
id: background
|
||||||
|
|
||||||
|
margin: 16
|
||||||
focus: true
|
focus: true
|
||||||
onFocusChanged: {
|
onFocusChanged: {
|
||||||
if (!focus) {
|
if (!focus) {
|
||||||
|
|
@ -43,7 +38,7 @@ PopupWindow {
|
||||||
|
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
duration: root.animationDuration
|
duration: Styling.animations.speed.normal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
pragma ComponentBehavior: Bound
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import qs.components
|
import qs.components
|
||||||
import qs.config
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
|
@ -10,10 +9,6 @@ import Quickshell.Bluetooth
|
||||||
StyledPopupWindow {
|
StyledPopupWindow {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
backgroundColor: Styling.theme.base300
|
|
||||||
margins: 16
|
|
||||||
radius: 8
|
|
||||||
|
|
||||||
content: ColumnLayout {
|
content: ColumnLayout {
|
||||||
spacing: 8
|
spacing: 8
|
||||||
StyledWrapperRectangle {
|
StyledWrapperRectangle {
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,6 @@ import QtQuick.Layouts
|
||||||
StyledPopupWindow {
|
StyledPopupWindow {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
backgroundColor: Styling.theme.base300
|
|
||||||
margins: 16
|
|
||||||
radius: 8
|
|
||||||
|
|
||||||
content: GridLayout {
|
content: GridLayout {
|
||||||
|
|
||||||
columns: 2
|
columns: 2
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,6 @@ import Quickshell
|
||||||
StyledPopupWindow {
|
StyledPopupWindow {
|
||||||
id: window
|
id: window
|
||||||
|
|
||||||
backgroundColor: Styling.theme.base300
|
|
||||||
margins: 14
|
|
||||||
radius: 8
|
|
||||||
|
|
||||||
property QsMenuOpener menuOpener
|
property QsMenuOpener menuOpener
|
||||||
|
|
||||||
content: ColumnLayout {
|
content: ColumnLayout {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue