-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAreaCaptionTemplate.qml
More file actions
93 lines (84 loc) · 3.04 KB
/
AreaCaptionTemplate.qml
File metadata and controls
93 lines (84 loc) · 3.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import QtQuick
import QtQuick.Layouts
import qmlcomponents
Item {
id: areaCaptionItem
property var controller: null
property string caption: controller != null ? controller.caption: ""
property int imminentRaids: controller != null ? controller.numberOfImminentRaids : 0
property string captionTextColor: controller != null ? controller.captionColor : "white"
TibiaText {
id: invisibleText
visible: false
text: "<a href=\"\\1\" style=\"color:" + captionTextColor + "; text-decoration:none;\">" + caption + "</a>"
textFormat: Text.RichText
style: Text.Outline
wrapMode: Text.WordWrap
elide: Text.ElideNone
horizontalAlignment : Text.AlignHCenter
width: 70
}
RowLayout {
anchors.centerIn: parent
TibiaText {
Layout.preferredWidth: Math.min(invisibleText.implicitWidth, invisibleText.contentWidth)
text: invisibleText.text
textFormat: invisibleText.textFormat
style: invisibleText.style
wrapMode: invisibleText.wrapMode
elide: invisibleText.elide
horizontalAlignment : invisibleText.horizontalAlignment
// onLinkHovered: {
// if (hoveredLink != "" && controller != null) {
// controller.onHovered();
// }
// }
// onLinkActivated: {
// if (controller != null) {
// controller.onClicked();
// }
// }
MouseArea {
anchors.fill: parent
hoverEnabled: true
propagateComposedEvents: true
onEntered: {
// console.log('AreaCaption onEntered');
}
onExited: {
// console.log('AreaCaption onExited');
}
onClicked: (mouse) => {
// console.log('AreaCaption onClicked');
mouse.accepted = false;
controller.onClicked();
} // onClicked
}
Tooltip {
anchors.fill: parent
visible: imminentRaids > 0
text: controller != null ? (controller.numberOfImminentRaids == 1 ? qsTrId("imminent_raids_tooltip_singular").arg(caption).arg(imminentRaids) : qsTrId("imminent_raids_tooltip_plural").arg(caption).arg(imminentRaids)) : ""
} // Tooltip
}
Image {
id: imminentRaidImage
Layout.alignment: Qt.AlignVCenter
source: controller != null ? controller.numberOfImminentRaids > 0 ? "/images/icon-imminentraid.png" : "" : ""
Tooltip {
anchors.fill: parent
visible: imminentRaids > 0
text: controller != null ? (controller.numberOfImminentRaids == 1 ? qsTrId("imminent_raids_tooltip_singular").arg(caption).arg(imminentRaids) : qsTrId("imminent_raids_tooltip_plural").arg(caption).arg(imminentRaids)) : ""
} // Tooltip
}
Image {
id: activeAreaImage
Layout.alignment: Qt.AlignVCenter
source: controller != null ? controller.isImprovedRespawnActive ? "/images/icon-map-improvedrespawn.png" : "" : ""
Tooltip {
anchors.fill: parent
visible: controller != null ? controller.isImprovedRespawnActive : false
text: qsTrId("improved_respawn_tooltip")
} // Tooltip
} // Image
}
} // Item