[Interest] Qml Tooltips
Jérôme Godbout
jerome at bodycad.com
Thu Oct 8 16:17:31 CEST 2015
Thanks you very much, it work very well.
let's hope this Private API make it public some day with possible style
customization. I can now remove the ugly z ordering of many component now,
make the scripts way more clean.
regards,
Jerome
On Thu, Oct 8, 2015 at 7:31 AM, Nicolas Kniebihler <
nicolas.kniebihler at dualo.org> wrote:
> Hi Jerome,
>
> I don't know if that answers your question, but I personally use the way
> QML shows tooltips above Buttons:
>
> MyTooltip.qml:
>
> import QtQuick 2.3
>
> import QtQuick.Controls 1.2
>
> import QtQuick.Controls.Private 1.0
>
> MouseArea {
>
> id: behavior
>
> property string tooltip
>
> hoverEnabled: true
>
> propagateComposedEvents: true
>
> onExited: Tooltip.hideText()
>
> onCanceled: Tooltip.hideText()
>
> Timer {
>
> interval: 1000
>
> running: behavior.containsMouse && !behavior.pressed && tooltip.length
>
> onTriggered: Tooltip.showText(behavior, Qt.point(behavior.mouseX, behavior.mouseY), tooltip)
>
> }
>
> }
>
>
> Example:
>
> Label {
>
> text: "My label"
>
> MyTooltip {
>
> anchors.fill: parent
>
> tooltip: qsTr("My tooltip")
>
> }
>
> }
>
>
> This way I can show a tooltip above any component (not just Buttons).
>
> Nicolas
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20151008/cc0473c7/attachment.html>
More information about the Interest
mailing list