aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquicktooltip.cpp
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-11-02 13:05:58 +0100
committerJ-P Nurmi <jpnurmi@qt.io>2016-11-02 13:05:58 +0100
commit5169a1ecd03eaea95ab07aeefc8d76cca7530563 (patch)
tree2666aecdf5a9c90d9b68dd7df8c6b5d1507541a6 /src/quicktemplates2/qquicktooltip.cpp
parent7decf1ee51df6c772b84ba8bed2f1e3d0e344908 (diff)
parent814601e9cdf5895152cedcd1968fd2a4eecd3cd3 (diff)
Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts: src/imports/controls/Drawer.qml src/imports/controls/Frame.qml src/imports/controls/GroupBox.qml src/imports/controls/Page.qml src/imports/controls/Pane.qml src/imports/controls/ToolBar.qml src/imports/controls/Tumbler.qml src/quicktemplates2/qquickapplicationwindow.cpp src/quicktemplates2/qquickpopup.cpp tests/auto/accessibility/data/busyindicator.qml tests/auto/accessibility/data/button.qml tests/auto/accessibility/data/checkbox.qml tests/auto/accessibility/data/control.qml tests/auto/accessibility/data/dial.qml tests/auto/accessibility/data/label.qml tests/auto/accessibility/data/menu.qml tests/auto/accessibility/data/pageindicator.qml tests/auto/accessibility/data/popup.qml tests/auto/accessibility/data/progressbar.qml tests/auto/accessibility/data/radiobutton.qml tests/auto/accessibility/data/rangeslider.qml tests/auto/accessibility/data/scrollbar.qml tests/auto/accessibility/data/scrollindicator.qml tests/auto/accessibility/data/slider.qml tests/auto/accessibility/data/spinbox.qml tests/auto/accessibility/data/switch.qml tests/auto/accessibility/data/tabbar.qml tests/auto/accessibility/data/tabbutton.qml tests/auto/accessibility/data/textarea.qml tests/auto/accessibility/data/textfield.qml tests/auto/accessibility/data/toolbar.qml tests/auto/accessibility/data/toolbutton.qml tests/auto/accessibility/tst_accessibility.cpp Change-Id: Ibc3f592162e97bef9147b35da8c9a79e73a907e6
Diffstat (limited to 'src/quicktemplates2/qquicktooltip.cpp')
-rw-r--r--src/quicktemplates2/qquicktooltip.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/quicktemplates2/qquicktooltip.cpp b/src/quicktemplates2/qquicktooltip.cpp
index c05f5a0b..b60dec22 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:
@@ -186,6 +188,7 @@ void QQuickToolTip::setText(const QString &text)
return;
d->text = text;
+ setAccessibleName(text);
emit textChanged();
}
@@ -305,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
@@ -358,6 +370,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 +398,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 +425,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 +451,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 +478,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 +492,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 +515,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()
{