diff options
| author | Ja.KooLit <85185940+JaKooLit@users.noreply.github.com> | 2025-07-15 19:48:59 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-15 19:48:59 +0900 |
| commit | 30f73308e232b49cfb30dc8015b315ea24e6b80c (patch) | |
| tree | 69e8b1f219b2638d3119c70aea870730d7dae105 /config/quickshell/modules/common/widgets/StyledToolTip.qml | |
| parent | ccc57814f5b72f5481d5ea7fe4de4958dc80f553 (diff) | |
| parent | d3a59bcfac1f24b0f44e4bc798a59ac494bfedeb (diff) | |
Merge pull request #762 from JaKooLit/dev-quickshell
Merging Dev-quickshell to development
Diffstat (limited to 'config/quickshell/modules/common/widgets/StyledToolTip.qml')
| -rw-r--r-- | config/quickshell/modules/common/widgets/StyledToolTip.qml | 60 |
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..aaaad813 --- /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.textSmall ?? 14 + font.hintingPreference: Font.PreferNoHinting // Prevent shaky text + color: Appearance?.m3colors.colOnTooltip ?? "#FFFFFF" + wrapMode: Text.Wrap + } + } + } +}
\ No newline at end of file |
