aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-09-28 03:01:38 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-09-28 03:01:45 +0200
commit472750be915b7cab88c5daaca1246f58c6bd0f72 (patch)
tree546ffb0877c125504f8342ac624e46515d941dd3
parent78025d76ebc30470b788477ecec9509ebf28ac5f (diff)
parentea2af6b11889d004916188b1dfe1275c9b497ba7 (diff)
Merge "Merge remote-tracking branch 'origin/5.14' into 5.15"
-rw-r--r--src/quicktemplates2/qquickmenu.cpp2
-rw-r--r--src/quicktemplates2/qquickoverlay.cpp20
-rw-r--r--src/quicktemplates2/qquicktextarea.cpp38
-rw-r--r--src/quicktemplates2/qquicktooltip.cpp6
-rw-r--r--tests/auto/controls/data/tst_textarea.qml68
-rw-r--r--tests/auto/focus/BLACKLIST3
-rw-r--r--tests/auto/qquickmaterialstyle/data/tst_material.qml35
7 files changed, 115 insertions, 57 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)
diff --git a/tests/auto/controls/data/tst_textarea.qml b/tests/auto/controls/data/tst_textarea.qml
index ee40c9b7..1e455ffc 100644
--- a/tests/auto/controls/data/tst_textarea.qml
+++ b/tests/auto/controls/data/tst_textarea.qml
@@ -688,4 +688,72 @@ TestCase {
compare(control.background.width, 100)
compare(control.background.height, 100)
}
+
+ // QTBUG-76369
+ Component {
+ id: testResizeBackground
+ Item {
+ width: 200
+ height: 200
+ property alias textArea: textArea
+ ScrollView {
+ anchors.fill: parent
+ ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
+ TextArea {
+ id: textArea
+ // workaround test failing due to default insets on Imagine
+ topInset: undefined
+ leftInset: undefined
+ rightInset: undefined
+ bottomInset: undefined
+ wrapMode : TextEdit.WordWrap
+ readOnly: false
+ selectByMouse: true
+ focus: true
+ text: "test message"
+
+ background: Rectangle {
+ y: parent.height - height - textArea.bottomPadding / 2
+ implicitWidth: 120
+ height: textArea.activeFocus ? 2 : 1
+ }
+ }
+ }
+ }
+ }
+
+ function test_resize_background() {
+ var control = createTemporaryObject(testResizeBackground, testCase)
+
+ compare(control.textArea.background.width, control.width)
+ compare(control.textArea.background.height, 1)
+ control.width = 400
+ control.height = 400
+ compare(control.textArea.background.width, control.width)
+ compare(control.textArea.background.height, 1)
+ control.width = 200
+ control.height = 200
+ compare(control.textArea.background.width, control.width)
+ compare(control.textArea.background.height, 1)
+
+ // hasBackgroundWidth=true
+ control.textArea.background.width = 1
+ compare(control.textArea.background.width, 1)
+ compare(control.textArea.background.height, 1)
+ control.width = 400
+ control.height = 400
+ compare(control.textArea.background.width, 1)
+ compare(control.textArea.background.height, 1)
+ // hasBackgroundHeight=false
+ control.textArea.background.height = undefined
+ compare(control.textArea.background.width, 1)
+ compare(control.textArea.background.height, 0)
+ control.textArea.background.y = 0
+ compare(control.textArea.background.width, 1)
+ compare(control.textArea.background.height, control.height)
+ control.width = 200
+ control.height = 200
+ compare(control.textArea.background.width, 1)
+ compare(control.textArea.background.height, control.height)
+ }
}
diff --git a/tests/auto/focus/BLACKLIST b/tests/auto/focus/BLACKLIST
new file mode 100644
index 00000000..730d3844
--- /dev/null
+++ b/tests/auto/focus/BLACKLIST
@@ -0,0 +1,3 @@
+# QTBUG-78261
+[policy]
+opensuse-leap
diff --git a/tests/auto/qquickmaterialstyle/data/tst_material.qml b/tests/auto/qquickmaterialstyle/data/tst_material.qml
index 45bc0dab..9f2456b8 100644
--- a/tests/auto/qquickmaterialstyle/data/tst_material.qml
+++ b/tests/auto/qquickmaterialstyle/data/tst_material.qml
@@ -715,39 +715,4 @@ TestCase {
control.destroy()
}
-
- Component {
- id: testResizeBackground
- Item {
- width: 200
- height: 200
- property alias textArea: textArea
- ScrollView {
- anchors.fill: parent
- ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
- TextArea {
- id: textArea
- wrapMode : TextEdit.WordWrap
- readOnly: false
- selectByMouse: true
- focus: true
- text: "test message"
- }
- }
- }
- }
-
- function test_resize_background() {
- var control = testCase.createTemporaryObject(testResizeBackground, testCase)
- compare(control.textArea.background.height, 1)
- compare(control.textArea.background.width, control.width)
- control.width = 400
- control.height = 400
- compare(control.textArea.background.height, 1)
- compare(control.textArea.background.width, control.width)
- control.width = 200
- control.height = 200
- compare(control.textArea.background.height, 1)
- compare(control.textArea.background.width, control.width)
- }
}