aboutsummaryrefslogtreecommitdiff
path: root/components/Tooltip.qml
diff options
context:
space:
mode:
authorrating89us <45968869+rating89us@users.noreply.github.com>2021-05-19 18:36:44 +0200
committerrating89us <rating89us@rating89us.com>2021-05-29 04:02:19 +0200
commit9d3864b7f09efc65d2f0e64f6579d5a3974721a2 (patch)
treea4d0a39761280c3f6c744d61c433fb9ef3d08482 /components/Tooltip.qml
parent937cb9825672d07a1917d2d9daf823802ec31d1b (diff)
downloadmonzero-gui-9d3864b7f09efc65d2f0e64f6579d5a3974721a2.tar.gz
monzero-gui-9d3864b7f09efc65d2f0e64f6579d5a3974721a2.tar.xz
monzero-gui-9d3864b7f09efc65d2f0e64f6579d5a3974721a2.zip
Implement tooltips in multiple pages and components
Diffstat (limited to 'components/Tooltip.qml')
-rw-r--r--components/Tooltip.qml28
1 files changed, 23 insertions, 5 deletions
diff --git a/components/Tooltip.qml b/components/Tooltip.qml
index 31cd0b25..b33d90ef 100644
--- a/components/Tooltip.qml
+++ b/components/Tooltip.qml
@@ -35,14 +35,19 @@ import "." as MoneroComponents
Rectangle {
property alias text: tooltip.text
+ property alias tooltipPopup: popup
+ property bool tooltipIconVisible: false
+ property bool tooltipLeft: false
+ property bool tooltipBottom: tooltipIconVisible ? false : true
color: "transparent"
- height: icon.height
- width: icon.width
+ height: tooltipIconVisible ? icon.height : parent.height
+ width: tooltipIconVisible ? icon.width : parent.width
visible: text != ""
Text {
id: icon
+ visible: tooltipIconVisible
color: MoneroComponents.Style.orange
font.family: FontAwesome.fontFamily
font.pixelSize: 10
@@ -62,8 +67,9 @@ Rectangle {
}
}
- Popup {
+ ToolTip {
id: popup
+ height: tooltip.height + 20
background: Rectangle {
border.color: MoneroComponents.Style.buttonInlineBackgroundColor
@@ -73,8 +79,20 @@ Rectangle {
}
closePolicy: Popup.NoAutoClose
padding: 10
- x: icon.x + icon.width
- y: icon.y - height
+ x: tooltipLeft
+ ? (tooltipIconVisible ? icon.x - icon.width : parent.x - tooltip.width - 20 + parent.width/2)
+ : (tooltipIconVisible ? icon.x + icon.width : parent.x + parent.width/2)
+ y: tooltipBottom
+ ? (tooltipIconVisible ? icon.y + height : parent.y + parent.height + 2)
+ : (tooltipIconVisible ? icon.y - height : parent.y - tooltip.height - 20)
+ enter: Transition {
+ NumberAnimation { property: "opacity"; from: 0.0; to: 1.0; duration: 150 }
+ }
+
+ exit: Transition {
+ NumberAnimation { property: "opacity"; from: 1.0; to: 0.0; duration: 150 }
+ }
+ delay: 200
RowLayout {
Text {