You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
wow-app/components/Label.qml

54 lines
1.4 KiB

10 years ago
import QtQuick 2.0
Item {
id: item
10 years ago
property alias text: label.text
property alias color: label.color
property alias textFormat: label.textFormat
property string tipText: ""
10 years ago
property int fontSize: 12
signal linkActivated()
10 years ago
width: icon.x + icon.width
height: icon.height
Text {
id: label
anchors.bottom: parent.bottom
anchors.bottomMargin: 2
anchors.left: parent.left
font.family: "Arial"
font.pixelSize: parent.fontSize
color: "#555555"
onLinkActivated: item.linkActivated()
10 years ago
}
Image {
id: icon
anchors.verticalCenter: parent.verticalCenter
anchors.left: label.right
anchors.leftMargin: 5
source: "../images/whatIsIcon.png"
visible: appWindow.whatIsEnable
}
MouseArea {
anchors.fill: icon
enabled: appWindow.whatIsEnable
hoverEnabled: true
onEntered: {
icon.visible = false
var pos = appWindow.mapFromItem(icon, 0, -15)
tipItem.text = item.tipText
tipItem.x = pos.x
if(tipItem.height > 30)
pos.y -= tipItem.height - 28
tipItem.y = pos.y
tipItem.visible = true
}
onExited: {
10 years ago
icon.visible = Qt.binding(function(){ return appWindow.whatIsEnable; })
tipItem.visible = false
}
}
10 years ago
}