diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-09-24 03:03:50 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-09-24 03:03:51 +0200 |
commit | 5182f7c5a3190231d1431258ea4cfcd26fbeb2b0 (patch) | |
tree | 940e9d6d4a59d3e79a50200d34bfd43fa41e93dc /src/quicktemplates2 | |
parent | 0cab878ae937451c8b53262cde7a05e7feaec0a6 (diff) | |
parent | 6815f353e5a73c0dcf39fbfc91c6a2c1b0784324 (diff) |
Merge remote-tracking branch 'origin/5.13' into 5.14
Change-Id: I34f3fa5e3cd2ebb0ed8f7d4e6d5ed6f66422a48d
Diffstat (limited to 'src/quicktemplates2')
-rw-r--r-- | src/quicktemplates2/qquickmenu.cpp | 2 | ||||
-rw-r--r-- | src/quicktemplates2/qquickoverlay.cpp | 20 | ||||
-rw-r--r-- | src/quicktemplates2/qquicktextarea.cpp | 38 | ||||
-rw-r--r-- | src/quicktemplates2/qquicktooltip.cpp | 6 |
4 files changed, 44 insertions, 22 deletions
diff --git a/src/quicktemplates2/qquickmenu.cpp b/src/quicktemplates2/qquickmenu.cpp index 498c6d00..91372777 100644 --- a/src/quicktemplates2/qquickmenu.cpp +++ b/src/quicktemplates2/qquickmenu.cpp @@ -1487,7 +1487,9 @@ void QQuickMenu::timerEvent(QTimerEvent *event) if (QQuickMenu *subMenu = d->currentSubMenu()) subMenu->open(); d->stopHoverTimer(); + return; } + QQuickPopup::timerEvent(event); } QFont QQuickMenu::defaultFont() const diff --git a/src/quicktemplates2/qquickoverlay.cpp b/src/quicktemplates2/qquickoverlay.cpp index cf72c8a6..3f358706 100644 --- a/src/quicktemplates2/qquickoverlay.cpp +++ b/src/quicktemplates2/qquickoverlay.cpp @@ -126,11 +126,6 @@ bool QQuickOverlayPrivate::startDrag(QEvent *event, const QPointF &pos) return false; } -static bool isTouchEvent(QEvent *event) -{ - return event->type() == QEvent::TouchBegin || event->type() == QEvent::TouchUpdate || event->type() == QEvent::TouchEnd; -} - bool QQuickOverlayPrivate::handlePress(QQuickItem *source, QEvent *event, QQuickPopup *target) { if (target) { @@ -139,7 +134,18 @@ bool QQuickOverlayPrivate::handlePress(QQuickItem *source, QEvent *event, QQuick return true; } return false; - } else if (!mouseGrabberPopup || isTouchEvent(event)) { + } + + switch (event->type()) { + default: { + if (mouseGrabberPopup) + break; +#if QT_CONFIG(quicktemplates2_multitouch) + Q_FALLTHROUGH(); + case QEvent::TouchBegin: + case QEvent::TouchUpdate: + case QEvent::TouchEnd: +#endif // allow non-modal popups to close themselves, // and non-dimming modal popups to block the event const auto popups = stackingOrderPopups(); @@ -149,6 +155,8 @@ bool QQuickOverlayPrivate::handlePress(QQuickItem *source, QEvent *event, QQuick return true; } } + break; + } } event->ignore(); diff --git a/src/quicktemplates2/qquicktextarea.cpp b/src/quicktemplates2/qquicktextarea.cpp index 95bf5bb1..f7b8969c 100644 --- a/src/quicktemplates2/qquicktextarea.cpp +++ b/src/quicktemplates2/qquicktextarea.cpp @@ -369,6 +369,8 @@ void QQuickTextAreaPrivate::detachFlickable() QObjectPrivate::disconnect(flickable, &QQuickFlickable::contentHeightChanged, this, &QQuickTextAreaPrivate::resizeFlickableControl); flickable = nullptr; + + resizeBackground(); } void QQuickTextAreaPrivate::ensureCursorVisible() @@ -433,11 +435,21 @@ void QQuickTextAreaPrivate::resizeFlickableContent() void QQuickTextAreaPrivate::itemGeometryChanged(QQuickItem *item, QQuickGeometryChange change, const QRectF &diff) { - Q_UNUSED(item); - Q_UNUSED(change); Q_UNUSED(diff); + if (!resizingBackground && item == background) { + QQuickItemPrivate *p = QQuickItemPrivate::get(item); + // Only set hasBackgroundWidth/Height if it was a width/height change, + // otherwise we're prevented from setting a width/height in the future. + if (change.widthChange()) + extra.value().hasBackgroundWidth = p->widthValid; + if (change.heightChange()) + extra.value().hasBackgroundHeight = p->heightValid; + } - resizeFlickableControl(); + if (flickable) + resizeFlickableControl(); + else + resizeBackground(); } qreal QQuickTextAreaPrivate::getImplicitWidth() const @@ -512,11 +524,8 @@ void QQuickTextAreaPrivate::executeBackground(bool complete) if (!background || complete) quickBeginDeferred(q, backgroundName(), background); - if (complete) { + if (complete) quickCompleteDeferred(q, backgroundName(), background); - if (background) - QQuickControlPrivate::addImplicitSizeListener(background, this, QQuickControlPrivate::ImplicitSizeChanges | QQuickItemPrivate::Geometry); - } } void QQuickTextAreaPrivate::itemImplicitWidthChanged(QQuickItem *item) @@ -625,21 +634,20 @@ void QQuickTextArea::setBackground(QQuickItem *background) d->background = background; if (background) { + QQuickItemPrivate *p = QQuickItemPrivate::get(background); + if (p->widthValid || p->heightValid) { + d->extra.value().hasBackgroundWidth = p->widthValid; + d->extra.value().hasBackgroundHeight = p->heightValid; + } if (d->flickable) background->setParentItem(d->flickable); else background->setParentItem(this); if (qFuzzyIsNull(background->z())) background->setZ(-1); - QQuickItemPrivate *p = QQuickItemPrivate::get(background); - if (p->widthValid || p->heightValid) { - d->extra.value().hasBackgroundWidth = p->widthValid; - d->extra.value().hasBackgroundHeight = p->heightValid; - } - if (isComponentComplete()) { + if (isComponentComplete()) d->resizeBackground(); - QQuickControlPrivate::addImplicitSizeListener(background, d, QQuickControlPrivate::ImplicitSizeChanges | QQuickItemPrivate::Geometry); - } + QQuickControlPrivate::addImplicitSizeListener(background, d, QQuickControlPrivate::ImplicitSizeChanges | QQuickItemPrivate::Geometry); } if (!qFuzzyCompare(oldImplicitBackgroundWidth, implicitBackgroundWidth())) diff --git a/src/quicktemplates2/qquicktooltip.cpp b/src/quicktemplates2/qquicktooltip.cpp index ddf434a2..c1271dab 100644 --- a/src/quicktemplates2/qquicktooltip.cpp +++ b/src/quicktemplates2/qquicktooltip.cpp @@ -327,10 +327,14 @@ void QQuickToolTip::timerEvent(QTimerEvent *event) if (event->timerId() == d->timeoutTimer.timerId()) { d->stopTimeout(); QQuickPopup::setVisible(false); - } else if (event->timerId() == d->delayTimer.timerId()) { + return; + } + if (event->timerId() == d->delayTimer.timerId()) { d->stopDelay(); QQuickPopup::setVisible(true); + return; } + QQuickPopup::timerEvent(event); } #if QT_CONFIG(accessibility) |