forked from Shinonome/dots-hyprland
vertical bar: make tray tooltips not cut off
This commit is contained in:
@@ -91,10 +91,11 @@ MouseArea {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
StyledToolTip {
|
PopupToolTip {
|
||||||
id: tooltip
|
id: tooltip
|
||||||
extraVisibleCondition: root.containsMouse
|
extraVisibleCondition: root.containsMouse
|
||||||
alternativeVisibleCondition: extraVisibleCondition
|
alternativeVisibleCondition: extraVisibleCondition
|
||||||
|
anchorEdges: (!Config.options.bar.bottom && !Config.options.bar.vertical) ? Edges.Bottom : Edges.Top
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
import qs.modules.common
|
||||||
|
import qs.modules.common.widgets
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Controls
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import Quickshell
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
property string text: ""
|
||||||
|
property bool extraVisibleCondition: true
|
||||||
|
property bool alternativeVisibleCondition: false
|
||||||
|
property real horizontalPadding: 10
|
||||||
|
property real verticalPadding: 5
|
||||||
|
|
||||||
|
property var anchorEdges: Edges.Top
|
||||||
|
property var anchorGravity: anchorEdges
|
||||||
|
|
||||||
|
readonly property bool internalVisibleCondition: (extraVisibleCondition && (parent.hovered === undefined || parent?.hovered)) || alternativeVisibleCondition
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
id: tooltipLoader
|
||||||
|
anchors.fill: parent
|
||||||
|
active: internalVisibleCondition
|
||||||
|
sourceComponent: PopupWindow {
|
||||||
|
visible: true
|
||||||
|
anchor {
|
||||||
|
window: root.QsWindow.window
|
||||||
|
item: root.parent
|
||||||
|
edges: root.anchorEdges
|
||||||
|
gravity: root.anchorGravity
|
||||||
|
}
|
||||||
|
mask: Region {
|
||||||
|
item: null
|
||||||
|
}
|
||||||
|
|
||||||
|
color: "transparent"
|
||||||
|
implicitWidth: contentItem.implicitWidth + root.horizontalPadding * 2
|
||||||
|
implicitHeight: contentItem.implicitHeight + root.verticalPadding * 2
|
||||||
|
|
||||||
|
StyledToolTipContent {
|
||||||
|
id: contentItem
|
||||||
|
anchors.centerIn: parent
|
||||||
|
text: root.text
|
||||||
|
shown: false
|
||||||
|
Component.onCompleted: shown = true
|
||||||
|
horizontalPadding: root.horizontalPadding
|
||||||
|
verticalPadding: root.verticalPadding
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,21 +7,25 @@ import QtQuick.Layouts
|
|||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
required property string text
|
required property string text
|
||||||
property bool shown: true
|
property bool shown: false
|
||||||
property real horizontalPadding: 10
|
property real horizontalPadding: 10
|
||||||
property real verticalPadding: 5
|
property real verticalPadding: 5
|
||||||
implicitWidth: tooltipTextObject.implicitWidth + 2 * root.horizontalPadding
|
implicitWidth: tooltipTextObject.implicitWidth + 2 * root.horizontalPadding
|
||||||
implicitHeight: tooltipTextObject.implicitHeight + 2 * root.verticalPadding
|
implicitHeight: tooltipTextObject.implicitHeight + 2 * root.verticalPadding
|
||||||
|
|
||||||
|
property bool isVisible: backgroundRectangle.implicitHeight > 0
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: backgroundRectangle
|
id: backgroundRectangle
|
||||||
anchors.bottom: root.bottom
|
anchors {
|
||||||
anchors.horizontalCenter: root.horizontalCenter
|
bottom: root.bottom
|
||||||
|
horizontalCenter: root.horizontalCenter
|
||||||
|
}
|
||||||
color: Appearance?.colors.colTooltip ?? "#3C4043"
|
color: Appearance?.colors.colTooltip ?? "#3C4043"
|
||||||
radius: Appearance?.rounding.verysmall ?? 7
|
radius: Appearance?.rounding.verysmall ?? 7
|
||||||
opacity: shown ? 1 : 0
|
opacity: shown ? 1 : 0
|
||||||
implicitWidth: shown ? (tooltipTextObject.implicitWidth + 2 * padding) : 0
|
implicitWidth: shown ? (tooltipTextObject.implicitWidth + 2 * root.horizontalPadding) : 0
|
||||||
implicitHeight: shown ? (tooltipTextObject.implicitHeight + 2 * padding) : 0
|
implicitHeight: shown ? (tooltipTextObject.implicitHeight + 2 * root.verticalPadding) : 0
|
||||||
clip: true
|
clip: true
|
||||||
|
|
||||||
Behavior on implicitWidth {
|
Behavior on implicitWidth {
|
||||||
|
|||||||
Reference in New Issue
Block a user