aboutsummaryrefslogtreecommitdiffstats
path: root/config/quickshell/modules/common/widgets/StyledToolTip.qml
diff options
context:
space:
mode:
authorKiran George <kirangeorge1995@gmail.com>2025-06-09 11:30:08 +0530
committerKiran George <kirangeorge1995@gmail.com>2025-06-09 11:30:08 +0530
commit952aa63147c9fb28f6ace6f0bc7ccf45ced1299a (patch)
tree306e6d86603a162c00bc5113b56baac0fe7bec7c /config/quickshell/modules/common/widgets/StyledToolTip.qml
parent4cf0d0bd5930da76e60f6770de3ee97c10ca7024 (diff)
Overview v2
Diffstat (limited to 'config/quickshell/modules/common/widgets/StyledToolTip.qml')
-rw-r--r--config/quickshell/modules/common/widgets/StyledToolTip.qml60
1 files changed, 60 insertions, 0 deletions
diff --git a/config/quickshell/modules/common/widgets/StyledToolTip.qml b/config/quickshell/modules/common/widgets/StyledToolTip.qml
new file mode 100644
index 00000000..2ca16df1
--- /dev/null
+++ b/config/quickshell/modules/common/widgets/StyledToolTip.qml
@@ -0,0 +1,60 @@
+import "root:/modules/common"
+import "root:/modules/common/widgets"
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+
+ToolTip {
+ id: root
+ property string content
+ property bool extraVisibleCondition: true
+ property bool alternativeVisibleCondition: false
+ property bool internalVisibleCondition: {
+ const ans = (extraVisibleCondition && (parent.hovered === undefined || parent?.hovered)) || alternativeVisibleCondition
+ return ans
+ }
+ verticalPadding: 5
+ horizontalPadding: 10
+ opacity: internalVisibleCondition ? 1 : 0
+ visible: opacity > 0
+
+ Behavior on opacity {
+ animation: Appearance?.animation.elementMoveFast.numberAnimation.createObject(this)
+ }
+
+ background: null
+
+ contentItem: Item {
+ id: contentItemBackground
+ implicitWidth: tooltipTextObject.width + 2 * root.horizontalPadding
+ implicitHeight: tooltipTextObject.height + 2 * root.verticalPadding
+
+ Rectangle {
+ id: backgroundRectangle
+ anchors.bottom: contentItemBackground.bottom
+ anchors.horizontalCenter: contentItemBackground.horizontalCenter
+ color: Appearance?.m3colors.colTooltip ?? "#3C4043"
+ radius: Appearance?.rounding.verysmall ?? 7
+ width: internalVisibleCondition ? (tooltipTextObject.width + 2 * padding) : 0
+ height: internalVisibleCondition ? (tooltipTextObject.height + 2 * padding) : 0
+ clip: true
+
+ Behavior on width {
+ animation: Appearance?.animation.elementMoveFast.numberAnimation.createObject(this)
+ }
+ Behavior on height {
+ animation: Appearance?.animation.elementMoveFast.numberAnimation.createObject(this)
+ }
+
+ StyledText {
+ id: tooltipTextObject
+ anchors.centerIn: parent
+ text: content
+ font.pixelSize: Appearance?.font.pixelSize.smaller ?? 14
+ font.hintingPreference: Font.PreferNoHinting // Prevent shaky text
+ color: Appearance?.m3colors.colOnTooltip ?? "#FFFFFF"
+ wrapMode: Text.Wrap
+ }
+ }
+ }
+} \ No newline at end of file
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage