mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
fix(tooltips): added support for string vs array content everywhere
This commit is contained in:
@@ -12,7 +12,7 @@ Item {
|
||||
property string icon: ""
|
||||
property string text: ""
|
||||
property string suffix: ""
|
||||
property var tooltipText: ""
|
||||
property var tooltipText
|
||||
property bool autoHide: false
|
||||
property bool forceOpen: false
|
||||
property bool forceClose: false
|
||||
|
||||
@@ -13,7 +13,7 @@ Item {
|
||||
property string icon: ""
|
||||
property string text: ""
|
||||
property string suffix: ""
|
||||
property var tooltipText: ""
|
||||
property var tooltipText
|
||||
property bool autoHide: false
|
||||
property bool forceOpen: false
|
||||
property bool forceClose: false
|
||||
|
||||
@@ -13,7 +13,7 @@ Item {
|
||||
property string icon: ""
|
||||
property string text: ""
|
||||
property string suffix: ""
|
||||
property var tooltipText: ""
|
||||
property var tooltipText
|
||||
property bool autoHide: false
|
||||
property bool forceOpen: false
|
||||
property bool forceClose: false
|
||||
|
||||
+5
-5
@@ -10,7 +10,7 @@ Rectangle {
|
||||
// Public properties
|
||||
property string text: ""
|
||||
property string icon: ""
|
||||
property string tooltipText
|
||||
property var tooltipText
|
||||
property color backgroundColor: Color.mPrimary
|
||||
property color textColor: Color.mOnPrimary
|
||||
property color hoverColor: Color.mHover
|
||||
@@ -142,19 +142,19 @@ Rectangle {
|
||||
onEntered: {
|
||||
root.hovered = true;
|
||||
root.entered();
|
||||
if (tooltipText) {
|
||||
if (tooltipText && (!Array.isArray(tooltipText) || tooltipText.length > 0)) {
|
||||
TooltipService.show(root, root.tooltipText);
|
||||
}
|
||||
}
|
||||
onExited: {
|
||||
root.hovered = false;
|
||||
root.exited();
|
||||
if (tooltipText) {
|
||||
if (tooltipText && (!Array.isArray(tooltipText) || tooltipText.length > 0)) {
|
||||
TooltipService.hide();
|
||||
}
|
||||
}
|
||||
onPressed: mouse => {
|
||||
if (tooltipText) {
|
||||
if (tooltipText && (!Array.isArray(tooltipText) || tooltipText.length > 0)) {
|
||||
TooltipService.hide();
|
||||
}
|
||||
if (mouse.button === Qt.LeftButton) {
|
||||
@@ -168,7 +168,7 @@ Rectangle {
|
||||
|
||||
onCanceled: {
|
||||
root.hovered = false;
|
||||
if (tooltipText) {
|
||||
if (tooltipText && (!Array.isArray(tooltipText) || tooltipText.length > 0)) {
|
||||
TooltipService.hide();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ Item {
|
||||
property string suffix: "%"
|
||||
property real contentScale: 1.0
|
||||
property color fillColor: Color.mPrimary
|
||||
property string tooltipText: ""
|
||||
property var tooltipText
|
||||
property string tooltipDirection: "top"
|
||||
|
||||
// Arc geometry constants
|
||||
@@ -151,12 +151,12 @@ Item {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onEntered: {
|
||||
if (root.tooltipText) {
|
||||
if (root.tooltipText && (!Array.isArray(root.tooltipText) || root.tooltipText.length > 0)) {
|
||||
TooltipService.show(root, root.tooltipText, root.tooltipDirection);
|
||||
}
|
||||
}
|
||||
onExited: {
|
||||
if (root.tooltipText) {
|
||||
if (root.tooltipText && (!Array.isArray(root.tooltipText) || root.tooltipText.length > 0)) {
|
||||
TooltipService.hide();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ Slider {
|
||||
property var cutoutColor: Color.mSurface
|
||||
property bool snapAlways: true
|
||||
property real widthRatio: 0.7
|
||||
property string tooltipText
|
||||
property var tooltipText
|
||||
property string tooltipDirection: "auto"
|
||||
property bool hovering: false
|
||||
property color topColor: "white"
|
||||
@@ -212,14 +212,14 @@ Slider {
|
||||
|
||||
onEntered: {
|
||||
root.hovering = true;
|
||||
if (root.tooltipText) {
|
||||
if (root.tooltipText && (!Array.isArray(root.tooltipText) || root.tooltipText.length > 0)) {
|
||||
TooltipService.show(knob, root.tooltipText, root.tooltipDirection);
|
||||
}
|
||||
}
|
||||
|
||||
onExited: {
|
||||
root.hovering = false;
|
||||
if (root.tooltipText) {
|
||||
if (root.tooltipText && (!Array.isArray(root.tooltipText) || root.tooltipText.length > 0)) {
|
||||
TooltipService.hide();
|
||||
}
|
||||
}
|
||||
@@ -229,7 +229,7 @@ Slider {
|
||||
Connections {
|
||||
target: root
|
||||
function onPressedChanged() {
|
||||
if (root.pressed && root.tooltipText) {
|
||||
if (root.pressed && root.tooltipText && (!Array.isArray(root.tooltipText) || root.tooltipText.length > 0)) {
|
||||
TooltipService.hide();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ Item {
|
||||
property bool applyUiScale: true
|
||||
|
||||
property string icon
|
||||
property string tooltipText
|
||||
property var tooltipText
|
||||
property string tooltipDirection: "auto"
|
||||
property bool allowClickWhenDisabled: false
|
||||
property bool handleWheel: false
|
||||
@@ -96,20 +96,20 @@ Item {
|
||||
hoverEnabled: true
|
||||
onEntered: {
|
||||
hovering = root.enabled ? true : false;
|
||||
if (tooltipText) {
|
||||
if (tooltipText && (!Array.isArray(tooltipText) || tooltipText.length > 0)) {
|
||||
TooltipService.show(root, tooltipText, tooltipDirection);
|
||||
}
|
||||
root.entered();
|
||||
}
|
||||
onExited: {
|
||||
hovering = false;
|
||||
if (tooltipText) {
|
||||
if (tooltipText && (!Array.isArray(tooltipText) || tooltipText.length > 0)) {
|
||||
TooltipService.hide(root);
|
||||
}
|
||||
root.exited();
|
||||
}
|
||||
onClicked: mouse => {
|
||||
if (tooltipText) {
|
||||
if (tooltipText && (!Array.isArray(tooltipText) || tooltipText.length > 0)) {
|
||||
TooltipService.hide(root);
|
||||
}
|
||||
if (!root.enabled && !allowClickWhenDisabled) {
|
||||
|
||||
@@ -11,8 +11,8 @@ Rectangle {
|
||||
// Public properties
|
||||
property real baseSize: Style.baseWidgetSize
|
||||
property bool applyUiScale: true
|
||||
property string icon: ""
|
||||
property string tooltipText: ""
|
||||
property string icon
|
||||
property var tooltipText
|
||||
property string tooltipDirection: "auto"
|
||||
property bool allowClickWhenDisabled: false
|
||||
property bool hot: false
|
||||
@@ -106,7 +106,7 @@ Rectangle {
|
||||
|
||||
onEntered: {
|
||||
hovering = root.enabled ? true : false;
|
||||
if (tooltipText) {
|
||||
if (tooltipText && (!Array.isArray(tooltipText) || tooltipText.length > 0)) {
|
||||
TooltipService.show(parent, tooltipText, tooltipDirection);
|
||||
}
|
||||
root.entered();
|
||||
@@ -114,7 +114,7 @@ Rectangle {
|
||||
|
||||
onExited: {
|
||||
hovering = false;
|
||||
if (tooltipText) {
|
||||
if (tooltipText && (!Array.isArray(tooltipText) || tooltipText.length > 0)) {
|
||||
TooltipService.hide();
|
||||
}
|
||||
root.exited();
|
||||
@@ -124,7 +124,7 @@ Rectangle {
|
||||
if (root.enabled) {
|
||||
root.pressed = true;
|
||||
}
|
||||
if (tooltipText) {
|
||||
if (tooltipText && (!Array.isArray(tooltipText) || tooltipText.length > 0)) {
|
||||
TooltipService.hide();
|
||||
}
|
||||
}
|
||||
@@ -153,7 +153,7 @@ Rectangle {
|
||||
root.hovering = false;
|
||||
root.pressed = false;
|
||||
root.scale = 1.0;
|
||||
if (tooltipText) {
|
||||
if (tooltipText && (!Array.isArray(tooltipText) || tooltipText.length > 0)) {
|
||||
TooltipService.hide();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ Rectangle {
|
||||
id: root
|
||||
|
||||
property bool show: false
|
||||
property string tooltipText: ""
|
||||
property var tooltipText
|
||||
|
||||
implicitWidth: root.show ? 6 * Style.uiScaleRatio : 0
|
||||
implicitHeight: root.show ? 6 * Style.uiScaleRatio : 0
|
||||
@@ -26,20 +26,20 @@ Rectangle {
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
enabled: root.show && root.tooltipText !== ""
|
||||
enabled: root.show && root.tooltipText && (!Array.isArray(root.tooltipText) || root.tooltipText.length > 0)
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
acceptedButtons: Qt.NoButton
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
|
||||
onEntered: {
|
||||
if (root.tooltipText) {
|
||||
if (root.tooltipText && (!Array.isArray(root.tooltipText) || root.tooltipText.length > 0)) {
|
||||
TooltipService.show(root, root.tooltipText);
|
||||
}
|
||||
}
|
||||
|
||||
onExited: {
|
||||
if (root.tooltipText) {
|
||||
if (root.tooltipText && (!Array.isArray(root.tooltipText) || root.tooltipText.length > 0)) {
|
||||
TooltipService.hide();
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -11,7 +11,7 @@ Slider {
|
||||
property var cutoutColor: Color.mSurface
|
||||
property bool snapAlways: true
|
||||
property real heightRatio: 0.7
|
||||
property string tooltipText
|
||||
property var tooltipText
|
||||
property string tooltipDirection: "auto"
|
||||
property bool hovering: false
|
||||
|
||||
@@ -226,14 +226,14 @@ Slider {
|
||||
|
||||
onEntered: {
|
||||
root.hovering = true;
|
||||
if (root.tooltipText) {
|
||||
if (root.tooltipText && (!Array.isArray(root.tooltipText) || root.tooltipText.length > 0)) {
|
||||
TooltipService.show(knob, root.tooltipText, root.tooltipDirection);
|
||||
}
|
||||
}
|
||||
|
||||
onExited: {
|
||||
root.hovering = false;
|
||||
if (root.tooltipText) {
|
||||
if (root.tooltipText && (!Array.isArray(root.tooltipText) || root.tooltipText.length > 0)) {
|
||||
TooltipService.hide();
|
||||
}
|
||||
}
|
||||
@@ -243,7 +243,7 @@ Slider {
|
||||
Connections {
|
||||
target: root
|
||||
function onPressedChanged() {
|
||||
if (root.pressed && root.tooltipText) {
|
||||
if (root.pressed && root.tooltipText && (!Array.isArray(root.tooltipText) || root.tooltipText.length > 0)) {
|
||||
TooltipService.hide();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,11 +8,10 @@ import qs.Widgets
|
||||
Rectangle {
|
||||
id: root
|
||||
|
||||
// Public properties
|
||||
// Public properties
|
||||
property string text: ""
|
||||
property string icon: ""
|
||||
property string tooltipText: ""
|
||||
property var tooltipText
|
||||
property bool checked: false
|
||||
property int tabIndex: 0
|
||||
property real pointSize: Style.fontSizeM
|
||||
@@ -94,7 +93,7 @@ Rectangle {
|
||||
id: tooltipTimer
|
||||
interval: 500
|
||||
onTriggered: {
|
||||
if (root.isHovered && root.tooltipText !== "") {
|
||||
if (root.isHovered && root.tooltipText && (!Array.isArray(root.tooltipText) || root.tooltipText.length > 0)) {
|
||||
TooltipService.show(root, root.tooltipText);
|
||||
}
|
||||
}
|
||||
@@ -106,14 +105,14 @@ Rectangle {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onEntered: {
|
||||
root.isHovered = true;
|
||||
if (root.tooltipText !== "") {
|
||||
if (root.tooltipText && (!Array.isArray(root.tooltipText) || root.tooltipText.length > 0)) {
|
||||
tooltipTimer.start();
|
||||
}
|
||||
}
|
||||
onExited: {
|
||||
root.isHovered = false;
|
||||
tooltipTimer.stop();
|
||||
if (root.tooltipText !== "") {
|
||||
if (root.tooltipText && (!Array.isArray(root.tooltipText) || root.tooltipText.length > 0)) {
|
||||
TooltipService.hide();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user