|
1 | 1 | import QtQuick |
2 | | -import QtQuick.Layouts |
3 | 2 | import Quickshell |
4 | 3 | import qs.Commons |
5 | 4 | import qs.Widgets |
6 | 5 | import qs.Services.UI |
7 | | -Item { |
| 6 | + |
| 7 | +NIconButtonHot { |
8 | 8 | id: root |
| 9 | + |
9 | 10 | property var pluginApi: null |
10 | 11 | property ShellScreen screen |
11 | 12 | property string widgetId: "" |
12 | 13 | property string section: "" |
| 14 | + |
13 | 15 | readonly property string screenName: screen?.name ?? "" |
14 | | - readonly property real capsuleHeight: Style.getCapsuleHeightForScreen(screenName) |
15 | | - readonly property real contentWidth: capsuleHeight |
16 | | - readonly property real contentHeight: capsuleHeight |
17 | | - implicitWidth: contentWidth |
18 | | - implicitHeight: contentHeight |
19 | | - Rectangle { |
20 | | - id: visualCapsule |
21 | | - x: Style.pixelAlignCenter(parent.width, width) |
22 | | - y: Style.pixelAlignCenter(parent.height, height) |
23 | | - width: root.contentWidth |
24 | | - height: root.contentHeight |
25 | | - color: mouseArea.containsMouse ? Color.mHover : Style.capsuleColor |
26 | | - radius: Style.radiusL |
27 | | - border.color: Style.capsuleBorderColor |
28 | | - border.width: Style.capsuleBorderWidth |
29 | | - NIcon { |
30 | | - anchors.centerIn: parent |
31 | | - icon: "crosshair" |
32 | | - color: Color.mPrimary |
33 | | - } |
34 | | - } |
35 | | - MouseArea { |
36 | | - id: mouseArea |
37 | | - anchors.fill: parent |
38 | | - hoverEnabled: true |
39 | | - cursorShape: Qt.PointingHandCursor |
40 | | - onEntered: TooltipService.show(root, "Screen Toolkit", BarService.getTooltipDirection()) |
41 | | - onExited: TooltipService.hide() |
42 | | - onClicked: { |
43 | | - if (pluginApi) pluginApi.togglePanel(root.screen, root) |
| 16 | + |
| 17 | + icon: "crosshair" |
| 18 | + tooltipText: "Screen Toolkit" |
| 19 | + |
| 20 | + onClicked: { |
| 21 | + if (pluginApi) { |
| 22 | + pluginApi.togglePanel(screen, root); |
44 | 23 | } |
45 | 24 | } |
46 | 25 | } |
0 commit comments