aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2/qquicktooltip.cpp
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-10-03 11:20:14 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-10-03 13:31:32 +0000
commitb13bafec9ca34aa12b4ba9fbc6bf0165957f9b37 (patch)
tree8a16936c25ee40baea19146da2ec9e04b6cdeda2 /src/quicktemplates2/qquicktooltip.cpp
parent8aaa72c1035940eb290de9ba16513b2dafe5248c (diff)
parentb6cfb4a1e30598a6176f9bbfdbd1495b37c7f59a (diff)
Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts: examples/quickcontrols2/gallery/gallery.qrc src/imports/calendar/doc/snippets/qtlabscalendar-calendarmodel.qml src/imports/calendar/doc/snippets/qtlabscalendar-dayofweekrow-layout.qml src/imports/calendar/doc/snippets/qtlabscalendar-dayofweekrow.qml src/imports/calendar/doc/snippets/qtlabscalendar-monthgrid-layout.qml src/imports/calendar/doc/snippets/qtlabscalendar-monthgrid.qml src/imports/calendar/doc/snippets/qtlabscalendar-weeknumbercolumn-layout.qml src/imports/calendar/doc/snippets/qtlabscalendar-weeknumbercolumn.qml src/imports/controls/doc/qtquickcontrols2.qdocconf src/imports/controls/doc/snippets/qtlabscalendar-calendarmodel.qml src/imports/controls/doc/snippets/qtlabscalendar-dayofweekrow-layout.qml src/imports/controls/doc/snippets/qtlabscalendar-dayofweekrow.qml src/imports/controls/doc/snippets/qtlabscalendar-monthgrid-layout.qml src/imports/controls/doc/snippets/qtlabscalendar-monthgrid.qml src/imports/controls/doc/snippets/qtlabscalendar-weeknumbercolumn-layout.qml src/imports/controls/doc/snippets/qtlabscalendar-weeknumbercolumn.qml src/imports/controls/doc/snippets/screenshots/qtlabscalendar-calendarmodel.qml src/imports/controls/doc/snippets/screenshots/qtlabscalendar-dayofweekrow-layout.qml src/imports/controls/doc/snippets/screenshots/qtlabscalendar-dayofweekrow.qml src/imports/controls/doc/snippets/screenshots/qtlabscalendar-monthgrid-layout.qml src/imports/controls/doc/snippets/screenshots/qtlabscalendar-monthgrid.qml src/imports/controls/doc/snippets/screenshots/qtlabscalendar-weeknumbercolumn-layout.qml src/imports/controls/doc/snippets/screenshots/qtlabscalendar-weeknumbercolumn.qml src/imports/controls/qtquickcontrols2plugin.cpp src/quicktemplates2/qquicktooltip.cpp src/quicktemplates2/qquicktooltip_p.h src/quicktemplates2/qquicktumbler.cpp tests/auto/controls/data/tst_spinbox.qml tests/auto/controls/data/tst_tumbler.qml tests/auto/qquickmaterialstyle/data/tst_material.qml Change-Id: I25b7473b47739043b6f768603bece30b18021318
Diffstat (limited to 'src/quicktemplates2/qquicktooltip.cpp')
-rw-r--r--src/quicktemplates2/qquicktooltip.cpp37
1 files changed, 18 insertions, 19 deletions
diff --git a/src/quicktemplates2/qquicktooltip.cpp b/src/quicktemplates2/qquicktooltip.cpp
index 27449194..c05f5a0b 100644
--- a/src/quicktemplates2/qquicktooltip.cpp
+++ b/src/quicktemplates2/qquicktooltip.cpp
@@ -244,25 +244,27 @@ void QQuickToolTip::setTimeout(int timeout)
emit timeoutChanged();
}
-QQuickToolTipAttached *QQuickToolTip::qmlAttachedProperties(QObject *object)
-{
- return new QQuickToolTipAttached(object);
-}
-
-void QQuickToolTip::open()
+void QQuickToolTip::setVisible(bool visible)
{
Q_D(QQuickToolTip);
- if (d->delay > 0)
- d->startDelay();
- else
- QQuickPopup::open();
+ if (visible) {
+ if (!d->visible && d->delay > 0) {
+ d->startDelay();
+ return;
+ }
+ } else {
+ d->stopDelay();
+ }
+ QQuickPopup::setVisible(visible);
}
-void QQuickToolTip::close()
+QQuickToolTipAttached *QQuickToolTip::qmlAttachedProperties(QObject *object)
{
- Q_D(QQuickToolTip);
- d->stopDelay();
- QQuickPopup::close();
+ QQuickItem *item = qobject_cast<QQuickItem *>(object);
+ if (!item)
+ qmlInfo(object) << "ToolTip must be attached to an Item";
+
+ return new QQuickToolTipAttached(object);
}
QFont QQuickToolTip::defaultFont() const
@@ -291,10 +293,10 @@ void QQuickToolTip::timerEvent(QTimerEvent *event)
Q_D(QQuickToolTip);
if (event->timerId() == d->timeoutTimer.timerId()) {
d->stopTimeout();
- close();
+ QQuickPopup::setVisible(false);
} else if (event->timerId() == d->delayTimer.timerId()) {
d->stopDelay();
- QQuickPopup::open();
+ QQuickPopup::setVisible(true);
}
}
@@ -349,9 +351,6 @@ QQuickToolTip *QQuickToolTipAttachedPrivate::instance(bool create) const
QQuickToolTipAttached::QQuickToolTipAttached(QObject *parent) :
QObject(*(new QQuickToolTipAttachedPrivate), parent)
{
- QQuickItem *item = qobject_cast<QQuickItem *>(parent);
- if (!item && parent)
- qmlInfo(parent) << "ToolTip must be attached to an Item";
}
/*!