Merge "Merge remote-tracking branch 'origin/5.13' into 5.14"
This commit is contained in:
commit
f3fd887de1
@ -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
|
||||
}
|
||||
|
||||
|
@ -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.*"): \
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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"
|
||||
|
||||
|
@ -11,7 +11,8 @@ SUBDIRS = \
|
||||
qxmlstream
|
||||
|
||||
!qtHaveModule(gui): SUBDIRS -= \
|
||||
qdatastream
|
||||
qdatastream \
|
||||
qdatastream_core_pixmap
|
||||
|
||||
!qtHaveModule(network): SUBDIRS -= \
|
||||
qtextstream
|
||||
|
@ -68,7 +68,4 @@ winrt|!qtHaveModule(gui)|!qtConfig(accessibility): SUBDIRS -= qaccessibility
|
||||
android: SUBDIRS += \
|
||||
android
|
||||
|
||||
qtConfig(xkbcommon): {
|
||||
SUBDIRS += \
|
||||
xkbkeyboard
|
||||
}
|
||||
qtHaveModule(gui):qtConfig(xkbcommon): SUBDIRS += xkbkeyboard
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user