fix flyouts
This commit is contained in:
parent
99f71f858d
commit
bc3a85d18d
6 changed files with 8 additions and 16 deletions
|
|
@ -1,5 +1,4 @@
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
|
||||||
import "." as M
|
import "." as M
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
|
|
@ -16,10 +15,8 @@ Text {
|
||||||
HoverHandler {
|
HoverHandler {
|
||||||
onHoveredChanged: {
|
onHoveredChanged: {
|
||||||
if (hovered && root.tooltip !== "") {
|
if (hovered && root.tooltip !== "") {
|
||||||
const win = QsWindow.window
|
|
||||||
M.FlyoutState.text = root.tooltip
|
M.FlyoutState.text = root.tooltip
|
||||||
M.FlyoutState.itemX = root.mapToItem(win, root.width / 2, 0).x
|
M.FlyoutState.itemX = root.mapToGlobal(root.width / 2, 0).x
|
||||||
M.FlyoutState.screen = win?.screen ?? null
|
|
||||||
M.FlyoutState.visible = true
|
M.FlyoutState.visible = true
|
||||||
} else if (!hovered && root.tooltip !== "") {
|
} else if (!hovered && root.tooltip !== "") {
|
||||||
M.FlyoutState.visible = false
|
M.FlyoutState.visible = false
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
|
||||||
import "." as M
|
import "." as M
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
|
|
@ -16,10 +15,8 @@ Text {
|
||||||
HoverHandler {
|
HoverHandler {
|
||||||
onHoveredChanged: {
|
onHoveredChanged: {
|
||||||
if (hovered && root.tooltip !== "") {
|
if (hovered && root.tooltip !== "") {
|
||||||
const win = QsWindow.window
|
|
||||||
M.FlyoutState.text = root.tooltip
|
M.FlyoutState.text = root.tooltip
|
||||||
M.FlyoutState.itemX = root.mapToItem(win, root.width / 2, 0).x
|
M.FlyoutState.itemX = root.mapToGlobal(root.width / 2, 0).x
|
||||||
M.FlyoutState.screen = win?.screen ?? null
|
|
||||||
M.FlyoutState.visible = true
|
M.FlyoutState.visible = true
|
||||||
} else if (!hovered && root.tooltip !== "") {
|
} else if (!hovered && root.tooltip !== "") {
|
||||||
M.FlyoutState.visible = false
|
M.FlyoutState.visible = false
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import Quickshell
|
|
||||||
import "." as M
|
import "." as M
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
|
|
@ -9,10 +8,8 @@ Row {
|
||||||
HoverHandler {
|
HoverHandler {
|
||||||
onHoveredChanged: {
|
onHoveredChanged: {
|
||||||
if (hovered && root.tooltip !== "") {
|
if (hovered && root.tooltip !== "") {
|
||||||
const win = QsWindow.window
|
|
||||||
M.FlyoutState.text = root.tooltip
|
M.FlyoutState.text = root.tooltip
|
||||||
M.FlyoutState.itemX = root.mapToItem(win, root.width / 2, 0).x
|
M.FlyoutState.itemX = root.mapToGlobal(root.width / 2, 0).x
|
||||||
M.FlyoutState.screen = win?.screen ?? null
|
|
||||||
M.FlyoutState.visible = true
|
M.FlyoutState.visible = true
|
||||||
} else if (!hovered && root.tooltip !== "") {
|
} else if (!hovered && root.tooltip !== "") {
|
||||||
M.FlyoutState.visible = false
|
M.FlyoutState.visible = false
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ PanelWindow {
|
||||||
|
|
||||||
required property var screen
|
required property var screen
|
||||||
|
|
||||||
visible: M.FlyoutState.visible && M.FlyoutState.screen === screen
|
visible: M.FlyoutState.visible
|
||||||
color: "transparent"
|
color: "transparent"
|
||||||
|
|
||||||
WlrLayershell.layer: WlrLayer.Overlay
|
WlrLayershell.layer: WlrLayer.Overlay
|
||||||
|
|
|
||||||
|
|
@ -5,5 +5,4 @@ QtObject {
|
||||||
property bool visible: false
|
property bool visible: false
|
||||||
property string text: ""
|
property string text: ""
|
||||||
property real itemX: 0
|
property real itemX: 0
|
||||||
property var screen: null
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,8 +37,10 @@ M.BarIcon {
|
||||||
onRunningChanged: if (!running && next !== "") proc.running = true
|
onRunningChanged: if (!running && next !== "") proc.running = true
|
||||||
}
|
}
|
||||||
|
|
||||||
TapHandler {
|
MouseArea {
|
||||||
onTapped: {
|
anchors.fill: parent
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
onClicked: {
|
||||||
const cycle = ["performance", "balanced", "power-saver"];
|
const cycle = ["performance", "balanced", "power-saver"];
|
||||||
const idx = cycle.indexOf(root.profile);
|
const idx = cycle.indexOf(root.profile);
|
||||||
setter.next = cycle[(idx + 1) % cycle.length];
|
setter.next = cycle[(idx + 1) % cycle.length];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue