From 41c754db53f7139f351346f1659a28fa13d2eb08 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 31 Oct 2016 12:41:04 +0100 Subject: Doc: add links to ToolTip attached properties and methods Change-Id: Ia9edcf69ca4a36f9e50e03787fe82b79aca9d2a3 Task-number: QTBUG-55904 Reviewed-by: Mitch Curtis --- src/quicktemplates2/qquicktooltip.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/quicktemplates2/qquicktooltip.cpp') diff --git a/src/quicktemplates2/qquicktooltip.cpp b/src/quicktemplates2/qquicktooltip.cpp index a1601ad6..b29e806c 100644 --- a/src/quicktemplates2/qquicktooltip.cpp +++ b/src/quicktemplates2/qquicktooltip.cpp @@ -62,6 +62,8 @@ QT_BEGIN_NAMESPACE \image qtquickcontrols2-tooltip.png + \section2 Attached Tool Tips + The most straight-forward way to setup tool tips for controls is to specify \l text and \l {visible}{visibility} via attached properties. The following example illustrates this approach: @@ -358,6 +360,8 @@ QQuickToolTipAttached::QQuickToolTipAttached(QObject *parent) : This attached property holds the text of the shared tool tip. The property can be attached to any item. + + \sa {Attached Tool Tips} */ QString QQuickToolTipAttached::text() const { @@ -384,7 +388,7 @@ void QQuickToolTipAttached::setText(const QString &text) This attached property holds the delay (milliseconds) of the shared tool tip. The property can be attached to any item. - \sa {Delay and Timeout} + \sa {Attached Tool Tips}, {Delay and Timeout} */ int QQuickToolTipAttached::delay() const { @@ -411,7 +415,7 @@ void QQuickToolTipAttached::setDelay(int delay) This attached property holds the timeout (milliseconds) of the shared tool tip. The property can be attached to any item. - \sa {Delay and Timeout} + \sa {Attached Tool Tips}, {Delay and Timeout} */ int QQuickToolTipAttached::timeout() const { @@ -437,6 +441,8 @@ void QQuickToolTipAttached::setTimeout(int timeout) This attached property holds whether the shared tool tip is visible. The property can be attached to any item. + + \sa {Attached Tool Tips} */ bool QQuickToolTipAttached::isVisible() const { @@ -462,6 +468,8 @@ void QQuickToolTipAttached::setVisible(bool visible) This attached property holds the shared tool tip instance. The property can be attached to any item. + + \sa {Attached Tool Tips} */ QQuickToolTip *QQuickToolTipAttached::toolTip() const { @@ -474,6 +482,8 @@ QQuickToolTip *QQuickToolTipAttached::toolTip() const This attached method shows the shared tooltip with \a text and \a timeout (milliseconds). The method can be attached to any item. + + \sa {Attached Tool Tips} */ void QQuickToolTipAttached::show(const QString &text, int ms) { @@ -495,6 +505,8 @@ void QQuickToolTipAttached::show(const QString &text, int ms) \qmlattachedmethod void QtQuick.Controls::ToolTip::hide() This attached method hides the shared tooltip. The method can be attached to any item. + + \sa {Attached Tool Tips} */ void QQuickToolTipAttached::hide() { -- cgit v1.2.3 From 31c51eb402c67c9a01b9f0cf108195db699e2a9c Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Tue, 1 Nov 2016 21:46:19 +0100 Subject: ToolTip: fix accessibility support Change-Id: I4623b1f1ee1e10c4233e89bf42e6720bbf3a5c73 Reviewed-by: Liang Qi Reviewed-by: Mitch Curtis --- src/quicktemplates2/qquicktooltip.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/quicktemplates2/qquicktooltip.cpp') diff --git a/src/quicktemplates2/qquicktooltip.cpp b/src/quicktemplates2/qquicktooltip.cpp index b29e806c..3bd47457 100644 --- a/src/quicktemplates2/qquicktooltip.cpp +++ b/src/quicktemplates2/qquicktooltip.cpp @@ -188,6 +188,7 @@ void QQuickToolTip::setText(const QString &text) return; d->text = text; + setAccessibleName(text); emit textChanged(); } @@ -307,6 +308,15 @@ QAccessible::Role QQuickToolTip::accessibleRole() const { return QAccessible::ToolTip; } + +void QQuickToolTip::accessibilityActiveChanged(bool active) +{ + Q_D(QQuickToolTip); + QQuickPopup::accessibilityActiveChanged(active); + + if (active) + setAccessibleName(d->text); +} #endif class QQuickToolTipAttachedPrivate : public QObjectPrivate -- cgit v1.2.3