aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-07-11 12:06:15 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2017-07-11 12:57:13 +0200
commitd2d0e08e584c780b4b70a37e7b39c6bbcc7bc63e (patch)
tree22582b82dd5bb370205aa66302fb238bf5edaa6e /src
parentc3431db7a3eb6b0c6e325e2d1e16eb6def9a4b4d (diff)
parent744164e6c92cb721d2a339cee8c465e1685723f9 (diff)
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts: .qmake.conf tests/auto/controls/data/tst_scrollindicator.qml Change-Id: I1f5581ae7814c0d4152e4c9b79a30a8af5a3a17b
Diffstat (limited to 'src')
-rw-r--r--src/imports/controls/designer/LabelSpecifics.qml24
-rw-r--r--src/quickcontrols2/qquicktumblerview.cpp113
-rw-r--r--src/quickcontrols2/qquicktumblerview_p.h2
-rw-r--r--src/quicktemplates2/qquickbusyindicator.cpp7
-rw-r--r--src/quicktemplates2/qquickbusyindicator_p.h4
-rw-r--r--src/quicktemplates2/qquickcontrol.cpp14
-rw-r--r--src/quicktemplates2/qquickdrawer.cpp25
-rw-r--r--src/quicktemplates2/qquickdrawer_p_p.h2
-rw-r--r--src/quicktemplates2/qquickoverlay.cpp7
-rw-r--r--src/quicktemplates2/qquickpageindicator.cpp84
-rw-r--r--src/quicktemplates2/qquickpageindicator_p.h7
-rw-r--r--src/quicktemplates2/qquickpopup.cpp24
-rw-r--r--src/quicktemplates2/qquickscrollindicator.cpp7
-rw-r--r--src/quicktemplates2/qquickscrollindicator_p.h4
-rw-r--r--src/quicktemplates2/qquicktumbler.cpp13
-rw-r--r--src/quicktemplates2/qquicktumbler_p_p.h1
16 files changed, 218 insertions, 120 deletions
diff --git a/src/imports/controls/designer/LabelSpecifics.qml b/src/imports/controls/designer/LabelSpecifics.qml
index 20f5013b..48cf8d05 100644
--- a/src/imports/controls/designer/LabelSpecifics.qml
+++ b/src/imports/controls/designer/LabelSpecifics.qml
@@ -48,6 +48,30 @@ Column {
showVerticalAlignment: true
}
+ Section {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ caption: qsTr("Text Color")
+
+ ColorEditor {
+ caption: qsTr("Text Color")
+ backendValue: backendValues.color
+ supportGradient: false
+ }
+ }
+
+ Section {
+ anchors.left: parent.left
+ anchors.right: parent.right
+ caption: qsTr("Style Color")
+
+ ColorEditor {
+ caption: qsTr("Style Color")
+ backendValue: backendValues.styleColor
+ supportGradient: false
+ }
+ }
+
FontSection {
width: parent.width
}
diff --git a/src/quickcontrols2/qquicktumblerview.cpp b/src/quickcontrols2/qquicktumblerview.cpp
index 817ec370..5e6d9f5a 100644
--- a/src/quickcontrols2/qquicktumblerview.cpp
+++ b/src/quickcontrols2/qquicktumblerview.cpp
@@ -36,7 +36,6 @@
#include "qquicktumblerview_p.h"
-#include <QtQml/private/qqmldelegatemodel_p.h>
#include <QtQuick/private/qquickitem_p.h>
#include <QtQuick/private/qquicklistview_p.h>
#include <QtQuick/private/qquickpathview_p.h>
@@ -126,7 +125,17 @@ void QQuickTumblerView::createView()
// the count yet, because we rely on the view to tell us the count.
if (m_tumbler->wrap()) {
if (m_listView) {
- delete m_listView;
+ // It's necessary to call deleteLater() rather than delete,
+ // as this code is most likely being run in rensponse to a signal
+ // emission somewhere in the list view's internals, so we need to
+ // wait until that has finished.
+ m_listView->deleteLater();
+ QQml_setParent_noEvent(m_listView, nullptr);
+ // The auto tests pass with unparenting the list view alone, but
+ // just to be sure, we unset some other things as well.
+ m_listView->setParentItem(nullptr);
+ m_listView->setVisible(false);
+ m_listView->setModel(QVariant());
m_listView = nullptr;
}
@@ -143,12 +152,16 @@ void QQuickTumblerView::createView()
// Give the view a size.
updateView();
- // Ensure that the model is set eventually.
- polish();
+ // Set the model.
+ updateModel();
}
} else {
if (m_pathView) {
- delete m_pathView;
+ m_pathView->deleteLater();
+ QQml_setParent_noEvent(m_pathView, nullptr);
+ m_pathView->setParentItem(nullptr);
+ m_pathView->setVisible(false);
+ m_pathView->setModel(QVariant());
m_pathView = nullptr;
}
@@ -164,8 +177,8 @@ void QQuickTumblerView::createView()
// Give the view a size.
updateView();
- // Ensure that the model is set eventually.
- polish();
+ // Set the model.
+ updateModel();
}
}
}
@@ -193,6 +206,56 @@ void QQuickTumblerView::updateView()
}
}
+void QQuickTumblerView::updateModel()
+{
+ if (m_pathView && !m_pathView->model().isValid() && m_model.isValid()) {
+ // QQuickPathView::setPathItemCount() resets the offset animation,
+ // so we just skip the animation while constructing the view.
+ const int oldHighlightMoveDuration = m_pathView->highlightMoveDuration();
+ m_pathView->setHighlightMoveDuration(0);
+
+ // Setting model can change the count, which can affect the wrap, which can cause
+ // the current view to be deleted before setModel() is finished, which causes a crash.
+ // Since QQuickTumbler can't know about QQuickTumblerView, we use its private API to
+ // inform it that it should delay setting wrap.
+ QQuickTumblerPrivate *tumblerPrivate = QQuickTumblerPrivate::get(m_tumbler);
+ tumblerPrivate->lockWrap();
+ m_pathView->setModel(m_model);
+ tumblerPrivate->unlockWrap();
+
+ // The count-depends-on-wrap behavior could cause wrap to change after
+ // the call above, so we must check that we're still using a PathView.
+ if (m_pathView)
+ m_pathView->setHighlightMoveDuration(oldHighlightMoveDuration);
+ } else if (m_listView && !m_listView->model().isValid() && m_model.isValid()) {
+ const int currentIndex = m_tumbler->currentIndex();
+ QQuickTumblerPrivate *tumblerPrivate = QQuickTumblerPrivate::get(m_tumbler);
+
+ // setModel() causes QQuickTumblerPrivate::_q_onViewCountChanged() to
+ // be called called, which calls QQuickTumbler::setCurrentIndex(),
+ // which results in QQuickItemViewPrivate::createHighlightItem() being
+ // called. When the highlight item is created,
+ // QQuickTumblerPrivate::itemChildAdded() is notified and
+ // QQuickTumblerPrivate::_q_updateItemHeights() is called, which causes
+ // a geometry change in the item and createHighlight() is called again.
+ // However, since the highlight item hadn't been assigned yet in the
+ // previous call frame, the "if (highlight) { delete highlight; }"
+ // check doesn't succeed, so the item is never deleted.
+ //
+ // To avoid this, we tell QQuickTumblerPrivate to ignore signals while
+ // setting the model, and manually call _q_onViewCountChanged() to
+ // ensure the correct sequence of calls happens (_q_onViewCountChanged()
+ // has to be within the ignoreSignals scope, because it also generates
+ // recursion otherwise).
+ tumblerPrivate->ignoreSignals = true;
+ m_listView->setModel(m_model);
+ m_listView->setCurrentIndex(currentIndex);
+
+ tumblerPrivate->_q_onViewCountChanged();
+ tumblerPrivate->ignoreSignals = false;
+ }
+}
+
void QQuickTumblerView::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
{
QQuickItem::geometryChanged(newGeometry, oldGeometry);
@@ -223,42 +286,6 @@ void QQuickTumblerView::itemChange(QQuickItem::ItemChange change, const QQuickIt
}
}
-void QQuickTumblerView::updatePolish()
-{
- // There are certain cases where model count changes can potentially cause problems.
- // An example of this is a ListModel that appends items in a for loop in Component.onCompleted.
- // If we didn't delay assignment of the model, the PathView/ListView would be deleted in
- // response to it emitting countChanged(), causing a crash. To avoid this issue,
- // and to avoid the overhead of count affecting the wrap property, which in turn may
- // unnecessarily create delegates that are never seen, we delay setting the model. This ensures that
- // Component.onCompleted would have been finished, for example.
- if (m_pathView && !m_pathView->model().isValid() && m_model.isValid()) {
- // QQuickPathView::setPathItemCount() resets the offset animation,
- // so we just skip the animation while constructing the view.
- const int oldHighlightMoveDuration = m_pathView->highlightMoveDuration();
- m_pathView->setHighlightMoveDuration(0);
-
- // Setting model can change the count, which can affect the wrap, which can cause
- // the current view to be deleted before setModel() is finished, which causes a crash.
- // Since QQuickTumbler can't know about QQuickTumblerView, we use its private API to
- // inform it that it should delay setting wrap.
- QQuickTumblerPrivate *tumblerPrivate = QQuickTumblerPrivate::get(m_tumbler);
- tumblerPrivate->lockWrap();
- m_pathView->setModel(m_model);
- tumblerPrivate->unlockWrap();
-
- // The count-depends-on-wrap behavior could cause wrap to change after
- // the call above, so we must check that we're still using a PathView.
- if (m_pathView)
- m_pathView->setHighlightMoveDuration(oldHighlightMoveDuration);
- } else if (m_listView && !m_listView->model().isValid() && m_model.isValid()) {
- // Usually we'd do this in QQuickTumbler::setWrap(), but that will be too early for polishes.
- const int currentIndex = m_tumbler->currentIndex();
- m_listView->setModel(m_model);
- m_listView->setCurrentIndex(currentIndex);
- }
-}
-
QQuickItem *QQuickTumblerView::view()
{
if (!m_tumbler)
diff --git a/src/quickcontrols2/qquicktumblerview_p.h b/src/quickcontrols2/qquicktumblerview_p.h
index e83a8bd2..0ab0c3a9 100644
--- a/src/quickcontrols2/qquicktumblerview_p.h
+++ b/src/quickcontrols2/qquicktumblerview_p.h
@@ -87,12 +87,12 @@ protected:
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
void componentComplete() override;
void itemChange(ItemChange change, const ItemChangeData &data) override;
- void updatePolish() override;
private:
QQuickItem *view();
void createView();
void updateView();
+ void updateModel();
void wrapChange();
diff --git a/src/quicktemplates2/qquickbusyindicator.cpp b/src/quicktemplates2/qquickbusyindicator.cpp
index 883066d7..e4f20d83 100644
--- a/src/quicktemplates2/qquickbusyindicator.cpp
+++ b/src/quicktemplates2/qquickbusyindicator.cpp
@@ -115,6 +115,13 @@ void QQuickBusyIndicator::setRunning(bool running)
emit runningChanged();
}
+#if QT_CONFIG(quicktemplates2_multitouch)
+void QQuickBusyIndicator::touchEvent(QTouchEvent *event)
+{
+ event->ignore(); // QTBUG-61785
+}
+#endif
+
#if QT_CONFIG(accessibility)
QAccessible::Role QQuickBusyIndicator::accessibleRole() const
{
diff --git a/src/quicktemplates2/qquickbusyindicator_p.h b/src/quicktemplates2/qquickbusyindicator_p.h
index 3607cc1f..f140764b 100644
--- a/src/quicktemplates2/qquickbusyindicator_p.h
+++ b/src/quicktemplates2/qquickbusyindicator_p.h
@@ -69,6 +69,10 @@ Q_SIGNALS:
void runningChanged();
protected:
+#if QT_CONFIG(quicktemplates2_multitouch)
+ void touchEvent(QTouchEvent *event) override;
+#endif
+
#if QT_CONFIG(accessibility)
QAccessible::Role accessibleRole() const override;
#endif
diff --git a/src/quicktemplates2/qquickcontrol.cpp b/src/quicktemplates2/qquickcontrol.cpp
index dca50244..4b85e444 100644
--- a/src/quicktemplates2/qquickcontrol.cpp
+++ b/src/quicktemplates2/qquickcontrol.cpp
@@ -1482,13 +1482,8 @@ void QQuickControl::touchEvent(QTouchEvent *event)
Q_D(QQuickControl);
switch (event->type()) {
case QEvent::TouchBegin:
- for (const QTouchEvent::TouchPoint &point : event->touchPoints()) {
- if (d->acceptTouch(point))
- d->handlePress(point.pos());
- }
- break;
-
case QEvent::TouchUpdate:
+ case QEvent::TouchEnd:
for (const QTouchEvent::TouchPoint &point : event->touchPoints()) {
if (!d->acceptTouch(point))
continue;
@@ -1509,13 +1504,6 @@ void QQuickControl::touchEvent(QTouchEvent *event)
}
break;
- case QEvent::TouchEnd:
- for (const QTouchEvent::TouchPoint &point : event->touchPoints()) {
- if (d->acceptTouch(point))
- d->handleRelease(point.pos());
- }
- break;
-
case QEvent::TouchCancel:
d->handleUngrab();
break;
diff --git a/src/quicktemplates2/qquickdrawer.cpp b/src/quicktemplates2/qquickdrawer.cpp
index 8e77b966..007ce4e6 100644
--- a/src/quicktemplates2/qquickdrawer.cpp
+++ b/src/quicktemplates2/qquickdrawer.cpp
@@ -40,6 +40,7 @@
#include <QtGui/qstylehints.h>
#include <QtGui/private/qguiapplication_p.h>
+#include <QtQml/qqmlinfo.h>
#include <QtQuick/private/qquickwindow_p.h>
#include <QtQuick/private/qquickanimation_p.h>
#include <QtQuick/private/qquicktransition_p.h>
@@ -540,20 +541,32 @@ bool QQuickDrawerPrivate::prepareExitTransition()
return QQuickPopupPrivate::prepareExitTransition();
}
-void QQuickDrawerPrivate::setEdge(Qt::Edge e)
+bool QQuickDrawerPrivate::setEdge(Qt::Edge e)
{
- edge = e;
- if (edge == Qt::LeftEdge || edge == Qt::RightEdge) {
+ Q_Q(QQuickDrawer);
+ switch (e) {
+ case Qt::LeftEdge:
+ case Qt::RightEdge:
allowVerticalMove = true;
allowVerticalResize = true;
allowHorizontalMove = false;
allowHorizontalResize = false;
- } else {
+ break;
+ case Qt::TopEdge:
+ case Qt::BottomEdge:
allowVerticalMove = false;
allowVerticalResize = false;
allowHorizontalMove = true;
allowHorizontalResize = true;
+ break;
+ default:
+ qmlWarning(q) << "invalid edge value - valid values are: "
+ << "Qt.TopEdge, Qt.LeftEdge, Qt.RightEdge, Qt.BottomEdge";
+ return false;
}
+
+ edge = e;
+ return true;
}
QQuickDrawer::QQuickDrawer(QObject *parent)
@@ -588,7 +601,9 @@ void QQuickDrawer::setEdge(Qt::Edge edge)
if (d->edge == edge)
return;
- d->setEdge(edge);
+ if (!d->setEdge(edge))
+ return;
+
if (isComponentComplete())
d->reposition();
emit edgeChanged();
diff --git a/src/quicktemplates2/qquickdrawer_p_p.h b/src/quicktemplates2/qquickdrawer_p_p.h
index 72a83343..010f1d49 100644
--- a/src/quicktemplates2/qquickdrawer_p_p.h
+++ b/src/quicktemplates2/qquickdrawer_p_p.h
@@ -88,7 +88,7 @@ public:
bool prepareEnterTransition() override;
bool prepareExitTransition() override;
- void setEdge(Qt::Edge edge);
+ bool setEdge(Qt::Edge edge);
Qt::Edge edge;
qreal offset;
diff --git a/src/quicktemplates2/qquickoverlay.cpp b/src/quicktemplates2/qquickoverlay.cpp
index 12158f06..ed3d3d45 100644
--- a/src/quicktemplates2/qquickoverlay.cpp
+++ b/src/quicktemplates2/qquickoverlay.cpp
@@ -150,6 +150,11 @@ 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) {
@@ -158,7 +163,7 @@ bool QQuickOverlayPrivate::handlePress(QQuickItem *source, QEvent *event, QQuick
return true;
}
return false;
- } else if (!mouseGrabberPopup) {
+ } else if (!mouseGrabberPopup || isTouchEvent(event)) {
// allow non-modal popups to close themselves,
// and non-dimming modal popups to block the event
const auto popups = stackingOrderPopups();
diff --git a/src/quicktemplates2/qquickpageindicator.cpp b/src/quicktemplates2/qquickpageindicator.cpp
index b4c9c14c..df720c91 100644
--- a/src/quicktemplates2/qquickpageindicator.cpp
+++ b/src/quicktemplates2/qquickpageindicator.cpp
@@ -98,11 +98,16 @@ public:
{
}
- QQuickItem *itemAt(const QPoint &pos) const;
- void updatePressed(bool pressed, const QPoint &pos = QPoint());
+ void handlePress(const QPointF &point) override;
+ void handleMove(const QPointF &point) override;
+ void handleRelease(const QPointF &point) override;
+ void handleUngrab() override;
+
+ QQuickItem *itemAt(const QPointF &pos) const;
+ void updatePressed(bool pressed, const QPointF &pos = QPointF());
void setContextProperty(QQuickItem *item, const QString &name, const QVariant &value);
- void itemChildAdded(QQuickItem *, QQuickItem *child);
+ void itemChildAdded(QQuickItem *, QQuickItem *child) override;
int count;
int currentIndex;
@@ -111,7 +116,39 @@ public:
QQuickItem *pressedItem;
};
-QQuickItem *QQuickPageIndicatorPrivate::itemAt(const QPoint &pos) const
+void QQuickPageIndicatorPrivate::handlePress(const QPointF &point)
+{
+ QQuickControlPrivate::handlePress(point);
+ if (interactive)
+ updatePressed(true, point);
+}
+
+void QQuickPageIndicatorPrivate::handleMove(const QPointF &point)
+{
+ QQuickControlPrivate::handleMove(point);
+ if (interactive)
+ updatePressed(true, point);
+}
+
+void QQuickPageIndicatorPrivate::handleRelease(const QPointF &point)
+{
+ Q_Q(QQuickPageIndicator);
+ QQuickControlPrivate::handleRelease(point);
+ if (interactive) {
+ if (pressedItem && contentItem)
+ q->setCurrentIndex(contentItem->childItems().indexOf(pressedItem));
+ updatePressed(false);
+ }
+}
+
+void QQuickPageIndicatorPrivate::handleUngrab()
+{
+ QQuickControlPrivate::handleUngrab();
+ if (interactive)
+ updatePressed(false);
+}
+
+QQuickItem *QQuickPageIndicatorPrivate::itemAt(const QPointF &pos) const
{
Q_Q(const QQuickPageIndicator);
if (!contentItem || !q->contains(pos))
@@ -144,7 +181,7 @@ QQuickItem *QQuickPageIndicatorPrivate::itemAt(const QPoint &pos) const
return nearest;
}
-void QQuickPageIndicatorPrivate::updatePressed(bool pressed, const QPoint &pos)
+void QQuickPageIndicatorPrivate::updatePressed(bool pressed, const QPointF &pos)
{
QQuickItem *prevItem = pressedItem;
pressedItem = pressed ? itemAt(pos) : nullptr;
@@ -298,41 +335,16 @@ void QQuickPageIndicator::contentItemChange(QQuickItem *newItem, QQuickItem *old
QQuickItemPrivate::get(newItem)->addItemChangeListener(d, QQuickItemPrivate::Children);
}
-void QQuickPageIndicator::mousePressEvent(QMouseEvent *event)
-{
- Q_D(QQuickPageIndicator);
- if (d->interactive) {
- d->updatePressed(true, event->pos());
- event->accept();
- }
-}
-
-void QQuickPageIndicator::mouseMoveEvent(QMouseEvent *event)
-{
- Q_D(QQuickPageIndicator);
- if (d->interactive) {
- d->updatePressed(true, event->pos());
- event->accept();
- }
-}
-
-void QQuickPageIndicator::mouseReleaseEvent(QMouseEvent *event)
-{
- Q_D(QQuickPageIndicator);
- if (d->interactive) {
- if (d->pressedItem)
- setCurrentIndex(d->contentItem->childItems().indexOf(d->pressedItem));
- d->updatePressed(false);
- event->accept();
- }
-}
-
-void QQuickPageIndicator::mouseUngrabEvent()
+#if QT_CONFIG(quicktemplates2_multitouch)
+void QQuickPageIndicator::touchEvent(QTouchEvent *event)
{
Q_D(QQuickPageIndicator);
if (d->interactive)
- d->updatePressed(false);
+ QQuickControl::touchEvent(event);
+ else
+ event->ignore(); // QTBUG-61785
}
+#endif
#if QT_CONFIG(accessibility)
QAccessible::Role QQuickPageIndicator::accessibleRole() const
diff --git a/src/quicktemplates2/qquickpageindicator_p.h b/src/quicktemplates2/qquickpageindicator_p.h
index 921fe7e8..01352016 100644
--- a/src/quicktemplates2/qquickpageindicator_p.h
+++ b/src/quicktemplates2/qquickpageindicator_p.h
@@ -87,10 +87,9 @@ Q_SIGNALS:
protected:
void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) override;
- void mousePressEvent(QMouseEvent *event) override;
- void mouseMoveEvent(QMouseEvent *event) override;
- void mouseReleaseEvent(QMouseEvent *event) override;
- void mouseUngrabEvent() override;
+#if QT_CONFIG(quicktemplates2_multitouch)
+ void touchEvent(QTouchEvent *event) override;
+#endif
#if QT_CONFIG(accessibility)
QAccessible::Role accessibleRole() const override;
diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp
index 6927699c..81e50642 100644
--- a/src/quicktemplates2/qquickpopup.cpp
+++ b/src/quicktemplates2/qquickpopup.cpp
@@ -384,15 +384,10 @@ bool QQuickPopupPrivate::handleTouchEvent(QQuickItem *item, QTouchEvent *event)
{
switch (event->type()) {
case QEvent::TouchBegin:
- for (const QTouchEvent::TouchPoint &point : event->touchPoints()) {
- if (acceptTouch(point))
- return handlePress(item, item->mapToScene(point.pos()), event->timestamp());
- }
- break;
-
case QEvent::TouchUpdate:
+ case QEvent::TouchEnd:
for (const QTouchEvent::TouchPoint &point : event->touchPoints()) {
- if (!acceptTouch(point))
+ if (!acceptTouch(point) && !blockInput(item, point.pos()))
continue;
switch (point.state()) {
@@ -408,13 +403,6 @@ bool QQuickPopupPrivate::handleTouchEvent(QQuickItem *item, QTouchEvent *event)
}
break;
- case QEvent::TouchEnd:
- for (const QTouchEvent::TouchPoint &point : event->touchPoints()) {
- if (acceptTouch(point))
- return handleRelease(item, item->mapToScene(point.pos()), event->timestamp());
- }
- break;
-
case QEvent::TouchCancel:
handleUngrab();
break;
@@ -493,7 +481,13 @@ void QQuickPopupPrivate::finalizeExitTransition()
destroyOverlay();
if (hadActiveFocusBeforeExitTransition && window) {
- if (!qobject_cast<QQuickPopupItem *>(window->activeFocusItem())) {
+ // restore focus to the next popup in chain, or to the window content if there are no other popups open
+ QQuickPopup *popup = nullptr;
+ if (QQuickOverlay *overlay = QQuickOverlay::overlay(window))
+ popup = QQuickOverlayPrivate::get(overlay)->stackingOrderPopups().value(0);
+ if (popup && popup->hasFocus()) {
+ popup->forceActiveFocus();
+ } else {
QQuickApplicationWindow *applicationWindow = qobject_cast<QQuickApplicationWindow*>(window);
if (applicationWindow)
applicationWindow->contentItem()->setFocus(true);
diff --git a/src/quicktemplates2/qquickscrollindicator.cpp b/src/quicktemplates2/qquickscrollindicator.cpp
index d14138af..ee1078e4 100644
--- a/src/quicktemplates2/qquickscrollindicator.cpp
+++ b/src/quicktemplates2/qquickscrollindicator.cpp
@@ -567,6 +567,13 @@ void QQuickScrollIndicatorAttached::setVertical(QQuickScrollIndicator *vertical)
emit verticalChanged();
}
+#if QT_CONFIG(quicktemplates2_multitouch)
+void QQuickScrollIndicator::touchEvent(QTouchEvent *event)
+{
+ event->ignore(); // QTBUG-61785
+}
+#endif
+
#if QT_CONFIG(accessibility)
QAccessible::Role QQuickScrollIndicator::accessibleRole() const
{
diff --git a/src/quicktemplates2/qquickscrollindicator_p.h b/src/quicktemplates2/qquickscrollindicator_p.h
index 6f08ef31..c1065a3f 100644
--- a/src/quicktemplates2/qquickscrollindicator_p.h
+++ b/src/quicktemplates2/qquickscrollindicator_p.h
@@ -94,6 +94,10 @@ Q_SIGNALS:
void orientationChanged();
protected:
+#if QT_CONFIG(quicktemplates2_multitouch)
+ void touchEvent(QTouchEvent *event) override;
+#endif
+
#if QT_CONFIG(accessibility)
QAccessible::Role accessibleRole() const override;
#endif
diff --git a/src/quicktemplates2/qquicktumbler.cpp b/src/quicktemplates2/qquicktumbler.cpp
index 5cdd140d..80ab71ea 100644
--- a/src/quicktemplates2/qquicktumbler.cpp
+++ b/src/quicktemplates2/qquicktumbler.cpp
@@ -97,7 +97,8 @@ QQuickTumblerPrivate::QQuickTumblerPrivate()
currentIndex(-1),
pendingCurrentIndex(-1),
ignoreCurrentIndexChanges(false),
- count(0)
+ count(0),
+ ignoreSignals(false)
{
}
@@ -163,6 +164,9 @@ QQuickTumblerPrivate *QQuickTumblerPrivate::get(QQuickTumbler *tumbler)
void QQuickTumblerPrivate::_q_updateItemHeights()
{
+ if (ignoreSignals)
+ return;
+
// Can't use our own private padding members here, as the padding property might be set,
// which doesn't affect them, only their getters.
Q_Q(const QQuickTumbler);
@@ -174,6 +178,9 @@ void QQuickTumblerPrivate::_q_updateItemHeights()
void QQuickTumblerPrivate::_q_updateItemWidths()
{
+ if (ignoreSignals)
+ return;
+
Q_Q(const QQuickTumbler);
const qreal availableWidth = q->availableWidth();
const auto items = viewContentItemChildItems();
@@ -195,6 +202,8 @@ void QQuickTumblerPrivate::_q_onViewCurrentIndexChanged()
void QQuickTumblerPrivate::_q_onViewCountChanged()
{
Q_Q(QQuickTumbler);
+ if (ignoreSignals)
+ return;
setCount(view->property("count").toInt());
@@ -336,7 +345,9 @@ void QQuickTumbler::setCurrentIndex(int currentIndex)
couldSet = true;
} else {
d->ignoreCurrentIndexChanges = true;
+ d->ignoreSignals = true;
d->view->setProperty("currentIndex", currentIndex);
+ d->ignoreSignals = false;
d->ignoreCurrentIndexChanges = false;
couldSet = d->view->property("currentIndex").toInt() == currentIndex;
diff --git a/src/quicktemplates2/qquicktumbler_p_p.h b/src/quicktemplates2/qquicktumbler_p_p.h
index 301b8402..0dcae762 100644
--- a/src/quicktemplates2/qquicktumbler_p_p.h
+++ b/src/quicktemplates2/qquicktumbler_p_p.h
@@ -88,6 +88,7 @@ public:
int pendingCurrentIndex;
bool ignoreCurrentIndexChanges;
int count;
+ bool ignoreSignals;
void _q_updateItemHeights();
void _q_updateItemWidths();