aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/quickcontrols2/chattutorial/doc/src/qtquickcontrols2-chattutorial.qdoc2
-rw-r--r--src/imports/controls/imagine/qquickninepatchimage.cpp19
-rw-r--r--src/imports/controls/material/qquickmaterialbusyindicator.cpp2
-rw-r--r--src/imports/controls/material/qquickmaterialbusyindicator_p.h2
-rw-r--r--src/imports/controls/universal/TabBar.qml23
-rw-r--r--src/quickcontrols2/qquickattachedobject.cpp2
-rw-r--r--src/quickcontrols2/qquickiconlabel.cpp2
-rw-r--r--src/quickcontrols2/qquickiconlabel_p.h2
-rw-r--r--src/quickcontrols2/qquickstyle.cpp2
-rw-r--r--src/quickcontrols2/qquicktumblerview.cpp3
-rw-r--r--src/quicktemplates2/qquickabstractbutton.cpp8
-rw-r--r--src/quicktemplates2/qquickabstractbutton_p_p.h4
-rw-r--r--src/quicktemplates2/qquickaction.cpp17
-rw-r--r--src/quicktemplates2/qquickaction_p_p.h6
-rw-r--r--src/quicktemplates2/qquickdeferredexecute.cpp10
-rw-r--r--src/quicktemplates2/qquickpopupitem.cpp4
-rw-r--r--tests/auto/auto.pro3
-rw-r--r--tests/auto/qquickimaginestyle/data/tst_imagine.qml48
-rw-r--r--tests/auto/qquickimaginestyle/qquickimaginestyle.pro4
-rw-r--r--tests/auto/qquickimaginestyle/test-assets/button-background-1.pngbin0 -> 211 bytes
-rw-r--r--tests/auto/qquickimaginestyle/test-assets/button-background-2.pngbin0 -> 211 bytes
-rw-r--r--tests/auto/qquickpopup/tst_qquickpopup.cpp14
22 files changed, 137 insertions, 40 deletions
diff --git a/examples/quickcontrols2/chattutorial/doc/src/qtquickcontrols2-chattutorial.qdoc b/examples/quickcontrols2/chattutorial/doc/src/qtquickcontrols2-chattutorial.qdoc
index 0da8f7c5..49e98068 100644
--- a/examples/quickcontrols2/chattutorial/doc/src/qtquickcontrols2-chattutorial.qdoc
+++ b/examples/quickcontrols2/chattutorial/doc/src/qtquickcontrols2-chattutorial.qdoc
@@ -309,7 +309,7 @@ in an application. Here's the revised \c main.qml:
\printuntil }
\printuntil }
-\section2 StackView
+\section2 Navigating with StackView
As its name suggests, StackView provides stack-based navigation. The last item
to be \e "pushed" onto the stack is the first one to be removed, and the
diff --git a/src/imports/controls/imagine/qquickninepatchimage.cpp b/src/imports/controls/imagine/qquickninepatchimage.cpp
index c840c6f8..7d5e4f71 100644
--- a/src/imports/controls/imagine/qquickninepatchimage.cpp
+++ b/src/imports/controls/imagine/qquickninepatchimage.cpp
@@ -397,7 +397,24 @@ void QQuickNinePatchImage::pixmapChange()
d->updatePatches();
} else {
- d->resetNode = !d->ninePatch.isNull();
+ /*
+ Only change resetNode when it's false; i.e. when no reset is pending.
+ updatePaintNode() will take care of setting it to false if it's true.
+
+ Consider the following changes in source:
+
+ normal.png => press.9.png => normal.png => focus.png
+
+ If the last two events happen quickly, pixmapChange() can be called
+ twice with no call to updatePaintNode() inbetween. On the first call,
+ resetNode will be true (because ninePatch is not null since it is still
+ in the process of going from a 9-patch image to a regular image),
+ and on the second call, resetNode would be false if we didn't have this check.
+ This results in the oldNode never being deleted, and QQuickImage
+ tries to static_cast a QQuickNinePatchImage to a QSGInternalImageNode.
+ */
+ if (!d->resetNode)
+ d->resetNode = !d->ninePatch.isNull();
d->ninePatch = QImage();
}
QQuickImage::pixmapChange();
diff --git a/src/imports/controls/material/qquickmaterialbusyindicator.cpp b/src/imports/controls/material/qquickmaterialbusyindicator.cpp
index c18a4005..58c1fd8c 100644
--- a/src/imports/controls/material/qquickmaterialbusyindicator.cpp
+++ b/src/imports/controls/material/qquickmaterialbusyindicator.cpp
@@ -184,7 +184,7 @@ QColor QQuickMaterialBusyIndicator::color() const
return m_color;
}
-void QQuickMaterialBusyIndicator::setColor(QColor color)
+void QQuickMaterialBusyIndicator::setColor(const QColor &color)
{
if (m_color == color)
return;
diff --git a/src/imports/controls/material/qquickmaterialbusyindicator_p.h b/src/imports/controls/material/qquickmaterialbusyindicator_p.h
index d29427c1..ad7bc002 100644
--- a/src/imports/controls/material/qquickmaterialbusyindicator_p.h
+++ b/src/imports/controls/material/qquickmaterialbusyindicator_p.h
@@ -63,7 +63,7 @@ public:
explicit QQuickMaterialBusyIndicator(QQuickItem *parent = nullptr);
QColor color() const;
- void setColor(QColor color);
+ void setColor(const QColor &color);
bool isRunning() const;
void setRunning(bool running);
diff --git a/src/imports/controls/universal/TabBar.qml b/src/imports/controls/universal/TabBar.qml
index ab660c93..c7d27cbd 100644
--- a/src/imports/controls/universal/TabBar.qml
+++ b/src/imports/controls/universal/TabBar.qml
@@ -46,23 +46,20 @@ T.TabBar {
implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,
contentHeight + topPadding + bottomPadding)
- contentItem: PathView {
+ contentItem: ListView {
model: control.contentModel
currentIndex: control.currentIndex
- interactive: false
- snapMode: PathView.SnapToItem
- movementDirection: PathView.Positive
- highlightMoveDuration: 100
+ spacing: control.spacing
+ orientation: ListView.Horizontal
+ boundsBehavior: Flickable.StopAtBounds
+ flickableDirection: Flickable.AutoFlickIfNeeded
+ snapMode: ListView.SnapToItem
- path: Path {
- startX: control.count ? control.availableWidth / control.count / 2 : 0
- startY: control.availableHeight / 2
- PathLine {
- x: control.count ? control.availableWidth + (control.availableWidth / control.count / 2) : 0
- y: control.availableHeight / 2
- }
- }
+ highlightMoveDuration: 100
+ highlightRangeMode: ListView.ApplyRange
+ preferredHighlightBegin: 48
+ preferredHighlightEnd: width - 48
}
background: Rectangle {
diff --git a/src/quickcontrols2/qquickattachedobject.cpp b/src/quickcontrols2/qquickattachedobject.cpp
index c43f7dc5..722f22f9 100644
--- a/src/quickcontrols2/qquickattachedobject.cpp
+++ b/src/quickcontrols2/qquickattachedobject.cpp
@@ -119,7 +119,7 @@ static QList<QQuickAttachedObject *> findAttachedChildren(const QMetaObject *typ
if (window) {
item = window->contentItem();
- const auto windowChildren = window->children();
+ const auto &windowChildren = window->children();
for (QObject *child : windowChildren) {
QQuickWindow *childWindow = qobject_cast<QQuickWindow *>(child);
if (childWindow) {
diff --git a/src/quickcontrols2/qquickiconlabel.cpp b/src/quickcontrols2/qquickiconlabel.cpp
index b246621b..536b3c1b 100644
--- a/src/quickcontrols2/qquickiconlabel.cpp
+++ b/src/quickcontrols2/qquickiconlabel.cpp
@@ -408,7 +408,7 @@ QString QQuickIconLabel::text() const
return d->text;
}
-void QQuickIconLabel::setText(const QString text)
+void QQuickIconLabel::setText(const QString &text)
{
Q_D(QQuickIconLabel);
if (d->text == text)
diff --git a/src/quickcontrols2/qquickiconlabel_p.h b/src/quickcontrols2/qquickiconlabel_p.h
index df79dbf2..75b77064 100644
--- a/src/quickcontrols2/qquickiconlabel_p.h
+++ b/src/quickcontrols2/qquickiconlabel_p.h
@@ -88,7 +88,7 @@ public:
void setIcon(const QQuickIcon &icon);
QString text() const;
- void setText(const QString text);
+ void setText(const QString &text);
QFont font() const;
void setFont(const QFont &font);
diff --git a/src/quickcontrols2/qquickstyle.cpp b/src/quickcontrols2/qquickstyle.cpp
index e2b6678b..408a0de3 100644
--- a/src/quickcontrols2/qquickstyle.cpp
+++ b/src/quickcontrols2/qquickstyle.cpp
@@ -495,7 +495,7 @@ static bool qt_is_dark_system_theme()
{
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme()) {
if (const QPalette *systemPalette = theme->palette(QPlatformTheme::SystemPalette)) {
- const QColor textColor = systemPalette->color(QPalette::WindowText);
+ const QColor &textColor = systemPalette->color(QPalette::WindowText);
return textColor.red() > 128 && textColor.blue() > 128 && textColor.green() > 128;
}
}
diff --git a/src/quickcontrols2/qquicktumblerview.cpp b/src/quickcontrols2/qquicktumblerview.cpp
index 5f5c065d..4a64ad7f 100644
--- a/src/quickcontrols2/qquicktumblerview.cpp
+++ b/src/quickcontrols2/qquicktumblerview.cpp
@@ -180,7 +180,6 @@ void QQuickTumblerView::createView()
QQml_setParent_noEvent(m_listView, this);
m_listView->setParentItem(this);
m_listView->setSnapMode(QQuickListView::SnapToItem);
- m_listView->setHighlightRangeMode(QQuickListView::StrictlyEnforceRange);
m_listView->setClip(true);
// Give the view a size.
@@ -193,6 +192,8 @@ void QQuickTumblerView::createView()
// the view animates any potential currentIndex change over one second,
// which we don't want when the contentItem has just been created.
m_listView->setDelegate(m_delegate);
+ // Set this after setting the delegate to avoid unexpected currentIndex changes: QTBUG-79150
+ m_listView->setHighlightRangeMode(QQuickListView::StrictlyEnforceRange);
m_listView->setHighlightMoveDuration(1000);
qCDebug(lcTumblerView) << "finished creating ListView";
diff --git a/src/quicktemplates2/qquickabstractbutton.cpp b/src/quicktemplates2/qquickabstractbutton.cpp
index 2099f2db..bb07d13e 100644
--- a/src/quicktemplates2/qquickabstractbutton.cpp
+++ b/src/quicktemplates2/qquickabstractbutton.cpp
@@ -44,7 +44,9 @@
#include <QtGui/qstylehints.h>
#include <QtGui/qguiapplication.h>
-#include <QtGui/private/qshortcutmap_p.h>
+#if QT_CONFIG(shortcut)
+# include <QtGui/private/qshortcutmap_p.h>
+#endif
#include <QtGui/private/qguiapplication_p.h>
#include <QtQuick/private/qquickevents_p_p.h>
#include <QtQml/qqmllist.h>
@@ -1015,8 +1017,8 @@ void QQuickAbstractButton::componentComplete()
bool QQuickAbstractButton::event(QEvent *event)
{
- Q_D(QQuickAbstractButton);
#if QT_CONFIG(shortcut)
+ Q_D(QQuickAbstractButton);
if (event->type() == QEvent::Shortcut) {
QShortcutEvent *se = static_cast<QShortcutEvent *>(event);
if (se->shortcutId() == d->shortcutId) {
@@ -1101,9 +1103,9 @@ void QQuickAbstractButton::timerEvent(QTimerEvent *event)
void QQuickAbstractButton::itemChange(ItemChange change, const ItemChangeData &value)
{
- Q_D(QQuickAbstractButton);
QQuickControl::itemChange(change, value);
#if QT_CONFIG(shortcut)
+ Q_D(QQuickAbstractButton);
if (change == ItemVisibleHasChanged) {
if (value.boolValue)
d->grabShortcut();
diff --git a/src/quicktemplates2/qquickabstractbutton_p_p.h b/src/quicktemplates2/qquickabstractbutton_p_p.h
index 7394f115..8ad479e2 100644
--- a/src/quicktemplates2/qquickabstractbutton_p_p.h
+++ b/src/quicktemplates2/qquickabstractbutton_p_p.h
@@ -50,7 +50,9 @@
#include <QtQuickTemplates2/private/qquickabstractbutton_p.h>
#include <QtQuickTemplates2/private/qquickcontrol_p_p.h>
-#include <QtGui/qkeysequence.h>
+#if QT_CONFIG(shortcut)
+# include <QtGui/qkeysequence.h>
+#endif
QT_BEGIN_NAMESPACE
diff --git a/src/quicktemplates2/qquickaction.cpp b/src/quicktemplates2/qquickaction.cpp
index 9120db37..559c5fc3 100644
--- a/src/quicktemplates2/qquickaction.cpp
+++ b/src/quicktemplates2/qquickaction.cpp
@@ -40,7 +40,9 @@
#include "qquickshortcutcontext_p_p.h"
#include <QtGui/qevent.h>
-#include <QtGui/private/qshortcutmap_p.h>
+#if QT_CONFIG(shortcut)
+# include <QtGui/private/qshortcutmap_p.h>
+#endif
#include <QtGui/private/qguiapplication_p.h>
#include <QtQuick/private/qquickitem_p.h>
@@ -261,6 +263,8 @@ void QQuickActionPrivate::unregisterItem(QQuickItem *item)
delete entry;
updateDefaultShortcutEntry();
+#else
+ Q_UNUSED(item);
#endif
}
@@ -277,6 +281,8 @@ void QQuickActionPrivate::itemVisibilityChanged(QQuickItem *item)
entry->ungrab();
updateDefaultShortcutEntry();
+#else
+ Q_UNUSED(item);
#endif
}
@@ -332,8 +338,8 @@ void QQuickActionPrivate::updateDefaultShortcutEntry()
QQuickAction::QQuickAction(QObject *parent)
: QObject(*(new QQuickActionPrivate), parent)
{
- Q_D(QQuickAction);
#if QT_CONFIG(shortcut)
+ Q_D(QQuickAction);
d->defaultShortcutEntry = new QQuickActionPrivate::ShortcutEntry(this);
#endif
}
@@ -554,8 +560,8 @@ void QQuickActionPrivate::trigger(QObject* source, bool doToggle)
bool QQuickAction::event(QEvent *event)
{
- Q_D(QQuickAction);
#if QT_CONFIG(shortcut)
+ Q_D(QQuickAction);
if (event->type() == QEvent::Shortcut)
return d->handleShortcutEvent(this, static_cast<QShortcutEvent *>(event));
#endif
@@ -564,10 +570,13 @@ bool QQuickAction::event(QEvent *event)
bool QQuickAction::eventFilter(QObject *object, QEvent *event)
{
- Q_D(QQuickAction);
#if QT_CONFIG(shortcut)
+ Q_D(QQuickAction);
if (event->type() == QEvent::Shortcut)
return d->handleShortcutEvent(object, static_cast<QShortcutEvent *>(event));
+#else
+ Q_UNUSED(object);
+ Q_UNUSED(event);
#endif
return false;
}
diff --git a/src/quicktemplates2/qquickaction_p_p.h b/src/quicktemplates2/qquickaction_p_p.h
index 7c70bab1..252b0075 100644
--- a/src/quicktemplates2/qquickaction_p_p.h
+++ b/src/quicktemplates2/qquickaction_p_p.h
@@ -51,7 +51,9 @@
#include <QtCore/private/qobject_p.h>
#include <QtCore/qvariant.h>
#include <QtCore/qstring.h>
-#include <QtGui/qkeysequence.h>
+#if QT_CONFIG(shortcut)
+# include <QtGui/qkeysequence.h>
+#endif
#include <QtQuick/private/qquickitemchangelistener_p.h>
QT_BEGIN_NAMESPACE
@@ -119,8 +121,8 @@ public:
bool checkable = false;
QString text;
QQuickIcon icon;
- QKeySequence keySequence;
#if QT_CONFIG(shortcut)
+ QKeySequence keySequence;
QVariant vshortcut;
ShortcutEntry *defaultShortcutEntry = nullptr;
QVector<ShortcutEntry *> shortcutEntries;
diff --git a/src/quicktemplates2/qquickdeferredexecute.cpp b/src/quicktemplates2/qquickdeferredexecute.cpp
index 800dcedb..d56131e4 100644
--- a/src/quicktemplates2/qquickdeferredexecute.cpp
+++ b/src/quicktemplates2/qquickdeferredexecute.cpp
@@ -92,11 +92,21 @@ static bool beginDeferred(QQmlEnginePrivate *enginePriv, const QQmlProperty &pro
typedef QMultiHash<int, const QV4::CompiledData::Binding *> QV4PropertyBindingHash;
auto it = std::reverse_iterator<QV4PropertyBindingHash::iterator>(range.second);
auto last = std::reverse_iterator<QV4PropertyBindingHash::iterator>(range.first);
+#if Q_QML_PRIVATE_API_VERSION < 7
while (it != last) {
if (!state->creator->populateDeferredBinding(property, deferData, *it))
state->errors << state->creator->errors;
++it;
}
+#else
+ state->creator->beginPopulateDeferred(deferData->context);
+ while (it != last) {
+ state->creator->populateDeferredBinding(property, deferData->deferredIdx, *it);
+ ++it;
+ }
+ state->creator->finalizePopulateDeferred();
+ state->errors << state->creator->errors;
+#endif
deferredState->constructionStates += state;
diff --git a/src/quicktemplates2/qquickpopupitem.cpp b/src/quicktemplates2/qquickpopupitem.cpp
index 16d8c4f6..28ddde66 100644
--- a/src/quicktemplates2/qquickpopupitem.cpp
+++ b/src/quicktemplates2/qquickpopupitem.cpp
@@ -42,7 +42,9 @@
#include "qquickpopup_p_p.h"
#include "qquickdeferredexecute_p_p.h"
-#include <QtGui/private/qshortcutmap_p.h>
+#if QT_CONFIG(shortcut)
+# include <QtGui/private/qshortcutmap_p.h>
+#endif
#include <QtGui/private/qguiapplication_p.h>
QT_BEGIN_NAMESPACE
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index d528b848..8612e2c1 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -30,3 +30,6 @@ SUBDIRS += \
revisions \
sanity \
snippets
+
+# Requires lrelease, which isn't always available in CI.
+qtHaveModule(tools): translation
diff --git a/tests/auto/qquickimaginestyle/data/tst_imagine.qml b/tests/auto/qquickimaginestyle/data/tst_imagine.qml
index 03bb9602..b9078d78 100644
--- a/tests/auto/qquickimaginestyle/data/tst_imagine.qml
+++ b/tests/auto/qquickimaginestyle/data/tst_imagine.qml
@@ -54,6 +54,7 @@ import QtTest 1.1
import QtQuick.Templates 2.12 as T
import QtQuick.Controls 2.12
import QtQuick.Controls.Imagine 2.12
+import QtQuick.Controls.Imagine.impl 2.12
TestCase {
id: testCase
@@ -105,4 +106,51 @@ TestCase {
verify(control)
compare(control.font.pixelSize, 80)
}
+
+ Component {
+ id: ninePatchImageComponent
+
+ NinePatchImage {
+ property alias mouseArea: mouseArea
+
+ MouseArea {
+ id: mouseArea
+ anchors.fill: parent
+ // The name of the images isn't important; we just want to check that
+ // going from regular to 9-patch to regular to regular works without crashing.
+ onPressed: parent.source = "qrc:/control-assets/button-background.9.png"
+ onReleased: parent.source = "qrc:/test-assets/button-background-1.png"
+ onClicked: parent.source = "qrc:/test-assets/button-background-2.png"
+ }
+ }
+ }
+
+ Component {
+ id: signalSpyComponent
+
+ SignalSpy {}
+ }
+
+ // QTBUG-78790
+ function test_switchBetween9PatchAndRegular() {
+ var ninePatchImage = createTemporaryObject(ninePatchImageComponent, testCase,
+ { source: "qrc:/test-assets/button-background-1.png" })
+ verify(ninePatchImage)
+
+ var clickSpy = signalSpyComponent.createObject(ninePatchImage,
+ { target: ninePatchImage.mouseArea, signalName: "clicked" })
+ verify(clickSpy.valid)
+
+ var afterRenderingSpy = signalSpyComponent.createObject(ninePatchImage,
+ { target: testCase.Window.window, signalName: "afterRendering" })
+ verify(afterRenderingSpy.valid)
+
+ mousePress(ninePatchImage)
+ // Wait max 1 second - in reality it should take a handful of milliseconds.
+ afterRenderingSpy.wait(1000)
+ mouseRelease(ninePatchImage)
+ compare(clickSpy.count, 1)
+ // Shouldn't result in a crash.
+ afterRenderingSpy.wait(1000)
+ }
}
diff --git a/tests/auto/qquickimaginestyle/qquickimaginestyle.pro b/tests/auto/qquickimaginestyle/qquickimaginestyle.pro
index c421f2dc..4b1a309a 100644
--- a/tests/auto/qquickimaginestyle/qquickimaginestyle.pro
+++ b/tests/auto/qquickimaginestyle/qquickimaginestyle.pro
@@ -7,7 +7,9 @@ SOURCES += \
RESOURCES += \
$$PWD/qtquickcontrols2.conf \
- $$PWD/control-assets/button-background.9.png
+ $$PWD/control-assets/button-background.9.png \
+ $$PWD/test-assets/button-background-1.png \
+ $$PWD/test-assets/button-background-2.png
OTHER_FILES += \
$$PWD/data/*.qml
diff --git a/tests/auto/qquickimaginestyle/test-assets/button-background-1.png b/tests/auto/qquickimaginestyle/test-assets/button-background-1.png
new file mode 100644
index 00000000..244b707b
--- /dev/null
+++ b/tests/auto/qquickimaginestyle/test-assets/button-background-1.png
Binary files differ
diff --git a/tests/auto/qquickimaginestyle/test-assets/button-background-2.png b/tests/auto/qquickimaginestyle/test-assets/button-background-2.png
new file mode 100644
index 00000000..54f5ecd8
--- /dev/null
+++ b/tests/auto/qquickimaginestyle/test-assets/button-background-2.png
Binary files differ
diff --git a/tests/auto/qquickpopup/tst_qquickpopup.cpp b/tests/auto/qquickpopup/tst_qquickpopup.cpp
index e1e2c470..0b07191e 100644
--- a/tests/auto/qquickpopup/tst_qquickpopup.cpp
+++ b/tests/auto/qquickpopup/tst_qquickpopup.cpp
@@ -1199,9 +1199,11 @@ void tst_QQuickPopup::toolTipCrashOnClose()
QQuickWindow *window = helper.window;
window->show();
- // TODO: Using ignoreMessage() fails in CI with macOS for release builds,
- // so for now we let the warning through.
-// QTest::ignoreMessage(QtWarningMsg, "ShaderEffectSource: 'recursive' must be set to true when rendering recursively.");
+ // The warning only occurs with debug builds for some reason.
+ // In any case, the warning is irrelevant, but using ShaderEffectSource is important, so we ignore it.
+#ifdef QT_DEBUG
+ QTest::ignoreMessage(QtWarningMsg, "ShaderEffectSource: 'recursive' must be set to true when rendering recursively.");
+#endif
QVERIFY(QTest::qWaitForWindowActive(window));
QTest::mouseMove(window, QPoint(window->width() / 2, window->height() / 2));
@@ -1217,9 +1219,9 @@ void tst_QQuickPopup::setOverlayParentToNull()
QQuickWindow *window = helper.window;
window->show();
- // TODO: Using ignoreMessage() fails in CI with macOS for release builds,
- // so for now we let the warning through.
-// QTest::ignoreMessage(QtWarningMsg, "ShaderEffectSource: 'recursive' must be set to true when rendering recursively.");
+#ifdef QT_DEBUG
+ QTest::ignoreMessage(QtWarningMsg, "ShaderEffectSource: 'recursive' must be set to true when rendering recursively.");
+#endif
QVERIFY(QTest::qWaitForWindowActive(window));
QVERIFY(QMetaObject::invokeMethod(window, "nullifyOverlayParent"));