Commit a03409ef authored by Arjen Hiemstra's avatar Arjen Hiemstra
Browse files

sketch: Make tooltip work nicely with touch on Win 8

Windows implements its own press and hold behaviour that
sends a right click event, so rather than waiting for
another press and hold, use the right click to show the
tooltip.
parent 61cbf857
......@@ -127,22 +127,18 @@ Item {
id: mouse;
anchors.fill: parent;
hoverEnabled: true;
acceptedButtons: Qt.LeftButton | Qt.RightButton;
onClicked: {
if (base.enabled) {
if(mouse.button == Qt.LeftButton && base.enabled) {
base.clicked();
if ( base.checkable ) {
base.checked = !base.checked;
}
}
}
onPressAndHold: {
if(base.tooltip !== "") {
} else if(mouse.button == Qt.RightButton && base.tooltip != "") {
tooltip.show(base.width / 2, 0);
}
}
onReleased: {
tooltip.hide();
}
onEntered: {
hoverDelayTimer.start();
}
......@@ -160,7 +156,7 @@ Item {
Timer {
id: hoverDelayTimer;
interval: 1000;
onTriggered: tooltip.show(base.width / 2, 0);
onTriggered: { if(base.tooltip != "") tooltip.show(base.width / 2, 0) };
}
Tooltip {
......
......@@ -53,12 +53,6 @@ Item {
}
function hide() {
hideTimer.start();
}
Timer {
id: hideTimer;
interval: 1000;
onTriggered: body.opacity = 0;
body.opacity = 0;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment