aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/imports/calendar/qquickweeknumbermodel.cpp2
-rw-r--r--src/imports/controls/imagine/qquickimaginestyle.cpp2
-rw-r--r--src/imports/controls/material/shaders/+qsb/RectangularGlow.fragbin2321 -> 2007 bytes
-rw-r--r--src/imports/controls/material/shaders/compile.bat40
-rw-r--r--src/quickcontrols2/qquickstyle.cpp9
-rw-r--r--src/quicktemplates2/qquickabstractbutton.cpp4
-rw-r--r--src/quicktemplates2/qquickcombobox.cpp12
-rw-r--r--src/quicktemplates2/qquickcontrol.cpp8
-rw-r--r--src/quicktemplates2/qquickcontrol_p.h2
-rw-r--r--src/quicktemplates2/qquickdialog.cpp3
-rw-r--r--src/quicktemplates2/qquickgroupbox.cpp4
-rw-r--r--src/quicktemplates2/qquicklabel.cpp17
-rw-r--r--src/quicktemplates2/qquicklabel_p_p.h1
-rw-r--r--src/quicktemplates2/qquickpage.cpp4
-rw-r--r--src/quicktemplates2/qquickpopup.cpp4
-rw-r--r--src/quicktemplates2/qquickpopup_p.h2
-rw-r--r--src/quicktemplates2/qquickpopupitem.cpp25
-rw-r--r--src/quicktemplates2/qquicksplitview.cpp19
-rw-r--r--src/quicktemplates2/qquicksplitview_p.h1
-rw-r--r--src/quicktemplates2/qquickstackview.cpp20
-rw-r--r--src/quicktemplates2/qquickstackview_p.cpp22
-rw-r--r--src/quicktemplates2/qquickstackview_p_p.h1
-rw-r--r--src/quicktemplates2/qquicktooltip.cpp4
23 files changed, 174 insertions, 32 deletions
diff --git a/src/imports/calendar/qquickweeknumbermodel.cpp b/src/imports/calendar/qquickweeknumbermodel.cpp
index c45d8938..8144fb12 100644
--- a/src/imports/calendar/qquickweeknumbermodel.cpp
+++ b/src/imports/calendar/qquickweeknumbermodel.cpp
@@ -46,7 +46,7 @@ class QQuickWeekNumberModelPrivate : public QAbstractItemModelPrivate
Q_DECLARE_PUBLIC(QQuickWeekNumberModel)
public:
- QQuickWeekNumberModelPrivate() : month(-1), year(-1)
+ QQuickWeekNumberModelPrivate() : month(-1), year(-1), weekNumbers{}
{
QDate date = QDate::currentDate();
init(date.month(), date.year(), locale);
diff --git a/src/imports/controls/imagine/qquickimaginestyle.cpp b/src/imports/controls/imagine/qquickimaginestyle.cpp
index 9e1431de..745bef10 100644
--- a/src/imports/controls/imagine/qquickimaginestyle.cpp
+++ b/src/imports/controls/imagine/qquickimaginestyle.cpp
@@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE
Q_GLOBAL_STATIC_WITH_ARGS(QString, GlobalPath, (QLatin1String("qrc:/qt-project.org/imports/QtQuick/Controls.2/Imagine/images/")))
-static const QString ensureSlash(const QString &path)
+static QString ensureSlash(const QString &path)
{
const QChar slash = QLatin1Char('/');
return path.endsWith(slash) ? path : path + slash;
diff --git a/src/imports/controls/material/shaders/+qsb/RectangularGlow.frag b/src/imports/controls/material/shaders/+qsb/RectangularGlow.frag
index a805b134..5cfa2db6 100644
--- a/src/imports/controls/material/shaders/+qsb/RectangularGlow.frag
+++ b/src/imports/controls/material/shaders/+qsb/RectangularGlow.frag
Binary files differ
diff --git a/src/imports/controls/material/shaders/compile.bat b/src/imports/controls/material/shaders/compile.bat
new file mode 100644
index 00000000..e87efa7a
--- /dev/null
+++ b/src/imports/controls/material/shaders/compile.bat
@@ -0,0 +1,40 @@
+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+::
+:: Copyright (C) 2019 The Qt Company Ltd.
+:: Contact: https://www.qt.io/licensing/
+::
+:: This file is part of the QtQuick module of the Qt Toolkit.
+::
+:: $QT_BEGIN_LICENSE:LGPL$
+:: Commercial License Usage
+:: Licensees holding valid commercial Qt licenses may use this file in
+:: accordance with the commercial license agreement provided with the
+:: Software or, alternatively, in accordance with the terms contained in
+:: a written agreement between you and The Qt Company. For licensing terms
+:: and conditions see https://www.qt.io/terms-conditions. For further
+:: information use the contact form at https://www.qt.io/contact-us.
+::
+:: GNU Lesser General Public License Usage
+:: Alternatively, this file may be used under the terms of the GNU Lesser
+:: General Public License version 3 as published by the Free Software
+:: Foundation and appearing in the file LICENSE.LGPL3 included in the
+:: packaging of this file. Please review the following information to
+:: ensure the GNU Lesser General Public License version 3 requirements
+:: will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+::
+:: GNU General Public License Usage
+:: Alternatively, this file may be used under the terms of the GNU
+:: General Public License version 2.0 or (at your option) the GNU General
+:: Public license version 3 or any later version approved by the KDE Free
+:: Qt Foundation. The licenses are as published by the Free Software
+:: Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+:: included in the packaging of this file. Please review the following
+:: information to ensure the GNU General Public License requirements will
+:: be met: https://www.gnu.org/licenses/gpl-2.0.html and
+:: https://www.gnu.org/licenses/gpl-3.0.html.
+::
+:: $QT_END_LICENSE$
+::
+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+qsb --glsl "150,120,100 es" --hlsl 50 --msl 12 -o +qsb/RectangularGlow.frag RectangularGlow_rhi.frag
diff --git a/src/quickcontrols2/qquickstyle.cpp b/src/quickcontrols2/qquickstyle.cpp
index 408a0de3..7a3359ef 100644
--- a/src/quickcontrols2/qquickstyle.cpp
+++ b/src/quickcontrols2/qquickstyle.cpp
@@ -119,10 +119,15 @@ static QStringList defaultImportPathList()
{
QStringList importPaths;
importPaths.reserve(3);
-#ifndef QT_STATIC
+#ifdef Q_OS_ANDROID
+ // androiddeployqt puts the QML files inside a resource file and they are not
+ // showing up in the Qml2ImportsPath as a result
+ importPaths += QStringLiteral(":/android_rcc_bundle/qml");
+#else
+# ifndef QT_STATIC
importPaths += QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath);
+# endif
#endif
- importPaths += envPathList("QML2_IMPORT_PATH");
importPaths += QStringLiteral(":/qt-project.org/imports");
importPaths += QCoreApplication::applicationDirPath();
return importPaths;
diff --git a/src/quicktemplates2/qquickabstractbutton.cpp b/src/quicktemplates2/qquickabstractbutton.cpp
index 9376f51b..8ce4d0e5 100644
--- a/src/quicktemplates2/qquickabstractbutton.cpp
+++ b/src/quicktemplates2/qquickabstractbutton.cpp
@@ -1128,7 +1128,7 @@ void QQuickAbstractButton::buttonChange(ButtonChange change)
break;
case ButtonTextChange: {
const QString txt = text();
- setAccessibleName(txt);
+ maybeSetAccessibleName(txt);
#if QT_CONFIG(shortcut)
setShortcut(QKeySequence::mnemonic(txt));
#endif
@@ -1154,7 +1154,7 @@ void QQuickAbstractButton::accessibilityActiveChanged(bool active)
Q_D(QQuickAbstractButton);
if (active) {
- setAccessibleName(text());
+ maybeSetAccessibleName(text());
setAccessibleProperty("pressed", d->pressed);
setAccessibleProperty("checked", d->checked);
setAccessibleProperty("checkable", d->checkable);
diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp
index 79ee6663..5f3f1cfc 100644
--- a/src/quicktemplates2/qquickcombobox.cpp
+++ b/src/quicktemplates2/qquickcombobox.cpp
@@ -448,7 +448,7 @@ void QQuickComboBoxPrivate::updateCurrentText()
if (currentText != text) {
currentText = text;
if (!hasDisplayText)
- q->setAccessibleName(text);
+ q->maybeSetAccessibleName(text);
emit q->currentTextChanged();
}
if (!hasDisplayText && displayText != text) {
@@ -1012,7 +1012,7 @@ void QQuickComboBox::setDisplayText(const QString &text)
return;
d->displayText = text;
- setAccessibleName(text);
+ maybeSetAccessibleName(text);
emit displayTextChanged();
}
@@ -1705,6 +1705,12 @@ bool QQuickComboBox::eventFilter(QObject *object, QEvent *event)
// the user clicked on the popup button to open it, not close it).
d->hidePopup(false);
setPressed(false);
+
+ // The focus left the text field, so if the edit text matches an item in the model,
+ // change our currentIndex to that. This matches widgets' behavior.
+ const int indexForEditText = find(d->extra.value().editText, Qt::MatchFixedString);
+ if (indexForEditText > -1)
+ setCurrentIndex(indexForEditText);
}
break;
#if QT_CONFIG(im)
@@ -1945,7 +1951,7 @@ void QQuickComboBox::accessibilityActiveChanged(bool active)
QQuickControl::accessibilityActiveChanged(active);
if (active) {
- setAccessibleName(d->hasDisplayText ? d->displayText : d->currentText);
+ maybeSetAccessibleName(d->hasDisplayText ? d->displayText : d->currentText);
setAccessibleProperty("editable", isEditable());
}
}
diff --git a/src/quicktemplates2/qquickcontrol.cpp b/src/quicktemplates2/qquickcontrol.cpp
index f82e43e7..6b845ae6 100644
--- a/src/quicktemplates2/qquickcontrol.cpp
+++ b/src/quicktemplates2/qquickcontrol.cpp
@@ -2300,11 +2300,13 @@ QString QQuickControl::accessibleName() const
return QString();
}
-void QQuickControl::setAccessibleName(const QString &name)
+void QQuickControl::maybeSetAccessibleName(const QString &name)
{
#if QT_CONFIG(accessibility)
- if (QQuickAccessibleAttached *accessibleAttached = QQuickControlPrivate::accessibleAttached(this))
- accessibleAttached->setName(name);
+ if (QQuickAccessibleAttached *accessibleAttached = QQuickControlPrivate::accessibleAttached(this)) {
+ if (!accessibleAttached->wasNameExplicitlySet())
+ accessibleAttached->setNameImplicitly(name);
+ }
#else
Q_UNUSED(name)
#endif
diff --git a/src/quicktemplates2/qquickcontrol_p.h b/src/quicktemplates2/qquickcontrol_p.h
index 3fe20f3b..d35630a7 100644
--- a/src/quicktemplates2/qquickcontrol_p.h
+++ b/src/quicktemplates2/qquickcontrol_p.h
@@ -287,7 +287,7 @@ protected:
// helper functions which avoid to check QT_CONFIG(accessibility)
QString accessibleName() const;
- void setAccessibleName(const QString &name);
+ void maybeSetAccessibleName(const QString &name);
QVariant accessibleProperty(const char *propertyName);
bool setAccessibleProperty(const char *propertyName, const QVariant &value);
diff --git a/src/quicktemplates2/qquickdialog.cpp b/src/quicktemplates2/qquickdialog.cpp
index 43f6b6a5..a13b42ee 100644
--- a/src/quicktemplates2/qquickdialog.cpp
+++ b/src/quicktemplates2/qquickdialog.cpp
@@ -219,7 +219,6 @@ void QQuickDialog::setTitle(const QString &title)
{
Q_D(QQuickDialog);
d->popupItem->setTitle(title);
- setAccessibleName(title);
}
/*!
@@ -536,7 +535,7 @@ void QQuickDialog::accessibilityActiveChanged(bool active)
QQuickPopup::accessibilityActiveChanged(active);
if (active)
- setAccessibleName(d->popupItem->title());
+ maybeSetAccessibleName(d->popupItem->title());
}
#endif
diff --git a/src/quicktemplates2/qquickgroupbox.cpp b/src/quicktemplates2/qquickgroupbox.cpp
index 9624306c..70ec30dc 100644
--- a/src/quicktemplates2/qquickgroupbox.cpp
+++ b/src/quicktemplates2/qquickgroupbox.cpp
@@ -167,7 +167,7 @@ void QQuickGroupBox::setTitle(const QString &title)
return;
d->title = title;
- setAccessibleName(title);
+ maybeSetAccessibleName(title);
emit titleChanged();
}
@@ -283,7 +283,7 @@ void QQuickGroupBox::accessibilityActiveChanged(bool active)
QQuickFrame::accessibilityActiveChanged(active);
if (active)
- setAccessibleName(d->title);
+ maybeSetAccessibleName(d->title);
}
#endif
diff --git a/src/quicktemplates2/qquicklabel.cpp b/src/quicktemplates2/qquicklabel.cpp
index 9179d30a..71b60a2b 100644
--- a/src/quicktemplates2/qquicklabel.cpp
+++ b/src/quicktemplates2/qquicklabel.cpp
@@ -248,9 +248,7 @@ void QQuickLabelPrivate::updatePalette(const QPalette &palette)
void QQuickLabelPrivate::textChanged(const QString &text)
{
#if QT_CONFIG(accessibility)
- Q_Q(QQuickLabel);
- if (QQuickAccessibleAttached *accessibleAttached = QQuickControlPrivate::accessibleAttached(q))
- accessibleAttached->setName(text);
+ maybeSetAccessibleName(text);
#else
Q_UNUSED(text)
#endif
@@ -266,13 +264,24 @@ void QQuickLabelPrivate::accessibilityActiveChanged(bool active)
QQuickAccessibleAttached *accessibleAttached = qobject_cast<QQuickAccessibleAttached *>(qmlAttachedPropertiesObject<QQuickAccessibleAttached>(q, true));
Q_ASSERT(accessibleAttached);
accessibleAttached->setRole(accessibleRole());
- accessibleAttached->setName(text);
+ maybeSetAccessibleName(text);
}
QAccessible::Role QQuickLabelPrivate::accessibleRole() const
{
return QAccessible::StaticText;
}
+
+void QQuickLabelPrivate::maybeSetAccessibleName(const QString &name)
+{
+ Q_Q(QQuickLabel);
+ auto accessibleAttached = qobject_cast<QQuickAccessibleAttached *>(
+ qmlAttachedPropertiesObject<QQuickAccessibleAttached>(q, true));
+ if (accessibleAttached) {
+ if (!accessibleAttached->wasNameExplicitlySet())
+ accessibleAttached->setNameImplicitly(name);
+ }
+}
#endif
static inline QString backgroundName() { return QStringLiteral("background"); }
diff --git a/src/quicktemplates2/qquicklabel_p_p.h b/src/quicktemplates2/qquicklabel_p_p.h
index e1010698..ce70c168 100644
--- a/src/quicktemplates2/qquicklabel_p_p.h
+++ b/src/quicktemplates2/qquicklabel_p_p.h
@@ -111,6 +111,7 @@ public:
#if QT_CONFIG(accessibility)
void accessibilityActiveChanged(bool active) override;
QAccessible::Role accessibleRole() const override;
+ void maybeSetAccessibleName(const QString &name);
#endif
void cancelBackground();
diff --git a/src/quicktemplates2/qquickpage.cpp b/src/quicktemplates2/qquickpage.cpp
index 0d2a7e3e..0a72bad7 100644
--- a/src/quicktemplates2/qquickpage.cpp
+++ b/src/quicktemplates2/qquickpage.cpp
@@ -285,7 +285,7 @@ void QQuickPage::setTitle(const QString &title)
return;
d->title = title;
- setAccessibleName(title);
+ maybeSetAccessibleName(title);
emit titleChanged();
}
@@ -473,7 +473,7 @@ void QQuickPage::accessibilityActiveChanged(bool active)
QQuickPane::accessibilityActiveChanged(active);
if (active)
- setAccessibleName(d->title);
+ maybeSetAccessibleName(d->title);
}
#endif
diff --git a/src/quicktemplates2/qquickpopup.cpp b/src/quicktemplates2/qquickpopup.cpp
index cc2f4358..7a7e00b1 100644
--- a/src/quicktemplates2/qquickpopup.cpp
+++ b/src/quicktemplates2/qquickpopup.cpp
@@ -2699,10 +2699,10 @@ QString QQuickPopup::accessibleName() const
return d->popupItem->accessibleName();
}
-void QQuickPopup::setAccessibleName(const QString &name)
+void QQuickPopup::maybeSetAccessibleName(const QString &name)
{
Q_D(QQuickPopup);
- d->popupItem->setAccessibleName(name);
+ d->popupItem->maybeSetAccessibleName(name);
}
QVariant QQuickPopup::accessibleProperty(const char *propertyName)
diff --git a/src/quicktemplates2/qquickpopup_p.h b/src/quicktemplates2/qquickpopup_p.h
index 12dbd247..dc3ebf6f 100644
--- a/src/quicktemplates2/qquickpopup_p.h
+++ b/src/quicktemplates2/qquickpopup_p.h
@@ -459,7 +459,7 @@ protected:
#endif
QString accessibleName() const;
- void setAccessibleName(const QString &name);
+ void maybeSetAccessibleName(const QString &name);
QVariant accessibleProperty(const char *propertyName);
bool setAccessibleProperty(const char *propertyName, const QVariant &value);
diff --git a/src/quicktemplates2/qquickpopupitem.cpp b/src/quicktemplates2/qquickpopupitem.cpp
index 28ddde66..8e169b0b 100644
--- a/src/quicktemplates2/qquickpopupitem.cpp
+++ b/src/quicktemplates2/qquickpopupitem.cpp
@@ -47,6 +47,10 @@
#endif
#include <QtGui/private/qguiapplication_p.h>
+#if QT_CONFIG(accessibility)
+#include <QtQuick/private/qquickaccessibleattached_p.h>
+#endif
+
QT_BEGIN_NAMESPACE
class QQuickPopupItemPrivate : public QQuickPagePrivate
@@ -403,7 +407,28 @@ QAccessible::Role QQuickPopupItem::accessibleRole() const
void QQuickPopupItem::accessibilityActiveChanged(bool active)
{
Q_D(const QQuickPopupItem);
+ // Can't just use d->popup->accessibleName() here, because that refers to the accessible
+ // name of us, the popup item, which is not what we want.
+ const QQuickAccessibleAttached *popupAccessibleAttached = QQuickControlPrivate::accessibleAttached(d->popup);
+ const QString oldPopupName = popupAccessibleAttached ? popupAccessibleAttached->name() : QString();
+ const bool wasNameExplicitlySetOnPopup = popupAccessibleAttached && popupAccessibleAttached->wasNameExplicitlySet();
+
QQuickPage::accessibilityActiveChanged(active);
+
+ QQuickAccessibleAttached *accessibleAttached = QQuickControlPrivate::accessibleAttached(this);
+ const QString ourName = accessibleAttached ? accessibleAttached->name() : QString();
+ if (wasNameExplicitlySetOnPopup && accessibleAttached && ourName != oldPopupName) {
+ // The user set Accessible.name on the Popup. Since the Popup and its popup item
+ // have different accessible attached properties, the popup item doesn't know that
+ // a name was set on the Popup by the user, and that it should use that, rather than
+ // whatever QQuickPage sets. That's why we need to do it here.
+ // To avoid it being overridden by the call to accessibilityActiveChanged() below,
+ // we set it explicitly. It's safe to do this as the popup item is an internal implementation detail.
+ accessibleAttached->setName(oldPopupName);
+ }
+
+ // This allows the different popup types to set a name on their popup item accordingly.
+ // For example: Dialog uses its title and ToolTip uses its text.
d->popup->accessibilityActiveChanged(active);
}
#endif
diff --git a/src/quicktemplates2/qquicksplitview.cpp b/src/quicktemplates2/qquicksplitview.cpp
index 45efdc75..219a6b08 100644
--- a/src/quicktemplates2/qquicksplitview.cpp
+++ b/src/quicktemplates2/qquicksplitview.cpp
@@ -80,6 +80,9 @@ QT_BEGIN_NAMESPACE
\li \l{SplitHandle::pressed}{SplitHandle.pressed}
\endlist
+ \note Handles should be purely visual and not handle events, as it can
+ interfere with their hovered and pressed states.
+
The preferred size of items in a SplitView can be specified via
\l{Item::}{implicitWidth} and \l{Item::}{implicitHeight} or
\c SplitView.preferredWidth and \c SplitView.preferredHeight:
@@ -1091,6 +1094,7 @@ QQuickSplitView::QQuickSplitView(QQuickItem *parent)
d->changeTypes |= QQuickItemPrivate::Visibility;
setAcceptedMouseButtons(Qt::LeftButton);
+ setFiltersChildMouseEvents(true);
}
QQuickSplitView::QQuickSplitView(QQuickSplitViewPrivate &dd, QQuickItem *parent)
@@ -1100,6 +1104,7 @@ QQuickSplitView::QQuickSplitView(QQuickSplitViewPrivate &dd, QQuickItem *parent)
d->changeTypes |= QQuickItemPrivate::Visibility;
setAcceptedMouseButtons(Qt::LeftButton);
+ setFiltersChildMouseEvents(true);
}
QQuickSplitView::~QQuickSplitView()
@@ -1364,6 +1369,20 @@ void QQuickSplitView::hoverMoveEvent(QHoverEvent *event)
d->updateHoveredHandle(hoveredItem);
}
+bool QQuickSplitView::childMouseEventFilter(QQuickItem *item, QEvent *event)
+{
+ Q_D(QQuickSplitView);
+ qCDebug(qlcQQuickSplitViewMouse) << "childMouseEventFilter called with" << item << event;
+ if (event->type() != QEvent::HoverEnter)
+ return false;
+
+ // If a child item received a hover enter event, then it means our handle is no longer hovered.
+ // Handles should be purely visual and not accept hover events,
+ // so we should never get hover events for them here.
+ d->updateHoveredHandle(nullptr);
+ return false;
+}
+
void QQuickSplitView::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
{
Q_D(QQuickSplitView);
diff --git a/src/quicktemplates2/qquicksplitview_p.h b/src/quicktemplates2/qquicksplitview_p.h
index 99001615..2fa15588 100644
--- a/src/quicktemplates2/qquicksplitview_p.h
+++ b/src/quicktemplates2/qquicksplitview_p.h
@@ -99,6 +99,7 @@ protected:
void componentComplete() override;
void hoverMoveEvent(QHoverEvent *event) override;
+ bool childMouseEventFilter(QQuickItem *item, QEvent *event) override;
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
void itemAdded(int index, QQuickItem *item) override;
diff --git a/src/quicktemplates2/qquickstackview.cpp b/src/quicktemplates2/qquickstackview.cpp
index f7a77374..4c314904 100644
--- a/src/quicktemplates2/qquickstackview.cpp
+++ b/src/quicktemplates2/qquickstackview.cpp
@@ -651,6 +651,13 @@ void QQuickStackView::push(QQmlV4Function *args)
void QQuickStackView::pop(QQmlV4Function *args)
{
Q_D(QQuickStackView);
+ if (d->removingElements) {
+ d->warn(QStringLiteral("cannot pop while already in the process of removing elements"));
+ args->setReturnValue(QV4::Encode::null());
+ return;
+ }
+
+ QScopedValueRollback<bool> removingElements(d->removingElements, true);
QScopedValueRollback<QString> rollback(d->operation, QStringLiteral("pop"));
int argc = args->length();
if (d->elements.count() <= 1 || argc > 2) {
@@ -806,6 +813,13 @@ void QQuickStackView::pop(QQmlV4Function *args)
void QQuickStackView::replace(QQmlV4Function *args)
{
Q_D(QQuickStackView);
+ if (d->removingElements) {
+ d->warn(QStringLiteral("cannot replace while already in the process of removing elements"));
+ args->setReturnValue(QV4::Encode::null());
+ return;
+ }
+
+ QScopedValueRollback<bool> removingElements(d->removingElements, true);
QScopedValueRollback<QString> rollback(d->operation, QStringLiteral("replace"));
if (args->length() <= 0) {
d->warn(QStringLiteral("missing arguments"));
@@ -902,6 +916,12 @@ void QQuickStackView::clear(Operation operation)
if (d->elements.isEmpty())
return;
+ if (d->removingElements) {
+ d->warn(QStringLiteral("cannot clear while already in the process of removing elements"));
+ return;
+ }
+
+ QScopedValueRollback<bool> removingElements(d->removingElements, true);
if (operation != Immediate) {
QQuickStackElement *exit = d->elements.pop();
exit->removal = true;
diff --git a/src/quicktemplates2/qquickstackview_p.cpp b/src/quicktemplates2/qquickstackview_p.cpp
index 7cb943a3..a280e31d 100644
--- a/src/quicktemplates2/qquickstackview_p.cpp
+++ b/src/quicktemplates2/qquickstackview_p.cpp
@@ -267,7 +267,11 @@ void QQuickStackViewPrivate::viewItemTransitionFinished(QQuickItemViewTransition
element->setStatus(QQuickStackView::Active);
} else if (element->status == QQuickStackView::Deactivating) {
element->setStatus(QQuickStackView::Inactive);
- element->setVisible(false);
+ QQuickStackElement *existingElement = element->item ? findElement(element->item) : nullptr;
+ // If a different element with the same item is found,
+ // do not call setVisible(false) since it needs to be visible.
+ if (!existingElement || element == existingElement)
+ element->setVisible(false);
if (element->removal || element->isPendingRemoval())
removed += element;
}
@@ -275,11 +279,21 @@ void QQuickStackViewPrivate::viewItemTransitionFinished(QQuickItemViewTransition
if (transitioner && transitioner->runningJobs.isEmpty()) {
// ~QQuickStackElement() emits QQuickStackViewAttached::removed(), which may be used
// to modify the stack. Set the status first and make a copy of the destroyable stack
- // elements to exclude any modifications that may happen during the loop. (QTBUG-62153)
+ // elements to exclude any modifications that may happen during qDeleteAll(). (QTBUG-62153)
setBusy(false);
- QList<QQuickStackElement*> elements = removed;
+ QList<QQuickStackElement*> removedElements = removed;
removed.clear();
- qDeleteAll(elements);
+
+ for (QQuickStackElement *removedElement : qAsConst(removedElements)) {
+ // If an element with the same item is found in the active stack list,
+ // forget about the item so that we don't hide it.
+ if (removedElement->item && findElement(removedElement->item)) {
+ QQuickItemPrivate::get(removedElement->item)->removeItemChangeListener(removedElement, QQuickItemPrivate::Destroyed);
+ removedElement->item = nullptr;
+ }
+ }
+
+ qDeleteAll(removedElements);
}
removing.remove(element);
diff --git a/src/quicktemplates2/qquickstackview_p_p.h b/src/quicktemplates2/qquickstackview_p_p.h
index c20ce776..b8c4b817 100644
--- a/src/quicktemplates2/qquickstackview_p_p.h
+++ b/src/quicktemplates2/qquickstackview_p_p.h
@@ -94,6 +94,7 @@ public:
void depthChange(int newDepth, int oldDepth);
bool busy = false;
+ bool removingElements = false;
QString operation;
QJSValue initialItem;
QQuickItem *currentItem = nullptr;
diff --git a/src/quicktemplates2/qquicktooltip.cpp b/src/quicktemplates2/qquicktooltip.cpp
index 5c7eb46e..9ea0160e 100644
--- a/src/quicktemplates2/qquicktooltip.cpp
+++ b/src/quicktemplates2/qquicktooltip.cpp
@@ -188,7 +188,7 @@ void QQuickToolTip::setText(const QString &text)
return;
d->text = text;
- setAccessibleName(text);
+ maybeSetAccessibleName(text);
emit textChanged();
}
@@ -351,7 +351,7 @@ void QQuickToolTip::accessibilityActiveChanged(bool active)
QQuickPopup::accessibilityActiveChanged(active);
if (active)
- setAccessibleName(d->text);
+ maybeSetAccessibleName(d->text);
}
#endif