diff options
| author | Tannin <devnull@localhost> | 2015-01-06 19:31:53 +0100 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2015-01-06 19:31:53 +0100 |
| commit | 9edc39633b82b5e02d33c4b0a395fe110af28eb4 (patch) | |
| tree | 90d627525292cb87f3d4b7330b1847a17b568b61 /src/tutorials/TooltipArea.qml | |
| parent | b415db619ed027ec2acd283983624293274b090f (diff) | |
- bugfixes
- moved more functionality to game-plugins
- further decoupled management functionality from the UI
- created another "tutorial" which is only a single page with relevant parts of
the ui highlighted with info as tooltips
Diffstat (limited to 'src/tutorials/TooltipArea.qml')
| -rw-r--r-- | src/tutorials/TooltipArea.qml | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/tutorials/TooltipArea.qml b/src/tutorials/TooltipArea.qml new file mode 100644 index 00000000..48a50f76 --- /dev/null +++ b/src/tutorials/TooltipArea.qml @@ -0,0 +1,55 @@ +import QtQuick 1.1
+
+Rectangle {
+ radius: 2
+ color: clickable ? "#AA6666AA" : "#AA882222"
+ height: 100
+ border.color: "black"
+ border.width: 2
+ z: 1
+ smooth: true
+ property bool wasLocked: false
+ property bool clickable: false
+ property string tooltipText: ""
+
+ MouseArea {
+ id: clickArea
+ anchors.fill: parent
+ hoverEnabled: true
+
+ onMousePositionChanged: {
+ if (parent.parent.width - (parent.x + mouseX) < tooltip.width + 50) {
+ tooltip.x = parent.x + mouseX - 15 - tooltip.width
+ } else {
+ tooltip.x = parent.x + mouseX + 15
+ }
+
+ if (parent.parent.height - (parent.y + mouseY) < tooltip.height + 50) {
+ tooltip.y = parent.y + mouseY - 15 - tooltip.height
+ } else {
+ tooltip.y = parent.y + mouseY + 15
+ }
+ }
+
+ onEntered: {
+ tooltip.visible = true
+ tooltip.text = tooltipText
+ }
+
+ onPressed: {
+ wasLocked = tutToplevel.backgroundEnabled()
+ if (wasLocked && clickable) {
+ tutorialControl.simulateClick(mouseX + parent.x, mouseY + parent.y)
+ }
+ mouse.accepted = false
+ }
+
+ onCanceled: {
+ tooltip.visible = false
+ }
+
+ onExited: {
+ tooltip.visible = false
+ }
+ }
+}
|
