summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-10-28 01:00:17 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2019-10-28 10:50:03 +0100
commit08f90adffdde1d7a4efa0de66f69091bd52d1d4b (patch)
treeb606ee7896d4550cd3e8150a5cc6db6a03f6bd39
parentdcbe25bbbb603bc335d7cf0982a80293289b0d8f (diff)
parenta21d4395f4f9afea52b6c2da359ce6ad21ebc763 (diff)
Merge remote-tracking branch 'origin/5.13' into 5.14
Conflicts: src/corelib/serialization/qjson_p.h Change-Id: I83cea141a4de8b3998478bfded84ca9029f7a2a9
-rw-r--r--configure.pri8
-rw-r--r--mkspecs/features/qt_example_installs.prf10
-rw-r--r--src/gui/kernel/qdnd.cpp9
-rw-r--r--src/gui/kernel/qdnd_p.h4
-rw-r--r--src/gui/kernel/qdrag.cpp7
-rw-r--r--src/plugins/platforms/xcb/qxcbdrag.cpp8
-rw-r--r--src/widgets/dialogs/qcolordialog.cpp4
-rw-r--r--tests/auto/corelib/serialization/qdatastream_core_pixmap/tst_qdatastream_core_pixmap.cpp21
-rw-r--r--tests/auto/corelib/serialization/serialization.pro3
-rw-r--r--tests/auto/other/other.pro5
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicspixmapitem/tst_qgraphicspixmapitem.cpp8
11 files changed, 55 insertions, 32 deletions
diff --git a/configure.pri b/configure.pri
index 5f82efbf07..97b9f3bf63 100644
--- a/configure.pri
+++ b/configure.pri
@@ -734,7 +734,13 @@ defineTest(qtConfOutput_preparePaths) {
}
have_prefix = false
} else {
- config.input.prefix = $$absolute_path($$config.input.prefix, $$OUT_PWD)
+ equals(XSPEC, $$[QMAKE_SPEC]) {
+ # Only make the user-specified prefix absolute if we're not cross-compiling.
+ config.input.prefix = $$absolute_path($$config.input.prefix, $$OUT_PWD)
+ } else {
+ # But we still must normalize path separators.
+ config.input.prefix = $$replace(config.input.prefix, \\\\, /)
+ }
have_prefix = true
}
diff --git a/mkspecs/features/qt_example_installs.prf b/mkspecs/features/qt_example_installs.prf
index 43b58817fe..72b47bce27 100644
--- a/mkspecs/features/qt_example_installs.prf
+++ b/mkspecs/features/qt_example_installs.prf
@@ -25,14 +25,16 @@ defineTest(addInstallFiles) {
export($$1)
}
-probase = $$relative_path($$_PRO_FILE_PWD_, $$dirname(_QMAKE_CONF_)/examples)
+moduleRoot = $$dirname(_QMAKE_CONF_)
+probase = $$relative_path($$_PRO_FILE_PWD_, $$moduleRoot/examples)
isEmpty(probase)|contains(probase, ^\\..*): \
return()
isEmpty(_QMAKE_CACHE_) {
- !equals(OUT_PWD, $$_PRO_FILE_PWD_): \
- return()
- error("You cannot build examples inside the Qt source tree, except as part of a proper Qt build.")
+ moduleRootRelativeToBuildDir = $$relative_path($$moduleRoot, $$OUT_PWD)
+ # Check if OUT_PWD is inside module root
+ equals(moduleRootRelativeToBuildDir, .)|contains(moduleRootRelativeToBuildDir, \(\.\./\)+\(\.\.\)?): \
+ error("You cannot build examples inside the Qt source tree, except as part of a proper Qt build.")
}
contains(TEMPLATE, "vc.*"): \
diff --git a/src/gui/kernel/qdnd.cpp b/src/gui/kernel/qdnd.cpp
index 5c5f166554..dd541af3b8 100644
--- a/src/gui/kernel/qdnd.cpp
+++ b/src/gui/kernel/qdnd.cpp
@@ -113,11 +113,12 @@ Qt::DropAction QDragManager::drag(QDrag *o)
m_object->d_func()->target = 0;
- QGuiApplicationPrivate::instance()->notifyDragStarted(o);
+ QGuiApplicationPrivate::instance()->notifyDragStarted(m_object.data());
const Qt::DropAction result = m_platformDrag->drag(m_object);
- m_object = 0;
- if (!m_platformDrag->ownsDragObject())
- o->deleteLater();
+ if (!m_object.isNull() && !m_platformDrag->ownsDragObject())
+ m_object->deleteLater();
+
+ m_object.clear();
return result;
}
diff --git a/src/gui/kernel/qdnd_p.h b/src/gui/kernel/qdnd_p.h
index b1219c8658..abb30986a5 100644
--- a/src/gui/kernel/qdnd_p.h
+++ b/src/gui/kernel/qdnd_p.h
@@ -101,13 +101,13 @@ public:
void setCurrentTarget(QObject *target, bool dropped = false);
QObject *currentTarget() const;
- QDrag *object() const { return m_object; }
+ QPointer<QDrag> object() const { return m_object; }
QObject *source() const;
private:
QObject *m_currentDropTarget;
QPlatformDrag *m_platformDrag;
- QDrag *m_object;
+ QPointer<QDrag> m_object;
static QDragManager *m_instance;
Q_DISABLE_COPY_MOVE(QDragManager)
diff --git a/src/gui/kernel/qdrag.cpp b/src/gui/kernel/qdrag.cpp
index dcd0d13d5c..8e2f7be23e 100644
--- a/src/gui/kernel/qdrag.cpp
+++ b/src/gui/kernel/qdrag.cpp
@@ -279,8 +279,11 @@ Qt::DropAction QDrag::exec(Qt::DropActions supportedActions, Qt::DropAction defa
}
d->supported_actions = supportedActions;
d->default_action = transformedDefaultDropAction;
- d->executed_action = QDragManager::self()->drag(this);
-
+ QPointer<QDrag> self = this;
+ auto executed_action = QDragManager::self()->drag(self.data());
+ if (self.isNull())
+ return Qt::IgnoreAction;
+ d->executed_action = executed_action;
return d->executed_action;
}
diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp
index 1ce947165d..3d525598ca 100644
--- a/src/plugins/platforms/xcb/qxcbdrag.cpp
+++ b/src/plugins/platforms/xcb/qxcbdrag.cpp
@@ -354,6 +354,11 @@ bool QXcbDrag::findXdndAwareTarget(const QPoint &globalPos, xcb_window_t *target
void QXcbDrag::move(const QPoint &globalPos, Qt::MouseButtons b, Qt::KeyboardModifiers mods)
{
+ // currentDrag() might be deleted while 'drag' is progressing
+ if (!currentDrag()) {
+ cancel();
+ return;
+ }
// The source sends XdndEnter and XdndPosition to the target.
if (source_sameanswer.contains(globalPos) && source_sameanswer.isValid())
return;
@@ -1076,7 +1081,8 @@ void QXcbDrag::cancel()
send_leave();
// remove canceled object
- currentDrag()->deleteLater();
+ if (currentDrag())
+ currentDrag()->deleteLater();
canceled = true;
}
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp
index fc00290536..d00a600424 100644
--- a/src/widgets/dialogs/qcolordialog.cpp
+++ b/src/widgets/dialogs/qcolordialog.cpp
@@ -504,7 +504,7 @@ void QWellArray::keyPressEvent(QKeyEvent* e)
// Event filter to be installed on the dialog while in color-picking mode.
class QColorPickingEventFilter : public QObject {
public:
- explicit QColorPickingEventFilter(QColorDialogPrivate *dp, QObject *parent = 0) : QObject(parent), m_dp(dp) {}
+ explicit QColorPickingEventFilter(QColorDialogPrivate *dp, QObject *parent) : QObject(parent), m_dp(dp) {}
bool eventFilter(QObject *, QEvent *event) override
{
@@ -1611,7 +1611,7 @@ void QColorDialogPrivate::_q_pickScreenColor()
{
Q_Q(QColorDialog);
if (!colorPickingEventFilter)
- colorPickingEventFilter = new QColorPickingEventFilter(this);
+ colorPickingEventFilter = new QColorPickingEventFilter(this, q);
q->installEventFilter(colorPickingEventFilter);
// If user pushes Escape, the last color before picking will be restored.
beforeScreenColorPicking = cs->currentColor();
diff --git a/tests/auto/corelib/serialization/qdatastream_core_pixmap/tst_qdatastream_core_pixmap.cpp b/tests/auto/corelib/serialization/qdatastream_core_pixmap/tst_qdatastream_core_pixmap.cpp
index c931016a61..cf5ead1220 100644
--- a/tests/auto/corelib/serialization/qdatastream_core_pixmap/tst_qdatastream_core_pixmap.cpp
+++ b/tests/auto/corelib/serialization/qdatastream_core_pixmap/tst_qdatastream_core_pixmap.cpp
@@ -27,13 +27,8 @@
****************************************************************************/
#include <QtTest/QtTest>
-#include <QtGui/QBitmap>
-#include <QtGui/QPalette>
#include <QtGui/QPixmap>
-#include <QtGui/QPicture>
-#include <QtGui/QTextLength>
-#include <QtGui/QPainter>
-#include <QtGui/QPen>
+#include <QtGui/QImage>
class tst_QDataStream : public QObject
{
@@ -41,16 +36,20 @@ Q_OBJECT
private slots:
void stream_with_pixmap();
-
};
void tst_QDataStream::stream_with_pixmap()
{
// This is a QVariantMap with a 3x3 red QPixmap and two strings inside
- const QByteArray ba = QByteArray::fromBase64("AAAAAwAAAAIAegAAAAoAAAAACgB0AGgAZQByAGUAAAACAHAAAABBAAAAAAGJUE5HDQoaCgAAAA1JSERSAAAAAwAAAAMIAgAAANlKIugAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAAQSURBVAiZY/zPAAVMDJgsAB1bAQXZn5ieAAAAAElFTkSuQmCCAAAAAgBhAAAACgAAAAAKAGgAZQBsAGwAbw==");
+ const QByteArray ba = QByteArray::fromBase64(
+ "AAAAAwAAAAIAegAAAAoAAAAACgB0AGgAZQByAGUAAAACAHAAAABBAAAAAAGJUE5H"
+ "DQoaCgAAAA1JSERSAAAAAwAAAAMIAgAAANlKIugAAAAJcEhZcwAADsQAAA7EAZUr"
+ "DhsAAAAQSURBVAiZY/zPAAVMDJgsAB1bAQXZn5ieAAAAAElFTkSuQmCCAAAAAgBh"
+ "AAAACgAAAAAKAGgAZQBsAGwAbw==");
QImage dummy; // Needed to make sure qtGui is loaded
- QTest::ignoreMessage(QtWarningMsg, "QPixmap::fromImageInPlace: QPixmap cannot be created without a QGuiApplication");
+ QTest::ignoreMessage(QtWarningMsg, "QPixmap::fromImageInPlace: "
+ "QPixmap cannot be created without a QGuiApplication");
QVariantMap map;
QDataStream d(ba);
@@ -58,11 +57,11 @@ void tst_QDataStream::stream_with_pixmap()
d >> map;
QCOMPARE(map["a"].toString(), QString("hello"));
- QCOMPARE(map["p"].value<QPixmap>(), QPixmap()); // the pixmap is null because this is not a QGuiApplication
+ // The pixmap is null because this is not a QGuiApplication:
+ QCOMPARE(map["p"].value<QPixmap>(), QPixmap());
QCOMPARE(map["z"].toString(), QString("there"));
}
QTEST_GUILESS_MAIN(tst_QDataStream)
#include "tst_qdatastream_core_pixmap.moc"
-
diff --git a/tests/auto/corelib/serialization/serialization.pro b/tests/auto/corelib/serialization/serialization.pro
index 9638178cdc..f4a5a3c5b1 100644
--- a/tests/auto/corelib/serialization/serialization.pro
+++ b/tests/auto/corelib/serialization/serialization.pro
@@ -11,7 +11,8 @@ SUBDIRS = \
qxmlstream
!qtHaveModule(gui): SUBDIRS -= \
- qdatastream
+ qdatastream \
+ qdatastream_core_pixmap
!qtHaveModule(network): SUBDIRS -= \
qtextstream
diff --git a/tests/auto/other/other.pro b/tests/auto/other/other.pro
index c5426202e8..cc6b1887a3 100644
--- a/tests/auto/other/other.pro
+++ b/tests/auto/other/other.pro
@@ -68,7 +68,4 @@ winrt|!qtHaveModule(gui)|!qtConfig(accessibility): SUBDIRS -= qaccessibility
android: SUBDIRS += \
android
-qtConfig(xkbcommon): {
- SUBDIRS += \
- xkbkeyboard
-}
+qtHaveModule(gui):qtConfig(xkbcommon): SUBDIRS += xkbkeyboard
diff --git a/tests/auto/widgets/graphicsview/qgraphicspixmapitem/tst_qgraphicspixmapitem.cpp b/tests/auto/widgets/graphicsview/qgraphicspixmapitem/tst_qgraphicspixmapitem.cpp
index 78fe448bdb..843a30df16 100644
--- a/tests/auto/widgets/graphicsview/qgraphicspixmapitem/tst_qgraphicspixmapitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicspixmapitem/tst_qgraphicspixmapitem.cpp
@@ -156,6 +156,14 @@ void tst_QGraphicsPixmapItem::contains()
QFETCH(QPointF, point);
QFETCH(bool, contains);
+ // At the time of writing, by default pixmaps will have:
+ // - The same pixel format of the primary screen (which is platform dependent and may contain alpha)
+ // - Uninitialized pixels, potentially including an alpha channel
+ // - A ShapeMode of Mask (which mean it will use the alpha channel as a mask for contains())
+ // This means that in order to prevent undefined behavior in this test, we either need to set
+ // the shapeMode to something else, or set the pixels of the pixmap.
+ pixmap.fill(); // Filling the pixmap to be on the safe side.
+
SubQGraphicsPixmapItem item(pixmap);
QCOMPARE(item.contains(point), contains);
}