Commit 524ff23f authored by Marco Martin's avatar Marco Martin
Browse files

add support for tooltips

use qwidget tooltips, not plasma ones
BUG:335131
parent 88275439
......@@ -30,6 +30,8 @@
*/
import QtQuick 2.1
import org.kde.plasma.core 2.0 as PlasmaCore
import QtQuick.Controls.Private 1.0
import QtQuick.Controls 1.0
import "private" as Private
......@@ -70,6 +72,9 @@ Item {
*/
property alias text: label.text
/*! This property holds the button tooltip. */
property string tooltip
/**
* type:string
*
......@@ -261,7 +266,17 @@ Item {
hoverEnabled: true
onPressed: internal.userPressed = true
onReleased: internal.userPressed = false
onCanceled: internal.userPressed = false
onCanceled: {
internal.userPressed = false
Tooltip.hideText()
}
onClicked: internal.clickButton()
onExited: Tooltip.hideText()
Timer {
interval: 1000
running: mouse.containsMouse && !pressed && tooltip.length
onTriggered: Tooltip.showText(mouse, Qt.point(mouse.mouseX, mouse.mouseY), tooltip)
}
}
}
......@@ -20,6 +20,8 @@
import QtQuick 2.1
import org.kde.plasma.core 2.0 as PlasmaCore
import QtQuick.Controls.Private 1.0
import QtQuick.Controls 1.0
import "private" as Private
/**
......@@ -56,6 +58,9 @@ Item {
*/
property alias text: label.text
/*! This property holds the button tooltip. */
property string tooltip
/**
* type:variant
*
......@@ -386,6 +391,7 @@ Item {
onCanceled: {
internal.userPressed = false
delegate.shadowState = "shadow"
Tooltip.hideText()
}
onClicked: internal.clickButton()
......@@ -406,6 +412,13 @@ Item {
}
}
button.z -= 2
Tooltip.hideText()
}
Timer {
interval: 1000
running: mouse.containsMouse && !pressed && tooltip.length
onTriggered: Tooltip.showText(mouse, Qt.point(mouse.mouseX, mouse.mouseY), tooltip)
}
}
}
......
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