summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/corelib/threads/doc/src/waitconditions.qdoc2
-rw-r--r--src/corelib/global/qcompilerdetection.h2
-rw-r--r--src/corelib/global/qendian.h12
-rw-r--r--src/corelib/global/qglobal.h4
-rw-r--r--src/corelib/io/qtextstream.cpp5
-rw-r--r--src/corelib/io/qwindowspipewriter_p.h6
-rw-r--r--src/corelib/kernel/qcoreevent.cpp2
-rw-r--r--src/corelib/kernel/qobject.cpp5
-rw-r--r--src/corelib/thread/qthread.cpp4
-rw-r--r--src/corelib/tools/qbytearray.cpp2
-rw-r--r--src/corelib/tools/qbytearraymatcher.cpp2
-rw-r--r--src/corelib/tools/qfreelist_p.h2
-rw-r--r--src/corelib/tools/qmargins.cpp2
-rw-r--r--src/corelib/tools/qsharedpointer_impl.h2
-rw-r--r--src/corelib/xml/qxmlstream.cpp4
-rw-r--r--src/gui/doc/snippets/code/src_gui_image_qpixmap.cpp2
-rw-r--r--src/gui/kernel/qguiapplication.cpp11
-rw-r--r--src/gui/kernel/qopenglcontext.cpp14
-rw-r--r--src/gui/kernel/qscreen_p.h3
-rw-r--r--src/gui/painting/painting.pri1
-rw-r--r--src/gui/painting/qfixed_p.h42
-rw-r--r--src/gui/text/qfontdatabase.cpp2
-rw-r--r--src/gui/text/qtextengine.cpp9
-rw-r--r--src/gui/text/qtextformat.cpp6
-rw-r--r--src/network/access/qnetworkreply.cpp2
-rw-r--r--src/network/socket/qabstractsocket.cpp11
-rw-r--r--src/network/ssl/qsslconfiguration.cpp1
-rw-r--r--src/network/ssl/qsslsocket.cpp1
-rw-r--r--src/platformsupport/fbconvenience/qfbbackingstore.cpp25
-rw-r--r--src/platformsupport/fbconvenience/qfbbackingstore_p.h10
-rw-r--r--src/platformsupport/fbconvenience/qfbscreen.cpp35
-rw-r--r--src/platformsupport/fbconvenience/qfbscreen_p.h3
-rw-r--r--src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm5
-rw-r--r--src/platformsupport/linuxaccessibility/atspiadaptor.cpp4
-rw-r--r--src/platformsupport/linuxaccessibility/linuxaccessibility.pri1
-rw-r--r--src/plugins/platforms/android/android.pro9
-rw-r--r--src/plugins/platforms/windows/qtwindows_additional.h4
-rw-r--r--src/plugins/platforms/windows/qtwindowsglobal.h3
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp10
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.h2
-rw-r--r--src/plugins/platforms/windows/qwindowscursor.cpp8
-rw-r--r--src/plugins/platforms/windows/qwindowseglcontext.cpp11
-rw-r--r--src/plugins/platforms/windows/qwindowseglcontext.h7
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase.cpp36
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp36
-rw-r--r--src/plugins/platforms/windows/qwindowsglcontext.cpp1
-rw-r--r--src/plugins/platforms/windows/qwindowsmousehandler.cpp86
-rw-r--r--src/plugins/platforms/windows/qwindowsmousehandler.h4
-rw-r--r--src/plugins/platforms/windows/qwindowsscreen.cpp9
-rw-r--r--src/plugins/platforms/windows/qwindowsscreen.h2
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp124
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.h4
-rw-r--r--src/printsupport/kernel/qprinter.cpp5
-rw-r--r--src/testlib/qbenchmark_p.h1
-rw-r--r--src/testlib/qtest.h3
-rw-r--r--src/testlib/testlib.pro1
-rw-r--r--src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc2
-rw-r--r--src/tools/rcc/main.cpp4
-rw-r--r--src/widgets/doc/src/widgets-and-layouts/layout.qdoc2
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp4
-rw-r--r--src/widgets/itemviews/qlistview.cpp2
-rw-r--r--src/widgets/itemviews/qtableview.cpp2
-rw-r--r--src/widgets/itemviews/qtreeview.cpp2
-rw-r--r--src/widgets/itemviews/qtreewidget.cpp2
-rw-r--r--src/widgets/kernel/qwidget.cpp2
-rw-r--r--src/widgets/styles/qfusionstyle.cpp3
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp12
-rw-r--r--src/widgets/util/qsystemtrayicon.cpp28
-rw-r--r--src/widgets/util/qsystemtrayicon_p.h1
-rw-r--r--src/widgets/widgets/qplaintextedit.cpp3
-rwxr-xr-xtests/auto/android/runtests_androiddeployqt.pl2
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/qmimedatabase-cache.pro4
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/qmimedatabase-xml.pro3
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/testdata.qrc7
-rw-r--r--tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp13
-rw-r--r--tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp18
-rw-r--r--tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp90
-rw-r--r--tests/auto/network/ssl/qsslcertificate/qsslcertificate.pro1
-rw-r--r--tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp8
-rw-r--r--tests/auto/other/qaccessibility/tst_qaccessibility.cpp6
-rw-r--r--tests/auto/other/qaccessibilitylinux/qaccessibilitylinux.pro1
-rw-r--r--tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp12
-rw-r--r--tests/auto/testlib/selftests/datetime/tst_datetime.cpp2
-rw-r--r--tests/auto/testlib/selftests/expected_datetime.lightxml2
-rw-r--r--tests/auto/testlib/selftests/expected_datetime.txt2
-rw-r--r--tests/auto/testlib/selftests/expected_datetime.xml2
-rw-r--r--tests/auto/testlib/selftests/expected_datetime.xunitxml2
-rw-r--r--tests/auto/widgets/dialogs/qcolordialog/tst_qcolordialog.cpp10
-rw-r--r--tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp3
-rw-r--r--tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp3
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp95
-rw-r--r--tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp6
-rw-r--r--tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp33
-rw-r--r--tests/manual/diaglib/nativewindowdump_win.cpp2
-rw-r--r--tests/manual/diaglib/qwidgetdump.cpp2
-rw-r--r--tests/manual/diaglib/qwindowdump.cpp4
-rw-r--r--tests/manual/windowflags/controllerwindow.cpp5
97 files changed, 719 insertions, 298 deletions
diff --git a/examples/corelib/threads/doc/src/waitconditions.qdoc b/examples/corelib/threads/doc/src/waitconditions.qdoc
index aff6997b55..3d15f0d4bf 100644
--- a/examples/corelib/threads/doc/src/waitconditions.qdoc
+++ b/examples/corelib/threads/doc/src/waitconditions.qdoc
@@ -136,7 +136,7 @@
byte in the buffer, \c numUsedBytes is \c BufferSize - 1 and the
\c bufferNotEmpty condition is signalled. At that point, two
things can happen: Either the consumer thread takes over and
- reads that byte, or the consumer gets to produce a second byte.
+ reads that byte, or the producer gets to produce a second byte.
The producer-consumer model presented in this example makes it
possible to write highly concurrent multithreaded applications.
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index 3f813e163b..7effb24130 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -533,7 +533,6 @@
# define Q_COMPILER_AUTO_FUNCTION
# define Q_COMPILER_NULLPTR
# define Q_COMPILER_TEMPLATE_ALIAS
-# define Q_COMPILER_UNICODE_STRINGS
# define Q_COMPILER_VARIADIC_TEMPLATES
# endif
# if __INTEL_COMPILER >= 1300
@@ -554,6 +553,7 @@
# define Q_COMPILER_RANGE_FOR
# define Q_COMPILER_RAW_STRINGS
# define Q_COMPILER_REF_QUALIFIERS
+# define Q_COMPILER_UNICODE_STRINGS
# define Q_COMPILER_UNRESTRICTED_UNIONS
# endif
# if __INTEL_COMPILER >= 1500
diff --git a/src/corelib/global/qendian.h b/src/corelib/global/qendian.h
index 7c643f7592..0e383c18d2 100644
--- a/src/corelib/global/qendian.h
+++ b/src/corelib/global/qendian.h
@@ -272,9 +272,15 @@ template <> inline qint8 qFromBigEndian<qint8>(const uchar *src)
*/
template <typename T> T qbswap(T source);
+#ifdef __has_builtin
+# define QT_HAS_BUILTIN(x) __has_builtin(x)
+#else
+# define QT_HAS_BUILTIN(x) 0
+#endif
+
// GCC 4.3 implemented all the intrinsics, but the 16-bit one only got implemented in 4.8;
// Clang 2.6 implemented the 32- and 64-bit but waited until 3.2 to implement the 16-bit one
-#if (defined(Q_CC_GNU) && Q_CC_GNU >= 403) || (defined(Q_CC_CLANG) && Q_CC_CLANG >= 206)
+#if (defined(Q_CC_GNU) && Q_CC_GNU >= 403) || QT_HAS_BUILTIN(__builtin_bswap32)
template <> inline quint64 qbswap<quint64>(quint64 source)
{
return __builtin_bswap64(source);
@@ -306,7 +312,7 @@ template <> inline quint32 qbswap<quint32>(quint32 source)
| ((source & 0xff000000) >> 24);
}
#endif // GCC & Clang intrinsics
-#if (defined(Q_CC_GNU) && Q_CC_GNU >= 408) || (defined(Q_CC_CLANG) && Q_CC_CLANG >= 302)
+#if (defined(Q_CC_GNU) && Q_CC_GNU >= 408) || QT_HAS_BUILTIN(__builtin_bswap16)
template <> inline quint16 qbswap<quint16>(quint16 source)
{
return __builtin_bswap16(source);
@@ -320,6 +326,8 @@ template <> inline quint16 qbswap<quint16>(quint16 source)
}
#endif // GCC & Clang intrinsics
+#undef QT_HAS_BUILTIN
+
// signed specializations
template <> inline qint64 qbswap<qint64>(qint64 source)
{
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index cb8bd15d8d..dade7fc6ec 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -37,11 +37,11 @@
#include <stddef.h>
-#define QT_VERSION_STR "5.4.1"
+#define QT_VERSION_STR "5.4.2"
/*
QT_VERSION is (major << 16) + (minor << 8) + patch.
*/
-#define QT_VERSION 0x050401
+#define QT_VERSION 0x050402
/*
can be used like #if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0))
*/
diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp
index 089a915a36..571875c508 100644
--- a/src/corelib/io/qtextstream.cpp
+++ b/src/corelib/io/qtextstream.cpp
@@ -1550,11 +1550,10 @@ QString QTextStream::readAll()
the stream contains lines longer than this, then the lines will be
split after \a maxlen characters and returned in parts.
- If \a maxlen is 0, the lines can be of any length. A common value
- for \a maxlen is 75.
+ If \a maxlen is 0, the lines can be of any length.
The returned line has no trailing end-of-line characters ("\\n"
- or "\\r\\n"), so calling QString::trimmed() is unnecessary.
+ or "\\r\\n"), so calling QString::trimmed() can be unnecessary.
If the stream has read to the end of the file, \l {QTextStream::readLine()}{readLine()}
will return a null QString. For strings, or for devices that support it,
diff --git a/src/corelib/io/qwindowspipewriter_p.h b/src/corelib/io/qwindowspipewriter_p.h
index 47b7744e81..6035993500 100644
--- a/src/corelib/io/qwindowspipewriter_p.h
+++ b/src/corelib/io/qwindowspipewriter_p.h
@@ -45,7 +45,7 @@
// We mean it.
//
-#include <qdatetime.h>
+#include <qelapsedtimer.h>
#include <qthread.h>
#include <qmutex.h>
#include <qwaitcondition.h>
@@ -83,7 +83,7 @@ public:
{
if (totalTimeOut == -1)
return SLEEPMAX;
- return qMax(totalTimeOut - timer.elapsed(), 0);
+ return qMax(int(totalTimeOut - timer.elapsed()), 0);
}
bool hasTimedOut() const
@@ -99,7 +99,7 @@ public:
}
private:
- QTime timer;
+ QElapsedTimer timer;
int totalTimeOut;
int nextSleep;
};
diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp
index 191ceaa37b..85b7f51bd6 100644
--- a/src/corelib/kernel/qcoreevent.cpp
+++ b/src/corelib/kernel/qcoreevent.cpp
@@ -538,7 +538,7 @@ QTimerEvent::~QTimerEvent()
\a child.
\a type can be QEvent::ChildAdded, QEvent::ChildRemoved,
- QEvent::ChildPolished, or QEvent::ChildRemoved.
+ or QEvent::ChildPolished.
\sa child()
*/
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index a1a04b3ce5..f2ceb7081c 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -3710,13 +3710,14 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i
} else if (callFunction && c->method_offset <= receiver->metaObject()->methodOffset()) {
//we compare the vtable to make sure we are not in the destructor of the object.
locker.unlock();
+ const int methodIndex = c->method();
if (qt_signal_spy_callback_set.slot_begin_callback != 0)
- qt_signal_spy_callback_set.slot_begin_callback(receiver, c->method(), argv ? argv : empty_argv);
+ qt_signal_spy_callback_set.slot_begin_callback(receiver, methodIndex, argv ? argv : empty_argv);
callFunction(receiver, QMetaObject::InvokeMetaMethod, method_relative, argv ? argv : empty_argv);
if (qt_signal_spy_callback_set.slot_end_callback != 0)
- qt_signal_spy_callback_set.slot_end_callback(receiver, c->method());
+ qt_signal_spy_callback_set.slot_end_callback(receiver, methodIndex);
locker.relock();
} else {
const int method = method_relative + c->method_offset;
diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp
index 3caad7c4b2..933fd06afa 100644
--- a/src/corelib/thread/qthread.cpp
+++ b/src/corelib/thread/qthread.cpp
@@ -178,7 +178,7 @@ QThreadPrivate::~QThreadPrivate()
event loop by calling exec() and runs a Qt event loop inside the thread.
You can use worker objects by moving them to the thread using
- QObject::moveToThread.
+ QObject::moveToThread().
\snippet code/src_corelib_thread_qthread.cpp worker
@@ -256,7 +256,7 @@ QThreadPrivate::~QThreadPrivate()
\l{Mandelbrot Example}, as that is the name of the QThread subclass).
Note that this is currently not available with release builds on Windows.
- \sa {Thread Support in Qt}, QThreadStorage, {Synchronizing Threads}
+ \sa {Thread Support in Qt}, QThreadStorage, {Synchronizing Threads},
{Mandelbrot Example}, {Semaphores Example}, {Wait Conditions Example}
*/
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp
index a3c1cc3907..bd0215902c 100644
--- a/src/corelib/tools/qbytearray.cpp
+++ b/src/corelib/tools/qbytearray.cpp
@@ -3945,7 +3945,7 @@ QByteArray QByteArray::fromRawData(const char *data, int size)
copies of it exist that have not been modified.
This function can be used instead of fromRawData() to re-use
- existings QByteArray objects to save memory re-allocations.
+ existing QByteArray objects to save memory re-allocations.
\sa fromRawData(), data(), constData()
*/
diff --git a/src/corelib/tools/qbytearraymatcher.cpp b/src/corelib/tools/qbytearraymatcher.cpp
index f14d941c27..82f012be66 100644
--- a/src/corelib/tools/qbytearraymatcher.cpp
+++ b/src/corelib/tools/qbytearraymatcher.cpp
@@ -256,7 +256,7 @@ static int qFindByteArrayBoyerMoore(
#define REHASH(a) \
if (sl_minus_1 < sizeof(uint) * CHAR_BIT) \
- hashHaystack -= (a) << sl_minus_1; \
+ hashHaystack -= uint(a) << sl_minus_1; \
hashHaystack <<= 1
/*!
diff --git a/src/corelib/tools/qfreelist_p.h b/src/corelib/tools/qfreelist_p.h
index bfb03fb723..189140016c 100644
--- a/src/corelib/tools/qfreelist_p.h
+++ b/src/corelib/tools/qfreelist_p.h
@@ -171,7 +171,7 @@ class QFreeList
// take the current serial number from \a o, increment it, and store it in \a n
static inline int incrementserial(int o, int n)
{
- return (n & ConstantsType::IndexMask) | ((o + ConstantsType::SerialCounter) & ConstantsType::SerialMask);
+ return int((uint(n) & ConstantsType::IndexMask) | ((uint(o) + ConstantsType::SerialCounter) & ConstantsType::SerialMask));
}
// the blocks
diff --git a/src/corelib/tools/qmargins.cpp b/src/corelib/tools/qmargins.cpp
index 419551aaca..265e44bfcf 100644
--- a/src/corelib/tools/qmargins.cpp
+++ b/src/corelib/tools/qmargins.cpp
@@ -484,7 +484,7 @@ QDebug operator<<(QDebug dbg, const QMargins &m) {
/*!
\fn bool QMarginsF::isNull() const
- Returns \c true if all margins are is 0; otherwise returns
+ Returns \c true if all margins are 0; otherwise returns
false.
*/
diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h
index 061c7a5a2d..a18b2c28a1 100644
--- a/src/corelib/tools/qsharedpointer_impl.h
+++ b/src/corelib/tools/qsharedpointer_impl.h
@@ -412,6 +412,7 @@ public:
# ifdef QT_SHAREDPOINTER_TRACK_POINTERS
internalSafetyCheckAdd(result.d, result.value);
# endif
+ result.enableSharedFromThis(result.data());
return result;
}
#else
@@ -432,6 +433,7 @@ public:
internalSafetyCheckAdd(result.d, result.value);
# endif
result.d->setQObjectShared(result.value, true);
+ result.enableSharedFromThis(result.data());
return result;
}
diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp
index d1698b812f..ad10c63686 100644
--- a/src/corelib/xml/qxmlstream.cpp
+++ b/src/corelib/xml/qxmlstream.cpp
@@ -728,7 +728,7 @@ static const short QXmlStreamReader_tokenTypeString_indices[] = {
/*!
\property QXmlStreamReader::namespaceProcessing
- the namespace-processing flag of the stream reader
+ The namespace-processing flag of the stream reader
This property controls whether or not the stream reader processes
namespaces. If enabled, the reader processes namespaces, otherwise
@@ -3318,7 +3318,7 @@ QTextCodec *QXmlStreamWriter::codec() const
/*!
\property QXmlStreamWriter::autoFormatting
\since 4.4
- the auto-formatting flag of the stream writer
+ The auto-formatting flag of the stream writer
This property controls whether or not the stream writer
automatically formats the generated XML data. If enabled, the
diff --git a/src/gui/doc/snippets/code/src_gui_image_qpixmap.cpp b/src/gui/doc/snippets/code/src_gui_image_qpixmap.cpp
index f43bba1324..a691c24ce0 100644
--- a/src/gui/doc/snippets/code/src_gui_image_qpixmap.cpp
+++ b/src/gui/doc/snippets/code/src_gui_image_qpixmap.cpp
@@ -48,7 +48,7 @@ static const char * const start_xpm[]={
//! [1]
QPixmap myPixmap;
-myPixmap->setMask(myPixmap->createHeuristicMask());
+myPixmap.setMask(myPixmap.createHeuristicMask());
//! [1]
//! [2]
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index dc5501eaf5..928d0cddc9 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -2578,9 +2578,14 @@ void QGuiApplicationPrivate::reportRefreshRateChange(QWindowSystemInterfacePriva
return;
QScreen *s = e->screen.data();
- s->d_func()->refreshRate = e->rate;
-
- emit s->refreshRateChanged(s->refreshRate());
+ qreal rate = e->rate;
+ // safeguard ourselves against buggy platform behavior...
+ if (rate < 1.0)
+ rate = 60.0;
+ if (!qFuzzyCompare(s->d_func()->refreshRate, rate)) {
+ s->d_func()->refreshRate = rate;
+ emit s->refreshRateChanged(s->refreshRate());
+ }
}
void QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent *e)
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp
index 5918f30660..b663afabbc 100644
--- a/src/gui/kernel/qopenglcontext.cpp
+++ b/src/gui/kernel/qopenglcontext.cpp
@@ -518,8 +518,9 @@ void QOpenGLContext::setScreen(QScreen *screen)
in addition. Therefore \a handle is variant containing a platform-specific
value type. These classes can be found in the QtPlatformHeaders module.
- When create() is called with native handles set, the handles' ownership are
- not taken, meaning that \c destroy() will not destroy the native context.
+ When create() is called with native handles set, QOpenGLContext does not
+ take ownership of the handles, so destroying the QOpenGLContext does not
+ destroy the native context.
\note Some frameworks track the current context and surfaces internally.
Making the adopted QOpenGLContext current via Qt will have no effect on such
@@ -582,8 +583,8 @@ QVariant QOpenGLContext::nativeHandle() const
Returns \c true if the native context was successfully created and is ready to
be used with makeCurrent(), swapBuffers(), etc.
- \note If the context is already created, this function will first call
- \c destroy(), and then create a new OpenGL context.
+ \note If the context already exists, this function destroys the existing
+ context first, and then creates a new one.
\sa makeCurrent(), format()
*/
@@ -605,6 +606,8 @@ bool QOpenGLContext::create()
}
/*!
+ \internal
+
Destroy the underlying platform context associated with this context.
If any other context is directly or indirectly sharing resources with this
@@ -658,8 +661,7 @@ void QOpenGLContext::destroy()
/*!
Destroys the QOpenGLContext object.
- This implicitly calls \c destroy(), so if this is the current context for the
- thread, doneCurrent() is also called.
+ If this is the current context for the thread, doneCurrent() is also called.
*/
QOpenGLContext::~QOpenGLContext()
{
diff --git a/src/gui/kernel/qscreen_p.h b/src/gui/kernel/qscreen_p.h
index cdb923c429..53d4f3404a 100644
--- a/src/gui/kernel/qscreen_p.h
+++ b/src/gui/kernel/qscreen_p.h
@@ -64,6 +64,9 @@ public:
availableGeometry = platformScreen->availableGeometry();
logicalDpi = platformScreen->logicalDpi();
refreshRate = platformScreen->refreshRate();
+ // safeguard ourselves against buggy platform behavior...
+ if (refreshRate < 1.0)
+ refreshRate = 60.0;
updatePrimaryOrientation();
diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri
index a5a395cce2..579c0bc2a9 100644
--- a/src/gui/painting/painting.pri
+++ b/src/gui/painting/painting.pri
@@ -13,6 +13,7 @@ HEADERS += \
painting/qdrawhelper_x86_p.h \
painting/qdrawingprimitive_sse2_p.h \
painting/qemulationpaintengine_p.h \
+ painting/qfixed_p.h \
painting/qgrayraster_p.h \
painting/qmatrix.h \
painting/qmemrotate_p.h \
diff --git a/src/gui/painting/qfixed_p.h b/src/gui/painting/qfixed_p.h
index 69a7b06780..a0ac69f02f 100644
--- a/src/gui/painting/qfixed_p.h
+++ b/src/gui/painting/qfixed_p.h
@@ -56,10 +56,10 @@ private:
Q_DECL_CONSTEXPR QFixed(int val, int) : val(val) {} // 2nd int is just a dummy for disambiguation
public:
Q_DECL_CONSTEXPR QFixed() : val(0) {}
- Q_DECL_CONSTEXPR QFixed(int i) : val(i<<6) {}
- Q_DECL_CONSTEXPR QFixed(long i) : val(i<<6) {}
- QFixed &operator=(int i) { val = (i<<6); return *this; }
- QFixed &operator=(long i) { val = (i<<6); return *this; }
+ Q_DECL_CONSTEXPR QFixed(int i) : val(i * 64) {}
+ Q_DECL_CONSTEXPR QFixed(long i) : val(i * 64) {}
+ QFixed &operator=(int i) { val = i * 64; return *this; }
+ QFixed &operator=(long i) { val = i * 64; return *this; }
Q_DECL_CONSTEXPR static QFixed fromReal(qreal r) { return fromFixed((int)(r*qreal(64))); }
Q_DECL_CONSTEXPR static QFixed fromFixed(int fixed) { return QFixed(fixed,0); } // uses private ctor
@@ -70,21 +70,21 @@ public:
Q_DECL_CONSTEXPR inline int toInt() const { return (((val)+32) & -64)>>6; }
Q_DECL_CONSTEXPR inline qreal toReal() const { return ((qreal)val)/(qreal)64; }
- Q_DECL_CONSTEXPR inline int truncate() const { return val>>6; }
+ Q_DECL_CONSTEXPR inline int truncate() const { return val / 64; }
Q_DECL_CONSTEXPR inline QFixed round() const { return fromFixed(((val)+32) & -64); }
Q_DECL_CONSTEXPR inline QFixed floor() const { return fromFixed((val) & -64); }
Q_DECL_CONSTEXPR inline QFixed ceil() const { return fromFixed((val+63) & -64); }
- Q_DECL_CONSTEXPR inline QFixed operator+(int i) const { return fromFixed((val + (i<<6))); }
+ Q_DECL_CONSTEXPR inline QFixed operator+(int i) const { return fromFixed(val + i * 64); }
Q_DECL_CONSTEXPR inline QFixed operator+(uint i) const { return fromFixed((val + (i<<6))); }
Q_DECL_CONSTEXPR inline QFixed operator+(const QFixed &other) const { return fromFixed((val + other.val)); }
- inline QFixed &operator+=(int i) { val += (i<<6); return *this; }
+ inline QFixed &operator+=(int i) { val += i * 64; return *this; }
inline QFixed &operator+=(uint i) { val += (i<<6); return *this; }
inline QFixed &operator+=(const QFixed &other) { val += other.val; return *this; }
- Q_DECL_CONSTEXPR inline QFixed operator-(int i) const { return fromFixed((val - (i<<6))); }
+ Q_DECL_CONSTEXPR inline QFixed operator-(int i) const { return fromFixed(val - i * 64); }
Q_DECL_CONSTEXPR inline QFixed operator-(uint i) const { return fromFixed((val - (i<<6))); }
Q_DECL_CONSTEXPR inline QFixed operator-(const QFixed &other) const { return fromFixed((val - other.val)); }
- inline QFixed &operator-=(int i) { val -= (i<<6); return *this; }
+ inline QFixed &operator-=(int i) { val -= i * 64; return *this; }
inline QFixed &operator-=(uint i) { val -= (i<<6); return *this; }
inline QFixed &operator-=(const QFixed &other) { val -= other.val; return *this; }
Q_DECL_CONSTEXPR inline QFixed operator-() const { return fromFixed(-val); }
@@ -162,18 +162,18 @@ Q_DECL_CONSTEXPR inline QFixed operator+(uint i, const QFixed &d) { return d+i;
Q_DECL_CONSTEXPR inline QFixed operator-(uint i, const QFixed &d) { return -(d-i); }
// Q_DECL_CONSTEXPR inline QFixed operator*(qreal d, const QFixed &d2) { return d2*d; }
-Q_DECL_CONSTEXPR inline bool operator==(const QFixed &f, int i) { return f.value() == (i<<6); }
-Q_DECL_CONSTEXPR inline bool operator==(int i, const QFixed &f) { return f.value() == (i<<6); }
-Q_DECL_CONSTEXPR inline bool operator!=(const QFixed &f, int i) { return f.value() != (i<<6); }
-Q_DECL_CONSTEXPR inline bool operator!=(int i, const QFixed &f) { return f.value() != (i<<6); }
-Q_DECL_CONSTEXPR inline bool operator<=(const QFixed &f, int i) { return f.value() <= (i<<6); }
-Q_DECL_CONSTEXPR inline bool operator<=(int i, const QFixed &f) { return (i<<6) <= f.value(); }
-Q_DECL_CONSTEXPR inline bool operator>=(const QFixed &f, int i) { return f.value() >= (i<<6); }
-Q_DECL_CONSTEXPR inline bool operator>=(int i, const QFixed &f) { return (i<<6) >= f.value(); }
-Q_DECL_CONSTEXPR inline bool operator<(const QFixed &f, int i) { return f.value() < (i<<6); }
-Q_DECL_CONSTEXPR inline bool operator<(int i, const QFixed &f) { return (i<<6) < f.value(); }
-Q_DECL_CONSTEXPR inline bool operator>(const QFixed &f, int i) { return f.value() > (i<<6); }
-Q_DECL_CONSTEXPR inline bool operator>(int i, const QFixed &f) { return (i<<6) > f.value(); }
+Q_DECL_CONSTEXPR inline bool operator==(const QFixed &f, int i) { return f.value() == i * 64; }
+Q_DECL_CONSTEXPR inline bool operator==(int i, const QFixed &f) { return f.value() == i * 64; }
+Q_DECL_CONSTEXPR inline bool operator!=(const QFixed &f, int i) { return f.value() != i * 64; }
+Q_DECL_CONSTEXPR inline bool operator!=(int i, const QFixed &f) { return f.value() != i * 64; }
+Q_DECL_CONSTEXPR inline bool operator<=(const QFixed &f, int i) { return f.value() <= i * 64; }
+Q_DECL_CONSTEXPR inline bool operator<=(int i, const QFixed &f) { return i * 64 <= f.value(); }
+Q_DECL_CONSTEXPR inline bool operator>=(const QFixed &f, int i) { return f.value() >= i * 64; }
+Q_DECL_CONSTEXPR inline bool operator>=(int i, const QFixed &f) { return i * 64 >= f.value(); }
+Q_DECL_CONSTEXPR inline bool operator<(const QFixed &f, int i) { return f.value() < i * 64; }
+Q_DECL_CONSTEXPR inline bool operator<(int i, const QFixed &f) { return i * 64 < f.value(); }
+Q_DECL_CONSTEXPR inline bool operator>(const QFixed &f, int i) { return f.value() > i * 64; }
+Q_DECL_CONSTEXPR inline bool operator>(int i, const QFixed &f) { return i * 64 > f.value(); }
#ifndef QT_NO_DEBUG_STREAM
inline QDebug &operator<<(QDebug &dbg, const QFixed &f)
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 99814dba82..fcdb6ecca9 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -382,7 +382,7 @@ void QtFontFamily::ensurePopulated()
return;
QGuiApplicationPrivate::platformIntegration()->fontDatabase()->populateFamily(name);
- Q_ASSERT(populated);
+ Q_ASSERT_X(populated, Q_FUNC_INFO, qPrintable(name));
}
class QFontDatabasePrivate
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 13bfa2386d..8f874e0245 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1237,6 +1237,15 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, const ushort *st
}
#ifdef Q_OS_MAC
+ // CTRunGetPosition has a bug which applies matrix on 10.6, so we disable
+ // scaling the advances for this particular version
+ if (actualFontEngine->fontDef.stretch != 100
+ && QSysInfo::MacintoshVersion != QSysInfo::MV_10_6) {
+ QFixed stretch = QFixed(actualFontEngine->fontDef.stretch) / QFixed(100);
+ for (uint i = 0; i < num_glyphs; ++i)
+ g.advances[i] *= stretch;
+ }
+
if (actualFontEngine->fontDef.styleStrategy & QFont::ForceIntegerMetrics) {
for (uint i = 0; i < num_glyphs; ++i)
g.advances[i] = g.advances[i].round();
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index cecfd85df1..0bffbcc802 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -319,7 +319,7 @@ uint QTextFormatPrivate::recalcHash() const
{
hashValue = 0;
for (QVector<Property>::ConstIterator it = props.constBegin(); it != props.constEnd(); ++it)
- hashValue += (it->key << 16) + variantHash(it->value);
+ hashValue += (static_cast<quint32>(it->key) << 16) + variantHash(it->value);
hashDirty = false;
@@ -1904,7 +1904,7 @@ void QTextCharFormat::setFont(const QFont &font)
If \a behavior is QTextCharFormat::FontPropertiesAll, the font property that
has not been explicitly set is treated like as it were set with default value;
- If \a behavior is QTextCharFormat::FontPropertiesAll, the font property that
+ If \a behavior is QTextCharFormat::FontPropertiesSpecifiedOnly, the font property that
has not been explicitly set is ignored and the respective property value
remains unchanged.
@@ -1942,7 +1942,7 @@ void QTextCharFormat::setFont(const QFont &font, FontPropertiesInheritanceBehavi
setFontFixedPitch(font.fixedPitch());
if (mask & QFont::CapitalizationResolved)
setFontCapitalization(font.capitalization());
- if (mask & QFont::LetterSpacingResolved)
+ if (mask & QFont::WordSpacingResolved)
setFontWordSpacing(font.wordSpacing());
if (mask & QFont::LetterSpacingResolved) {
setFontLetterSpacingType(font.letterSpacingType());
diff --git a/src/network/access/qnetworkreply.cpp b/src/network/access/qnetworkreply.cpp
index 18ff05fcd7..fe9564a91c 100644
--- a/src/network/access/qnetworkreply.cpp
+++ b/src/network/access/qnetworkreply.cpp
@@ -605,7 +605,7 @@ QList<QByteArray> QNetworkReply::rawHeaderList() const
/*!
Returns the attribute associated with the code \a code. If the
- attribute has not been set, it returns an invalid QVariant (type QMetaType::Unknown).
+ attribute has not been set, it returns an invalid QVariant (type QMetaType::UnknownType).
You can expect the default values listed in
QNetworkRequest::Attribute to be applied to the values returned by
diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp
index 604214ce8e..5a1ad40b90 100644
--- a/src/network/socket/qabstractsocket.cpp
+++ b/src/network/socket/qabstractsocket.cpp
@@ -740,8 +740,15 @@ bool QAbstractSocketPrivate::canReadNotification()
return true;
}
- if ((isBuffered || socketType != QAbstractSocket::TcpSocket) && socketEngine)
- socketEngine->setReadNotificationEnabled(readBufferMaxSize == 0 || readBufferMaxSize > q->bytesAvailable());
+ if (socketEngine) {
+ // turn the socket engine off if we've either:
+ // - got pending datagrams
+ // - reached the buffer size limit
+ if (isBuffered)
+ socketEngine->setReadNotificationEnabled(readBufferMaxSize == 0 || readBufferMaxSize > q->bytesAvailable());
+ else if (socketType != QAbstractSocket::TcpSocket)
+ socketEngine->setReadNotificationEnabled(!socketEngine->hasPendingDatagrams());
+ }
// reset the read socket notifier state if we reentered inside the
// readyRead() connected slot.
diff --git a/src/network/ssl/qsslconfiguration.cpp b/src/network/ssl/qsslconfiguration.cpp
index 7bb6e02b7e..55c9a281ba 100644
--- a/src/network/ssl/qsslconfiguration.cpp
+++ b/src/network/ssl/qsslconfiguration.cpp
@@ -512,6 +512,7 @@ QSslCipher QSslConfiguration::sessionCipher() const
is set during the handshake phase.
\sa protocol(), setProtocol()
+ \since 5.4
*/
QSsl::SslProtocol QSslConfiguration::sessionProtocol() const
{
diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp
index 0f7c376e04..c0c15fb5b1 100644
--- a/src/network/ssl/qsslsocket.cpp
+++ b/src/network/ssl/qsslsocket.cpp
@@ -1081,6 +1081,7 @@ QSslCipher QSslSocket::sessionCipher() const
is set during the handshake phase.
\sa protocol(), setProtocol()
+ \since 5.4
*/
QSsl::SslProtocol QSslSocket::sessionProtocol() const
{
diff --git a/src/platformsupport/fbconvenience/qfbbackingstore.cpp b/src/platformsupport/fbconvenience/qfbbackingstore.cpp
index 0fa23ebe02..733235ff42 100644
--- a/src/platformsupport/fbconvenience/qfbbackingstore.cpp
+++ b/src/platformsupport/fbconvenience/qfbbackingstore.cpp
@@ -69,5 +69,30 @@ void QFbBackingStore::resize(const QSize &size, const QRegion &staticContents)
mImage = QImage(size, window()->screen()->handle()->format());
}
+const QImage QFbBackingStore::image()
+{
+ return mImage;
+}
+
+void QFbBackingStore::lock()
+{
+ mImageMutex.lock();
+}
+
+void QFbBackingStore::unlock()
+{
+ mImageMutex.unlock();
+}
+
+void QFbBackingStore::beginPaint(const QRegion &)
+{
+ lock();
+}
+
+void QFbBackingStore::endPaint()
+{
+ unlock();
+}
+
QT_END_NAMESPACE
diff --git a/src/platformsupport/fbconvenience/qfbbackingstore_p.h b/src/platformsupport/fbconvenience/qfbbackingstore_p.h
index 08a4b37eee..a9917e1450 100644
--- a/src/platformsupport/fbconvenience/qfbbackingstore_p.h
+++ b/src/platformsupport/fbconvenience/qfbbackingstore_p.h
@@ -46,6 +46,7 @@
//
#include <qpa/qplatformbackingstore.h>
+#include <QtCore/QMutex>
QT_BEGIN_NAMESPACE
@@ -64,12 +65,19 @@ public:
virtual void resize(const QSize &size, const QRegion &region);
- const QImage image() { return mImage; }
+ const QImage image();
+
+ void lock();
+ void unlock();
+
+ void beginPaint(const QRegion &);
+ void endPaint();
protected:
friend class QFbWindow;
QImage mImage;
+ QMutex mImageMutex;
};
QT_END_NAMESPACE
diff --git a/src/platformsupport/fbconvenience/qfbscreen.cpp b/src/platformsupport/fbconvenience/qfbscreen.cpp
index aa35825be0..13341344d8 100644
--- a/src/platformsupport/fbconvenience/qfbscreen.cpp
+++ b/src/platformsupport/fbconvenience/qfbscreen.cpp
@@ -37,11 +37,15 @@
#include "qfbbackingstore_p.h"
#include <QtGui/QPainter>
+#include <QtCore/QCoreApplication>
#include <qpa/qwindowsysteminterface.h>
+#include <QtCore/QDebug>
+#include <QtCore/QElapsedTimer>
+
QT_BEGIN_NAMESPACE
-QFbScreen::QFbScreen() : mCursor(0), mGeometry(), mDepth(16), mFormat(QImage::Format_RGB16), mScreenImage(0), mCompositePainter(0), mIsUpToDate(false)
+QFbScreen::QFbScreen() : mUpdatePending(false), mCursor(0), mGeometry(), mDepth(16), mFormat(QImage::Format_RGB16), mScreenImage(0), mCompositePainter(0), mIsUpToDate(false)
{
}
@@ -54,10 +58,17 @@ QFbScreen::~QFbScreen()
void QFbScreen::initializeCompositor()
{
mScreenImage = new QImage(mGeometry.size(), mFormat);
+ scheduleUpdate();
+}
- mRedrawTimer.setSingleShot(true);
- mRedrawTimer.setInterval(0);
- connect(&mRedrawTimer, SIGNAL(timeout()), this, SLOT(doRedraw()));
+bool QFbScreen::event(QEvent *event)
+{
+ if (event->type() == QEvent::UpdateRequest) {
+ doRedraw();
+ mUpdatePending = false;
+ return true;
+ }
+ return QObject::event(event);
}
void QFbScreen::addWindow(QFbWindow *window)
@@ -146,8 +157,10 @@ void QFbScreen::setDirty(const QRect &rect)
void QFbScreen::scheduleUpdate()
{
- if (!mRedrawTimer.isActive())
- mRedrawTimer.start();
+ if (!mUpdatePending) {
+ mUpdatePending = true;
+ QCoreApplication::postEvent(this, new QEvent(QEvent::UpdateRequest));
+ }
}
void QFbScreen::setPhysicalSize(const QSize &size)
@@ -246,12 +259,19 @@ QRegion QFbScreen::doRedraw()
continue;
// if (mWindowStack[layerIndex]->isMinimized())
// continue;
+
QRect windowRect = mWindowStack[layerIndex]->geometry().translated(-screenOffset);
QRect windowIntersect = rect.translated(-windowRect.left(),
-windowRect.top());
+
+
QFbBackingStore *backingStore = mWindowStack[layerIndex]->backingStore();
- if (backingStore)
+
+ if (backingStore) {
+ backingStore->lock();
mCompositePainter->drawImage(rect, backingStore->image(), windowIntersect);
+ backingStore->unlock();
+ }
if (firstLayer) {
firstLayer = false;
}
@@ -272,7 +292,6 @@ QRegion QFbScreen::doRedraw()
// qDebug() << "QFbScreen::doRedraw" << mWindowStack.size() << mScreenImage->size() << touchedRegion;
-
return touchedRegion;
}
diff --git a/src/platformsupport/fbconvenience/qfbscreen_p.h b/src/platformsupport/fbconvenience/qfbscreen_p.h
index b6e50dc786..55aacab9bc 100644
--- a/src/platformsupport/fbconvenience/qfbscreen_p.h
+++ b/src/platformsupport/fbconvenience/qfbscreen_p.h
@@ -94,10 +94,11 @@ protected slots:
protected:
void initializeCompositor();
+ bool event(QEvent *event);
QList<QFbWindow *> mWindowStack;
QRegion mRepaintRegion;
- QTimer mRedrawTimer;
+ bool mUpdatePending;
QFbCursor *mCursor;
QRect mGeometry;
diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
index 5a6c5de0b4..fe408305e0 100644
--- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
+++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm
@@ -370,6 +370,8 @@ void QCoreTextFontDatabase::releaseHandle(void *handle)
CFRelease(CTFontDescriptorRef(handle));
}
+extern CGAffineTransform qt_transform_from_fontdef(const QFontDef &fontDef);
+
QFontEngine *QCoreTextFontDatabase::fontEngine(const QFontDef &f, void *usrPtr)
{
qreal scaledPointSize = f.pixelSize;
@@ -384,7 +386,8 @@ QFontEngine *QCoreTextFontDatabase::fontEngine(const QFontDef &f, void *usrPtr)
scaledPointSize = f.pointSize;
CTFontDescriptorRef descriptor = (CTFontDescriptorRef) usrPtr;
- CTFontRef font = CTFontCreateWithFontDescriptor(descriptor, scaledPointSize, NULL);
+ CGAffineTransform matrix = qt_transform_from_fontdef(f);
+ CTFontRef font = CTFontCreateWithFontDescriptor(descriptor, scaledPointSize, &matrix);
if (font) {
QFontEngine *engine = new QCoreTextFontEngine(font, f);
engine->fontDef = f;
diff --git a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp
index c3573489e9..c5de6ee533 100644
--- a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp
+++ b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp
@@ -1047,6 +1047,8 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event)
}
break;
}
+ case QAccessible::SelectionAdd:
+ case QAccessible::SelectionRemove:
case QAccessible::Selection: {
QAccessibleInterface * iface = event->accessibleInterface();
if (!iface) {
@@ -1104,7 +1106,6 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event)
case QAccessible::ParentChanged:
case QAccessible::DialogStart:
case QAccessible::DialogEnd:
- case QAccessible::SelectionRemove:
case QAccessible::PopupMenuStart:
case QAccessible::PopupMenuEnd:
case QAccessible::SoundPlayed:
@@ -1146,7 +1147,6 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event)
case QAccessible::TextAttributeChanged:
case QAccessible::TextColumnChanged:
case QAccessible::VisibleDataChanged:
- case QAccessible::SelectionAdd:
case QAccessible::SelectionWithin:
case QAccessible::LocationChanged:
case QAccessible::HelpChanged:
diff --git a/src/platformsupport/linuxaccessibility/linuxaccessibility.pri b/src/platformsupport/linuxaccessibility/linuxaccessibility.pri
index 1d51d2876c..1b65fb1cad 100644
--- a/src/platformsupport/linuxaccessibility/linuxaccessibility.pri
+++ b/src/platformsupport/linuxaccessibility/linuxaccessibility.pri
@@ -2,7 +2,6 @@ contains(QT_CONFIG, accessibility-atspi-bridge) {
QT_FOR_PRIVATE += dbus
include(../../3rdparty/atspi2/atspi2.pri)
- include(../accessibility/accessibility.pri)
INCLUDEPATH += $$PWD
diff --git a/src/plugins/platforms/android/android.pro b/src/plugins/platforms/android/android.pro
index 3c3a4b4b2e..3ba817bf5b 100644
--- a/src/plugins/platforms/android/android.pro
+++ b/src/plugins/platforms/android/android.pro
@@ -8,12 +8,7 @@ DEFINES += QT_STATICPLUGIN
load(qt_plugin)
-!contains(ANDROID_PLATFORM, android-9) {
- INCLUDEPATH += $$NDK_ROOT/platforms/android-9/arch-$$ANDROID_ARCHITECTURE/usr/include
- LIBS += -L$$NDK_ROOT/platforms/android-9/arch-$$ANDROID_ARCHITECTURE/usr/lib -ljnigraphics -landroid
-} else {
- LIBS += -ljnigraphics -landroid
-}
+LIBS += -ljnigraphics -landroid
QT += core-private gui-private platformsupport-private
@@ -54,7 +49,7 @@ SOURCES += $$PWD/androidplatformplugin.cpp \
$$PWD/qandroideventdispatcher.cpp
HEADERS += $$PWD/qandroidplatformintegration.h \
- $$PWD/androidandroiddeadlockprotector.h \
+ $$PWD/androiddeadlockprotector.h \
$$PWD/androidjnimain.h \
$$PWD/androidjniaccessibility.h \
$$PWD/androidjniinput.h \
diff --git a/src/plugins/platforms/windows/qtwindows_additional.h b/src/plugins/platforms/windows/qtwindows_additional.h
index 9451b9ce55..4e77350132 100644
--- a/src/plugins/platforms/windows/qtwindows_additional.h
+++ b/src/plugins/platforms/windows/qtwindows_additional.h
@@ -166,4 +166,8 @@ typedef TOUCHINPUT const * PCTOUCHINPUT;
#endif // if defined(Q_CC_MINGW) || !defined(TOUCHEVENTF_MOVE)
+#ifndef WM_GESTURE
+# define WM_GESTURE 0x0119
+#endif
+
#endif // QTWINDOWS_ADDITIONAL_H
diff --git a/src/plugins/platforms/windows/qtwindowsglobal.h b/src/plugins/platforms/windows/qtwindowsglobal.h
index 90e6d6ab9d..083d82ed8c 100644
--- a/src/plugins/platforms/windows/qtwindowsglobal.h
+++ b/src/plugins/platforms/windows/qtwindowsglobal.h
@@ -109,6 +109,7 @@ enum WindowsEventType // Simplify event types
DisplayChangedEvent = 437,
SettingChangedEvent = DisplayChangedEvent + 1,
ContextMenu = 123,
+ GestureEvent = 124,
UnknownEvent = 542
};
@@ -247,6 +248,8 @@ inline QtWindows::WindowsEventType windowsEventType(UINT message, WPARAM wParamI
case WM_APPCOMMAND:
return QtWindows::AppCommandEvent;
#endif
+ case WM_GESTURE:
+ return QtWindows::GestureEvent;
default:
break;
}
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index ffa7f82d8e..c253a9605b 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -430,7 +430,7 @@ void QWindowsContext::setKeyGrabber(QWindow *w)
// Window class registering code (from qapplication_win.cpp)
-QString QWindowsContext::registerWindowClass(const QWindow *w, bool isGL)
+QString QWindowsContext::registerWindowClass(const QWindow *w)
{
Q_ASSERT(w);
const Qt::WindowFlags flags = w->flags();
@@ -438,7 +438,9 @@ QString QWindowsContext::registerWindowClass(const QWindow *w, bool isGL)
// Determine style and icon.
uint style = CS_DBLCLKS;
bool icon = true;
- if (isGL || (flags & Qt::MSWindowsOwnDC))
+ // The following will not set CS_OWNDC for any widget window, even if it contains a
+ // QOpenGLWidget or QQuickWidget later on. That cannot be detected at this stage.
+ if (w->surfaceType() == QSurface::OpenGLSurface || (flags & Qt::MSWindowsOwnDC))
style |= CS_OWNDC;
if (!(flags & Qt::NoDropShadowWindowHint) && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)
&& (type == Qt::Popup || w->property("_q_windowsDropShadow").toBool())) {
@@ -471,8 +473,6 @@ QString QWindowsContext::registerWindowClass(const QWindow *w, bool isGL)
default:
break;
}
- if (isGL)
- cname += QStringLiteral("GL");
if (style & CS_DROPSHADOW)
cname += QStringLiteral("DropShadow");
if (style & CS_SAVEBITS)
@@ -905,6 +905,8 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
return QWindowsInputContext::instance()->endComposition(hwnd);
case QtWindows::InputMethodRequest:
return QWindowsInputContext::instance()->handleIME_Request(wParam, lParam, result);
+ case QtWindows::GestureEvent:
+ return d->m_mouseHandler.translateTouchEvent(platformWindow->window(), hwnd, et, msg, result);
case QtWindows::InputMethodOpenCandidateWindowEvent:
case QtWindows::InputMethodCloseCandidateWindowEvent:
// TODO: Release/regrab mouse if a popup has mouse grab.
diff --git a/src/plugins/platforms/windows/qwindowscontext.h b/src/plugins/platforms/windows/qwindowscontext.h
index 28202219d6..5c2e21192b 100644
--- a/src/plugins/platforms/windows/qwindowscontext.h
+++ b/src/plugins/platforms/windows/qwindowscontext.h
@@ -161,7 +161,7 @@ public:
int defaultDPI() const;
- QString registerWindowClass(const QWindow *w, bool isGL);
+ QString registerWindowClass(const QWindow *w);
QString registerWindowClass(QString cname, WNDPROC proc,
unsigned style = 0, HBRUSH brush = 0,
bool icon = false);
diff --git a/src/plugins/platforms/windows/qwindowscursor.cpp b/src/plugins/platforms/windows/qwindowscursor.cpp
index d10c7fdb20..9a42b7712d 100644
--- a/src/plugins/platforms/windows/qwindowscursor.cpp
+++ b/src/plugins/platforms/windows/qwindowscursor.cpp
@@ -126,13 +126,15 @@ HCURSOR QWindowsCursor::createPixmapCursor(const QPixmap &pixmap, const QPoint &
// Create a cursor from image and mask of the format QImage::Format_Mono.
static HCURSOR createBitmapCursor(const QImage &bbits, const QImage &mbits,
- QPoint hotSpot = QPoint(),
+ QPoint hotSpot = QPoint(-1, -1),
bool invb = false, bool invm = false)
{
const int width = bbits.width();
const int height = bbits.height();
- if (hotSpot.isNull())
- hotSpot = QPoint(width / 2, height / 2);
+ if (hotSpot.x() < 0)
+ hotSpot.setX(width / 2);
+ if (hotSpot.y() < 0)
+ hotSpot.setY(height / 2);
const int n = qMax(1, width / 8);
#if !defined(Q_OS_WINCE)
QScopedArrayPointer<uchar> xBits(new uchar[height * n]);
diff --git a/src/plugins/platforms/windows/qwindowseglcontext.cpp b/src/plugins/platforms/windows/qwindowseglcontext.cpp
index 7f0421ad90..f52c5b733c 100644
--- a/src/plugins/platforms/windows/qwindowseglcontext.cpp
+++ b/src/plugins/platforms/windows/qwindowseglcontext.cpp
@@ -64,7 +64,7 @@ QT_BEGIN_NAMESPACE
QWindowsLibEGL QWindowsEGLStaticContext::libEGL;
QWindowsLibGLESv2 QWindowsEGLStaticContext::libGLESv2;
-#ifndef QT_STATIC
+#if !defined(QT_STATIC) || defined(QT_OPENGL_DYNAMIC)
#ifdef Q_CC_MINGW
static void *resolveFunc(HMODULE lib, const char *name)
@@ -111,7 +111,7 @@ void *QWindowsLibEGL::resolve(const char *name)
#endif // !QT_STATIC
-#ifndef QT_STATIC
+#if !defined(QT_STATIC) || defined(QT_OPENGL_DYNAMIC)
# define RESOLVE(signature, name) signature(resolve( #name ));
#else
# define RESOLVE(signature, name) signature(&::name);
@@ -127,7 +127,7 @@ bool QWindowsLibEGL::init()
qCDebug(lcQpaGl) << "Qt: Using EGL from" << dllName;
-#ifndef QT_STATIC
+#if !defined(QT_STATIC) || defined(QT_OPENGL_DYNAMIC)
m_lib = ::LoadLibraryW((const wchar_t *) QString::fromLatin1(dllName).utf16());
if (!m_lib) {
qErrnoWarning(::GetLastError(), "Failed to load %s", dllName);
@@ -159,7 +159,7 @@ bool QWindowsLibEGL::init()
return eglGetError && eglGetDisplay && eglInitialize;
}
-#ifndef QT_STATIC
+#if !defined(QT_STATIC) || defined(QT_OPENGL_DYNAMIC)
void *QWindowsLibGLESv2::resolve(const char *name)
{
void *proc = m_lib ? resolveFunc(m_lib, name) : 0;
@@ -179,7 +179,7 @@ bool QWindowsLibGLESv2::init()
#endif
qCDebug(lcQpaGl) << "Qt: Using OpenGL ES 2.0 from" << dllName;
-#ifndef QT_STATIC
+#if !defined(QT_STATIC) || defined(QT_OPENGL_DYNAMIC)
m_lib = ::LoadLibraryW((const wchar_t *) QString::fromLatin1(dllName).utf16());
if (!m_lib) {
qErrnoWarning(::GetLastError(), "Failed to load %s", dllName);
@@ -577,6 +577,7 @@ bool QWindowsEGLContext::makeCurrent(QPlatformSurface *surface)
QWindowsEGLStaticContext::libEGL.eglBindAPI(m_api);
QWindowsWindow *window = static_cast<QWindowsWindow *>(surface);
+ window->aboutToMakeCurrent();
EGLSurface eglSurface = static_cast<EGLSurface>(window->surface(m_eglConfig));
Q_ASSERT(eglSurface);
diff --git a/src/plugins/platforms/windows/qwindowseglcontext.h b/src/plugins/platforms/windows/qwindowseglcontext.h
index 45ccbfb734..c2b153e4c1 100644
--- a/src/plugins/platforms/windows/qwindowseglcontext.h
+++ b/src/plugins/platforms/windows/qwindowseglcontext.h
@@ -75,7 +75,7 @@ struct QWindowsLibEGL
__eglMustCastToProperFunctionPointerType (EGLAPIENTRY * eglGetProcAddress)(const char *procname);
private:
-#ifndef QT_STATIC
+#if !defined(QT_STATIC) || defined(QT_OPENGL_DYNAMIC)
void *resolve(const char *name);
HMODULE m_lib;
#endif
@@ -84,7 +84,8 @@ private:
struct QWindowsLibGLESv2
{
bool init();
-#ifndef QT_STATIC
+
+#if !defined(QT_STATIC) || defined(QT_OPENGL_DYNAMIC)
void *moduleHandle() const { return m_lib; }
#else
void *moduleHandle() const { return Q_NULLPTR; }
@@ -239,7 +240,7 @@ struct QWindowsLibGLESv2
void (APIENTRY * glDepthRangef)(GLclampf nearVal, GLclampf farVal);
private:
-#ifndef QT_STATIC
+#if !defined(QT_STATIC) || defined(QT_OPENGL_DYNAMIC)
void *resolve(const char *name);
HMODULE m_lib;
#endif
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
index f15783490e..246032dc94 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp
@@ -964,31 +964,6 @@ static int QT_WIN_CALLBACK storeFont(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *textmetr
return 1;
}
-static int QT_WIN_CALLBACK storeFontSub(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *textmetric,
- int type, LPARAM namesSetIn)
-{
- Q_UNUSED(textmetric)
- Q_UNUSED(type)
-
- HDC dummy = GetDC(0);
- LOGFONT lf;
- lf.lfCharSet = DEFAULT_CHARSET;
- if (wcslen(f->elfLogFont.lfFaceName) >= LF_FACESIZE) {
- qWarning("%s: Unable to enumerate family '%s'.",
- __FUNCTION__, qPrintable(QString::fromWCharArray(f->elfLogFont.lfFaceName)));
- return 1;
- }
- wmemcpy(lf.lfFaceName, f->elfLogFont.lfFaceName,
- wcslen(f->elfLogFont.lfFaceName) + 1);
- lf.lfPitchAndFamily = 0;
- EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFont,
- (LPARAM)namesSetIn, 0);
- ReleaseDC(0, dummy);
-
- // keep on enumerating
- return 1;
-}
-
void QWindowsFontDatabase::populateFontDatabase()
{
m_families.clear();
@@ -1024,15 +999,8 @@ void QWindowsFontDatabase::populate(const QString &family)
wmemcpy(lf.lfFaceName, reinterpret_cast<const wchar_t*>(family.utf16()),
family.size() + 1);
lf.lfPitchAndFamily = 0;
-
- if (family.isEmpty()) {
- EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFontSub,
- (LPARAM)&m_families, 0);
- } else {
- EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFont,
- (LPARAM)&m_families, 0);
- }
-
+ EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFont,
+ (LPARAM)&m_families, 0);
ReleaseDC(0, dummy);
}
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
index 42e5a8c6ad..0fc5e0dc0c 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
@@ -375,31 +375,6 @@ static int QT_WIN_CALLBACK storeFont(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *textmetr
return 1;
}
-static int QT_WIN_CALLBACK storeFontSub(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *textmetric,
- int type, LPARAM namesSetIn)
-{
- Q_UNUSED(textmetric)
- Q_UNUSED(type)
-
- HDC dummy = GetDC(0);
- LOGFONT lf;
- lf.lfCharSet = DEFAULT_CHARSET;
- if (wcslen(f->elfLogFont.lfFaceName) >= LF_FACESIZE) {
- qWarning("%s: Unable to enumerate family '%s'.",
- __FUNCTION__, qPrintable(QString::fromWCharArray(f->elfLogFont.lfFaceName)));
- return 1;
- }
- wmemcpy(lf.lfFaceName, f->elfLogFont.lfFaceName,
- wcslen(f->elfLogFont.lfFaceName) + 1);
- lf.lfPitchAndFamily = 0;
- EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFont,
- (LPARAM)namesSetIn, 0);
- ReleaseDC(0, dummy);
-
- // keep on enumerating
- return 1;
-}
-
void QWindowsFontDatabaseFT::populateFontDatabase()
{
m_families.clear();
@@ -434,15 +409,8 @@ void QWindowsFontDatabaseFT::populate(const QString &family)
wmemcpy(lf.lfFaceName, reinterpret_cast<const wchar_t*>(family.utf16()),
family.size() + 1);
lf.lfPitchAndFamily = 0;
-
- if (family.isEmpty()) {
- EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFontSub,
- (LPARAM)&m_families, 0);
- } else {
- EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFont,
- (LPARAM)&m_families, 0);
- }
-
+ EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFont,
+ (LPARAM)&m_families, 0);
ReleaseDC(0, dummy);
}
diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp
index 0e3e6826ec..3348241d37 100644
--- a/src/plugins/platforms/windows/qwindowsglcontext.cpp
+++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp
@@ -1267,6 +1267,7 @@ bool QWindowsGLContext::makeCurrent(QPlatformSurface *surface)
// Do we already have a DC entry for that window?
QWindowsWindow *window = static_cast<QWindowsWindow *>(surface);
+ window->aboutToMakeCurrent();
const HWND hwnd = window->handle();
if (const QOpenGLContextData *contextData = findByHWND(m_windowContexts, hwnd)) {
// Repeated calls to wglMakeCurrent when vsync is enabled in the driver will
diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
index acb692579b..0fa34041d6 100644
--- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp
+++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
@@ -422,11 +422,12 @@ bool QWindowsMouseHandler::translateMouseWheelEvent(QWindow *window, HWND,
}
// from bool QApplicationPrivate::translateTouchEvent()
-bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND,
+bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND hwnd,
QtWindows::WindowsEventType,
MSG msg, LRESULT *)
{
#ifndef Q_OS_WINCE
+ Q_UNUSED(hwnd);
typedef QWindowSystemInterface::TouchPoint QTouchPoint;
typedef QList<QWindowSystemInterface::TouchPoint> QTouchPointList;
@@ -495,8 +496,87 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND,
m_touchDevice,
touchPoints);
return true;
-#else
- return false;
+#else //Q_OS_WINCE
+ GESTUREINFO gi;
+ memset(&gi, 0, sizeof(GESTUREINFO));
+ gi.cbSize = sizeof(GESTUREINFO);
+
+ if (!GetGestureInfo((HGESTUREINFO)msg.lParam, &gi))
+ return false;
+
+ const QPoint position = QPoint(gi.ptsLocation.x, gi.ptsLocation.y);
+
+ if (gi.dwID != GID_DIRECTMANIPULATION)
+ return true;
+ static QPoint lastTouchPos;
+ const QRect screenGeometry = window->screen()->geometry();
+ QWindowSystemInterface::TouchPoint touchPoint;
+ static QWindowSystemInterface::TouchPoint touchPoint2;
+ touchPoint.id = 0;//gi.dwInstanceID;
+ touchPoint.pressure = 1.0;
+
+ if (gi.dwFlags & GF_BEGIN)
+ touchPoint.state = Qt::TouchPointPressed;
+ else if (gi.dwFlags & GF_END)
+ touchPoint.state = Qt::TouchPointReleased;
+ else if (gi.dwFlags == 0)
+ touchPoint.state = Qt::TouchPointMoved;
+ else
+ return true;
+ touchPoint2.pressure = 1.0;
+ touchPoint2.id = 1;
+ const QPoint winEventPosition = position;
+ const int deltaX = GID_DIRECTMANIPULATION_DELTA_X(gi.ullArguments);
+ const int deltaY = GID_DIRECTMANIPULATION_DELTA_Y(gi.ullArguments);
+ //Touch points are taken from the whole screen so map the position to the screen
+ const QPoint globalPosition = QWindowsGeometryHint::mapToGlobal(hwnd, winEventPosition);
+ const QPoint globalPosition2 = QWindowsGeometryHint::mapToGlobal(hwnd, QPoint(position.x() + deltaX, position.y() + deltaY));
+
+ touchPoint.normalPosition =
+ QPointF( (qreal)globalPosition.x() / screenGeometry.width(), (qreal)globalPosition.y() / screenGeometry.height() );
+
+ touchPoint.area.moveCenter(globalPosition);
+
+ QList<QWindowSystemInterface::TouchPoint> pointList;
+ pointList.append(touchPoint);
+ if (deltaX != 0 && deltaY != 0) {
+ touchPoint2.state = m_had2ndTouchPoint ? Qt::TouchPointMoved : Qt::TouchPointPressed;
+ m_had2ndTouchPoint = true;
+ touchPoint2.normalPosition =
+ QPointF( (qreal)globalPosition2.x() / screenGeometry.width(), (qreal)globalPosition2.y() / screenGeometry.height() );
+
+ touchPoint2.area.moveCenter(globalPosition2);
+ lastTouchPos = globalPosition2;
+ pointList.append(touchPoint2);
+ } else if (m_had2ndTouchPoint) {
+ touchPoint2.normalPosition =
+ QPointF( (qreal)lastTouchPos.x() / screenGeometry.width(), (qreal)lastTouchPos.y() / screenGeometry.height() );
+
+ touchPoint2.area.moveCenter(lastTouchPos);
+ touchPoint2.state = Qt::TouchPointReleased;
+ pointList.append(touchPoint2);
+ m_had2ndTouchPoint = false;
+ }
+
+ if (!m_touchDevice) {
+ m_touchDevice = new QTouchDevice;
+ // TODO: Device used to be hardcoded to screen in previous code.
+ m_touchDevice->setType(QTouchDevice::TouchScreen);
+ m_touchDevice->setCapabilities(QTouchDevice::Position | QTouchDevice::Area | QTouchDevice::NormalizedPosition);
+ QWindowSystemInterface::registerTouchDevice(m_touchDevice);
+ }
+
+ QWindowSystemInterface::handleTouchEvent(window, m_touchDevice, pointList);
+ // handle window focusing in/out
+ if (window != m_windowUnderMouse) {
+ if (m_windowUnderMouse)
+ QWindowSystemInterface::handleLeaveEvent(m_windowUnderMouse);
+ if (window)
+ QWindowSystemInterface::handleEnterEvent(window);
+ m_windowUnderMouse = window;
+ }
+
+ return true;
#endif
}
diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.h b/src/plugins/platforms/windows/qwindowsmousehandler.h
index 6491de93b5..60fe26b2b9 100644
--- a/src/plugins/platforms/windows/qwindowsmousehandler.h
+++ b/src/plugins/platforms/windows/qwindowsmousehandler.h
@@ -79,6 +79,10 @@ private:
QTouchDevice *m_touchDevice;
bool m_leftButtonDown;
QWindow *m_previousCaptureWindow;
+#ifdef Q_OS_WINCE
+//This is required to send a touch up if we don't get a second touch position any more
+ bool m_had2ndTouchPoint;
+#endif
};
Qt::MouseButtons QWindowsMouseHandler::keyStateToMouseButtons(int wParam)
diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp
index fd57d9ee61..ae8020a53e 100644
--- a/src/plugins/platforms/windows/qwindowsscreen.cpp
+++ b/src/plugins/platforms/windows/qwindowsscreen.cpp
@@ -497,4 +497,13 @@ bool QWindowsScreenManager::handleScreenChanges()
return true;
}
+const QWindowsScreen *QWindowsScreenManager::screenAtDp(const QPoint &p) const
+{
+ foreach (QWindowsScreen *scr, m_screens) {
+ if (scr->geometryDp().contains(p))
+ return scr;
+ }
+ return Q_NULLPTR;
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/windows/qwindowsscreen.h b/src/plugins/platforms/windows/qwindowsscreen.h
index aa1408358b..28256f3000 100644
--- a/src/plugins/platforms/windows/qwindowsscreen.h
+++ b/src/plugins/platforms/windows/qwindowsscreen.h
@@ -137,6 +137,8 @@ public:
bool handleDisplayChange(WPARAM wParam, LPARAM lParam);
const WindowsScreenList &screens() const { return m_screens; }
+ const QWindowsScreen *screenAtDp(const QPoint &p) const;
+
private:
void removeScreen(int index);
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 926e7da67e..65bc9742e4 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -170,6 +170,25 @@ QDebug operator<<(QDebug d, const NCCALCSIZE_PARAMS &p)
}
#endif // !Q_OS_WINCE
+// QTBUG-43872, for windows that do not have WS_EX_TOOLWINDOW set, WINDOWPLACEMENT
+// is in workspace/available area coordinates.
+static QPoint windowPlacementOffset(HWND hwnd, const QPoint &point)
+{
+#ifndef Q_OS_WINCE
+ if (GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW)
+ return QPoint(0, 0);
+ const QWindowsScreenManager &screenManager = QWindowsContext::instance()->screenManager();
+ const QWindowsScreen *screen = screenManager.screens().size() == 1
+ ? screenManager.screens().first() : screenManager.screenAtDp(point);
+ if (screen)
+ return screen->availableGeometryDp().topLeft() - screen->geometryDp().topLeft();
+#else
+ Q_UNUSED(hwnd)
+ Q_UNUSED(point)
+#endif
+ return QPoint(0, 0);
+}
+
// Return the frame geometry relative to the parent
// if there is one.
static inline QRect frameGeometry(HWND hwnd, bool topLevel)
@@ -180,8 +199,10 @@ static inline QRect frameGeometry(HWND hwnd, bool topLevel)
WINDOWPLACEMENT windowPlacement;
windowPlacement.length = sizeof(WINDOWPLACEMENT);
GetWindowPlacement(hwnd, &windowPlacement);
- if (windowPlacement.showCmd == SW_SHOWMINIMIZED)
- return qrectFromRECT(windowPlacement.rcNormalPosition);
+ if (windowPlacement.showCmd == SW_SHOWMINIMIZED) {
+ const QRect result = qrectFromRECT(windowPlacement.rcNormalPosition);
+ return result.translated(windowPlacementOffset(hwnd, result.topLeft()));
+ }
}
#endif // !Q_OS_WINCE
GetWindowRect(hwnd, &rect); // Screen coordinates.
@@ -206,6 +227,18 @@ static inline QSize clientSize(HWND hwnd)
return qSizeOfRect(rect);
}
+static inline bool windowIsOpenGL(const QWindow *w)
+{
+ switch (w->surfaceType()) {
+ case QSurface::OpenGLSurface:
+ return true;
+ case QSurface::RasterGLSurface:
+ return qt_window_private(const_cast<QWindow *>(w))->compositing;
+ default:
+ return false;
+ }
+}
+
static bool applyBlurBehindWindow(HWND hwnd)
{
#ifdef Q_OS_WINCE
@@ -329,6 +362,17 @@ static void setWindowOpacity(HWND hwnd, Qt::WindowFlags flags, bool hasAlpha, bo
#endif // !Q_OS_WINCE
}
+static inline void updateGLWindowSettings(const QWindow *w, HWND hwnd, Qt::WindowFlags flags, qreal opacity)
+{
+ const bool isGL = windowIsOpenGL(w);
+ const bool hasAlpha = w->format().hasAlpha();
+
+ if (isGL && hasAlpha)
+ applyBlurBehindWindow(hwnd);
+
+ setWindowOpacity(hwnd, flags, hasAlpha, isGL, opacity);
+}
+
/*!
\class WindowCreationData
\brief Window creation code.
@@ -370,14 +414,13 @@ struct WindowCreationData
void fromWindow(const QWindow *w, const Qt::WindowFlags flags, unsigned creationFlags = 0);
inline WindowData create(const QWindow *w, const WindowData &data, QString title) const;
inline void applyWindowFlags(HWND hwnd) const;
- void initialize(HWND h, bool frameChange, qreal opacityLevel) const;
+ void initialize(const QWindow *w, HWND h, bool frameChange, qreal opacityLevel) const;
Qt::WindowFlags flags;
HWND parentHandle;
Qt::WindowType type;
unsigned style;
unsigned exStyle;
- bool isGL;
bool topLevel;
bool popup;
bool dialog;
@@ -390,7 +433,7 @@ struct WindowCreationData
QDebug operator<<(QDebug debug, const WindowCreationData &d)
{
debug.nospace() << QWindowsWindow::debugWindowFlags(d.flags)
- << " GL=" << d.isGL << " topLevel=" << d.topLevel << " popup="
+ << " topLevel=" << d.topLevel << " popup="
<< d.popup << " dialog=" << d.dialog << " desktop=" << d.desktop
<< " embedded=" << d.embedded
<< " tool=" << d.tool << " style=" << debugWinStyle(d.style)
@@ -421,8 +464,6 @@ static inline void fixTopLevelWindowFlags(Qt::WindowFlags &flags)
void WindowCreationData::fromWindow(const QWindow *w, const Qt::WindowFlags flagsIn,
unsigned creationFlags)
{
- isGL = w->surfaceType() == QWindow::OpenGLSurface;
- hasAlpha = w->format().hasAlpha();
flags = flagsIn;
// Sometimes QWindow doesn't have a QWindow parent but does have a native parent window,
@@ -495,7 +536,7 @@ void WindowCreationData::fromWindow(const QWindow *w, const Qt::WindowFlags flag
// ### Commented out for now as it causes some problems, but
// this should be correct anyway, so dig some more into this
#ifdef Q_FLATTEN_EXPOSE
- if (isGL)
+ if (windowIsOpenGL(w)) // a bit incorrect since the is-opengl status may change from false to true at any time later on
style |= WS_CLIPSIBLINGS | WS_CLIPCHILDREN; // see SetPixelFormat
#else
style |= WS_CLIPSIBLINGS | WS_CLIPCHILDREN ;
@@ -574,7 +615,7 @@ QWindowsWindowData
const HINSTANCE appinst = (HINSTANCE)GetModuleHandle(0);
- const QString windowClassName = QWindowsContext::instance()->registerWindowClass(w, isGL);
+ const QString windowClassName = QWindowsContext::instance()->registerWindowClass(w);
const QRect geometryDip = QWindowsScaling::mapFromNative(data.geometry);
QRect fixedGeometryDip = QPlatformWindow::initialGeometry(w, geometryDip, defaultWindowWidth, defaultWindowHeight);
@@ -603,6 +644,10 @@ QWindowsWindowData
context->frameX, context->frameY,
context->frameWidth, context->frameHeight,
parentHandle, NULL, appinst, NULL);
+#ifdef Q_OS_WINCE
+ if (DisableGestures(result.hwnd, TGF_GID_ALL, TGF_SCOPE_WINDOW))
+ EnableGestures(result.hwnd, TGF_GID_DIRECTMANIPULATION, TGF_SCOPE_WINDOW);
+#endif
qCDebug(lcQpaWindows).nospace()
<< "CreateWindowEx: returns " << w << ' ' << result.hwnd << " obtained geometry: "
<< context->obtainedGeometry << context->margins;
@@ -617,9 +662,6 @@ QWindowsWindowData
result.embedded = embedded;
result.customMargins = context->customMargins;
- if (isGL && hasAlpha)
- applyBlurBehindWindow(result.hwnd);
-
return result;
}
@@ -642,7 +684,7 @@ void WindowCreationData::applyWindowFlags(HWND hwnd) const
<< debugWinExStyle(newExStyle);
}
-void WindowCreationData::initialize(HWND hwnd, bool frameChange, qreal opacityLevel) const
+void WindowCreationData::initialize(const QWindow *w, HWND hwnd, bool frameChange, qreal opacityLevel) const
{
if (desktop || !hwnd)
return;
@@ -667,8 +709,7 @@ void WindowCreationData::initialize(HWND hwnd, bool frameChange, qreal opacityLe
else
EnableMenuItem(systemMenu, SC_CLOSE, MF_BYCOMMAND|MF_GRAYED);
}
-
- setWindowOpacity(hwnd, flags, hasAlpha, isGL, opacityLevel);
+ updateGLWindowSettings(w, hwnd, flags, opacityLevel);
} else { // child.
SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, swpFlags);
}
@@ -1051,7 +1092,7 @@ QWindowsWindowData
creationData.fromWindow(w, parameters.flags);
QWindowsWindowData result = creationData.create(w, parameters, title);
// Force WM_NCCALCSIZE (with wParam=1) via SWP_FRAMECHANGED for custom margin.
- creationData.initialize(result.hwnd, !parameters.customMargins.isNull(), 1);
+ creationData.initialize(w, result.hwnd, !parameters.customMargins.isNull(), 1);
return result;
}
@@ -1287,8 +1328,10 @@ static QRect normalFrameGeometry(HWND hwnd)
#ifndef Q_OS_WINCE
WINDOWPLACEMENT wp;
wp.length = sizeof(WINDOWPLACEMENT);
- if (GetWindowPlacement(hwnd, &wp))
- return qrectFromRECT(wp.rcNormalPosition);
+ if (GetWindowPlacement(hwnd, &wp)) {
+ const QRect result = qrectFromRECT(wp.rcNormalPosition);
+ return result.translated(windowPlacementOffset(hwnd, result.topLeft()));
+ }
#else
Q_UNUSED(hwnd)
#endif
@@ -1384,7 +1427,7 @@ void QWindowsWindow::handleGeometryChange()
// QTBUG-32121: OpenGL/normal windows (with exception of ANGLE) do not receive
// expose events when shrinking, synthesize.
if (!testFlag(OpenGL_ES2) && isExposed()
- && !(m_data.geometry.width() > previousGeometry.width() || m_data.geometry.height() > previousGeometry.height())) {
+ && !(m_data.geometry.width() >= previousGeometry.width() || m_data.geometry.height() >= previousGeometry.height())) {
fireExpose(QRect(QPoint(0, 0), m_data.geometry.size()), true);
}
if (previousGeometry.topLeft() != m_data.geometry.topLeft()) {
@@ -1417,7 +1460,8 @@ void QWindowsWindow::setGeometry_sys(const QRect &rect) const
// window, set the normal position of the window.
if ((windowPlacement.showCmd == SW_MAXIMIZE && !IsWindowVisible(m_data.hwnd))
|| windowPlacement.showCmd == SW_SHOWMINIMIZED) {
- windowPlacement.rcNormalPosition = RECTfromQRect(frameGeometry);
+ windowPlacement.rcNormalPosition =
+ RECTfromQRect(frameGeometry.translated(-windowPlacementOffset(m_data.hwnd, frameGeometry.topLeft())));
windowPlacement.showCmd = windowPlacement.showCmd == SW_SHOWMINIMIZED ? SW_SHOWMINIMIZED : SW_HIDE;
result = SetWindowPlacement(m_data.hwnd, &windowPlacement);
} else
@@ -1538,7 +1582,7 @@ QWindowsWindowData QWindowsWindow::setWindowFlags_sys(Qt::WindowFlags wt,
WindowCreationData creationData;
creationData.fromWindow(window(), wt, flags);
creationData.applyWindowFlags(m_data.hwnd);
- creationData.initialize(m_data.hwnd, true, m_opacity);
+ creationData.initialize(window(), m_data.hwnd, true, m_opacity);
QWindowsWindowData result = m_data;
result.flags = creationData.flags;
@@ -1626,17 +1670,6 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState)
setFlag(FrameDirty);
- if ((oldState == Qt::WindowMaximized) != (newState == Qt::WindowMaximized)) {
- if (visible && !(newState == Qt::WindowMinimized)) {
- setFlag(WithinMaximize);
- if (newState == Qt::WindowFullScreen)
- setFlag(MaximizeToFullScreen);
- ShowWindow(m_data.hwnd, (newState == Qt::WindowMaximized) ? SW_MAXIMIZE : SW_SHOWNOACTIVATE);
- clearFlag(WithinMaximize);
- clearFlag(MaximizeToFullScreen);
- }
- }
-
if ((oldState == Qt::WindowFullScreen) != (newState == Qt::WindowFullScreen)) {
#ifdef Q_OS_WINCE
HWND handle = FindWindow(L"HHTaskBar", L"");
@@ -1716,6 +1749,15 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState)
m_savedStyle = 0;
m_savedFrameGeometry = QRect();
}
+ } else if ((oldState == Qt::WindowMaximized) != (newState == Qt::WindowMaximized)) {
+ if (visible && !(newState == Qt::WindowMinimized)) {
+ setFlag(WithinMaximize);
+ if (newState == Qt::WindowFullScreen)
+ setFlag(MaximizeToFullScreen);
+ ShowWindow(m_data.hwnd, (newState == Qt::WindowMaximized) ? SW_MAXIMIZE : SW_SHOWNOACTIVATE);
+ clearFlag(WithinMaximize);
+ clearFlag(MaximizeToFullScreen);
+ }
}
if ((oldState == Qt::WindowMinimized) != (newState == Qt::WindowMinimized)) {
@@ -2313,4 +2355,22 @@ void *QWindowsWindow::surface(void *nativeConfig)
#endif
}
+void QWindowsWindow::aboutToMakeCurrent()
+{
+#ifndef QT_NO_OPENGL
+ // For RasterGLSurface windows, that become OpenGL windows dynamically, it might be
+ // time to set up some GL specifics. This is particularly important for layered
+ // windows (WS_EX_LAYERED due to alpha > 0).
+ const bool isCompositing = qt_window_private(window())->compositing;
+ if (isCompositing != testFlag(Compositing)) {
+ if (isCompositing)
+ setFlag(Compositing);
+ else
+ clearFlag(Compositing);
+
+ updateGLWindowSettings(window(), m_data.hwnd, m_data.flags, m_opacity);
+ }
+#endif
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h
index 922d00f230..6d6d473ccd 100644
--- a/src/plugins/platforms/windows/qwindowswindow.h
+++ b/src/plugins/platforms/windows/qwindowswindow.h
@@ -137,7 +137,8 @@ public:
WithinCreate = 0x20000,
WithinMaximize = 0x40000,
MaximizeToFullScreen = 0x80000,
- InputMethodDisabled =0x100000
+ InputMethodDisabled = 0x100000,
+ Compositing = 0x200000
};
QWindowsWindow(QWindow *window, const QWindowsWindowData &data);
@@ -250,6 +251,7 @@ public:
void setWindowIcon(const QIcon &icon);
void *surface(void *nativeConfig);
+ void aboutToMakeCurrent();
#ifndef Q_OS_WINCE
void setAlertState(bool enabled);
diff --git a/src/printsupport/kernel/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp
index 437a68e609..8ed2732c1e 100644
--- a/src/printsupport/kernel/qprinter.cpp
+++ b/src/printsupport/kernel/qprinter.cpp
@@ -1224,7 +1224,10 @@ void QPrinter::setPageSize(PageSize newPageSize)
void QPrinter::setPaperSize(const QSizeF &paperSize, QPrinter::Unit unit)
{
- setPageSize(QPageSize(paperSize, QPageSize::Unit(unit)));
+ if (unit == QPrinter::DevicePixel)
+ setPageSize(QPageSize(paperSize * qt_pixelMultiplier(resolution()), QPageSize::Point));
+ else
+ setPageSize(QPageSize(paperSize, QPageSize::Unit(unit)));
}
/*!
diff --git a/src/testlib/qbenchmark_p.h b/src/testlib/qbenchmark_p.h
index 889798e862..5bf3760f66 100644
--- a/src/testlib/qbenchmark_p.h
+++ b/src/testlib/qbenchmark_p.h
@@ -105,6 +105,7 @@ public:
QBenchmarkResult()
: value(-1)
, iterations(-1)
+ , metric(QTest::FramesPerSecond)
, setByMacro(true)
, valid(false)
{ }
diff --git a/src/testlib/qtest.h b/src/testlib/qtest.h
index 6298262958..995d653118 100644
--- a/src/testlib/qtest.h
+++ b/src/testlib/qtest.h
@@ -91,8 +91,7 @@ template<> inline char *toString(const QDate &date)
template<> inline char *toString(const QDateTime &dateTime)
{
return dateTime.isValid()
- ? qstrdup(qPrintable(dateTime.toString(QLatin1String("yyyy/MM/dd hh:mm:ss.zzz")) +
- (dateTime.timeSpec() == Qt::LocalTime ? QLatin1String("[local time]") : QLatin1String("[UTC]"))))
+ ? qstrdup(qPrintable(dateTime.toString(QLatin1String("yyyy/MM/dd hh:mm:ss.zzz[t]"))))
: qstrdup("Invalid QDateTime");
}
#endif // QT_NO_DATESTRING
diff --git a/src/testlib/testlib.pro b/src/testlib/testlib.pro
index 17a03781c2..dbcc588d10 100644
--- a/src/testlib/testlib.pro
+++ b/src/testlib/testlib.pro
@@ -17,6 +17,7 @@ HEADERS = qbenchmark.h \
qbenchmarkvalgrind_p.h \
qbenchmarkevent_p.h \
qbenchmarkperfevents_p.h \
+ qbenchmarkmetric.h \
qbenchmarkmetric_p.h \
qsignalspy.h \
qtestaccessible.h \
diff --git a/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc b/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc
index 446b441675..9f5ef59e94 100644
--- a/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc
+++ b/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc
@@ -805,7 +805,7 @@
{QWidget::addAction}().
\endquotation
- If you don't include the function name with the \b{\\overlaod}
+ If you don't include the function name with the \b{\\overload}
command, then instead of the "This function overloads..." line
with the link to the documentation for the primary version, you
get the old standard line:
diff --git a/src/tools/rcc/main.cpp b/src/tools/rcc/main.cpp
index c2e9b26fb3..2cfc30ed3f 100644
--- a/src/tools/rcc/main.cpp
+++ b/src/tools/rcc/main.cpp
@@ -200,7 +200,9 @@ int runRcc(int argc, char *argv[])
const QStringList filenamesIn = parser.positionalArguments();
foreach (const QString &file, filenamesIn) {
- if (!QFile::exists(file)) {
+ if (file == QLatin1String("-"))
+ continue;
+ else if (!QFile::exists(file)) {
qWarning("%s: File does not exist '%s'", argv[0], qPrintable(file));
return 1;
}
diff --git a/src/widgets/doc/src/widgets-and-layouts/layout.qdoc b/src/widgets/doc/src/widgets-and-layouts/layout.qdoc
index f581df4cb3..7e2e79fc5d 100644
--- a/src/widgets/doc/src/widgets-and-layouts/layout.qdoc
+++ b/src/widgets/doc/src/widgets-and-layouts/layout.qdoc
@@ -219,7 +219,7 @@
\section1 Custom Widgets in Layouts
When you make your own widget class, you should also communicate its layout
- properties. If the widget has a one of Qt's layouts, this is already taken
+ properties. If the widget uses one of Qt's layouts, this is already taken
care of. If the widget does not have any child widgets, or uses manual
layout, you can change the behavior of the widget using any or all of the
following mechanisms:
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index 0f346a9682..9b8c19df6d 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -2388,7 +2388,7 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event)
}
#endif
break;
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
case Qt::Key_Enter:
case Qt::Key_Return:
// Propagate the enter if you couldn't edit the item and there are no
@@ -2418,7 +2418,7 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event)
selectAll();
break;
}
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
if (event->key() == Qt::Key_O && event->modifiers() & Qt::ControlModifier && currentIndex().isValid()) {
emit activated(currentIndex());
break;
diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp
index e7d18092f1..add60d4d88 100644
--- a/src/widgets/itemviews/qlistview.cpp
+++ b/src/widgets/itemviews/qlistview.cpp
@@ -3198,7 +3198,7 @@ void QListView::selectionChanged(const QItemSelection &selected,
QModelIndex sel = selected.indexes().value(0);
if (sel.isValid()) {
int entry = visualIndex(sel);
- QAccessibleEvent event(this, QAccessible::Selection);
+ QAccessibleEvent event(this, QAccessible::SelectionAdd);
event.setChild(entry);
QAccessible::updateAccessibility(&event);
}
diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp
index b5eb509766..be1bfce9ff 100644
--- a/src/widgets/itemviews/qtableview.cpp
+++ b/src/widgets/itemviews/qtableview.cpp
@@ -3337,7 +3337,7 @@ void QTableView::selectionChanged(const QItemSelection &selected,
QModelIndex sel = selected.indexes().value(0);
if (sel.isValid()) {
int entry = d->accessibleTable2Index(sel);
- QAccessibleEvent event(this, QAccessible::Selection);
+ QAccessibleEvent event(this, QAccessible::SelectionAdd);
event.setChild(entry);
QAccessible::updateAccessibility(&event);
}
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index 2c5f4b7c72..531ef8b8aa 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -3981,7 +3981,7 @@ void QTreeView::selectionChanged(const QItemSelection &selected,
if (sel.isValid()) {
int entry = d->accessibleTree2Index(sel);
Q_ASSERT(entry >= 0);
- QAccessibleEvent event(this, QAccessible::Selection);
+ QAccessibleEvent event(this, QAccessible::SelectionAdd);
event.setChild(entry);
QAccessible::updateAccessibility(&event);
}
diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp
index 0a4e57812a..7378b9979a 100644
--- a/src/widgets/itemviews/qtreewidget.cpp
+++ b/src/widgets/itemviews/qtreewidget.cpp
@@ -2934,8 +2934,6 @@ void QTreeWidget::closePersistentEditor(QTreeWidgetItem *item, int column)
Returns the widget displayed in the cell specified by \a item and the given \a column.
- \note The tree takes ownership of the widget.
-
*/
QWidget *QTreeWidget::itemWidget(QTreeWidgetItem *item, int column) const
{
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index c99e15b9b8..453a7ca537 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -7235,7 +7235,7 @@ QByteArray QWidget::saveGeometry() const
/*!
\since 4.2
- Restores the geometry and state top-level widgets stored in the
+ Restores the geometry and state of top-level widgets stored in the
byte array \a geometry. Returns \c true on success; otherwise
returns \c false.
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index ed7b4ab3b6..cf2f3ea26b 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -514,6 +514,9 @@ void QFusionStyle::drawPrimitive(PrimitiveElement elem,
break;
}
arrow = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), arrowColor, rotation);
+ if (arrow.isNull())
+ break;
+
QRect rect = option->rect;
QRect arrowRect;
int imageMax = qMin(arrow.height(), arrow.width());
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index e9f20de842..3d9ba6b490 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -3397,8 +3397,10 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
state = QIcon::On;
QPixmap pixmap = button->icon.pixmap(button->iconSize, mode, state);
- int labelWidth = pixmap.width();
- int labelHeight = pixmap.height();
+ int pixmapWidth = pixmap.width() / pixmap.devicePixelRatio();
+ int pixmapHeight = pixmap.height() / pixmap.devicePixelRatio();
+ int labelWidth = pixmapWidth;
+ int labelHeight = pixmapHeight;
int iconSpacing = 4;//### 4 is currently hardcoded in QPushButton::sizeHint()
int textWidth = button->fontMetrics.boundingRect(opt->rect, tf, button->text).width();
if (!button->text.isEmpty())
@@ -3407,15 +3409,15 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q
//Determine label alignment:
if (textAlignment & Qt::AlignLeft) { /*left*/
iconRect = QRect(textRect.x(), textRect.y() + (textRect.height() - labelHeight) / 2,
- pixmap.width(), pixmap.height());
+ pixmapWidth, pixmapHeight);
} else if (textAlignment & Qt::AlignHCenter) { /* center */
iconRect = QRect(textRect.x() + (textRect.width() - labelWidth) / 2,
textRect.y() + (textRect.height() - labelHeight) / 2,
- pixmap.width(), pixmap.height());
+ pixmapWidth, pixmapHeight);
} else { /*right*/
iconRect = QRect(textRect.x() + textRect.width() - labelWidth,
textRect.y() + (textRect.height() - labelHeight) / 2,
- pixmap.width(), pixmap.height());
+ pixmapWidth, pixmapHeight);
}
iconRect = visualRect(button->direction, textRect, iconRect);
diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp
index 7d04cab05e..d151e57d04 100644
--- a/src/widgets/util/qsystemtrayicon.cpp
+++ b/src/widgets/util/qsystemtrayicon.cpp
@@ -37,6 +37,7 @@
#ifndef QT_NO_SYSTEMTRAYICON
#include "qmenu.h"
+#include "qlist.h"
#include "qevent.h"
#include "qpoint.h"
#include "qlabel.h"
@@ -704,11 +705,7 @@ void QSystemTrayIconPrivate::updateIcon_sys_qpa()
void QSystemTrayIconPrivate::updateMenu_sys_qpa()
{
if (menu) {
- if (!menu->platformMenu()) {
- QPlatformMenu *platformMenu = qpa_sys->createMenu();
- if (platformMenu)
- menu->setPlatformMenu(platformMenu);
- }
+ addPlatformMenu(menu);
qpa_sys->updateMenu(menu->platformMenu());
}
}
@@ -741,6 +738,27 @@ void QSystemTrayIconPrivate::showMessage_sys_qpa(const QString &message,
static_cast<QPlatformSystemTrayIcon::MessageIcon>(icon), msecs);
}
+void QSystemTrayIconPrivate::addPlatformMenu(QMenu *menu) const
+{
+ if (menu->platformMenu())
+ return; // The platform menu already exists.
+
+ // The recursion depth is the same as menu depth, so should not
+ // be higher than 3 levels.
+ QListIterator<QAction *> it(menu->actions());
+ while (it.hasNext()) {
+ QAction *action = it.next();
+ if (action->menu())
+ addPlatformMenu(action->menu());
+ }
+
+ // This menu should be processed *after* its children, otherwise
+ // setMenu() is not called on respective QPlatformMenuItems.
+ QPlatformMenu *platformMenu = qpa_sys->createMenu();
+ if (platformMenu)
+ menu->setPlatformMenu(platformMenu);
+}
+
QT_END_NAMESPACE
#endif // QT_NO_SYSTEMTRAYICON
diff --git a/src/widgets/util/qsystemtrayicon_p.h b/src/widgets/util/qsystemtrayicon_p.h
index 0dda689c51..f05bf9e3f9 100644
--- a/src/widgets/util/qsystemtrayicon_p.h
+++ b/src/widgets/util/qsystemtrayicon_p.h
@@ -99,6 +99,7 @@ private:
void updateMenu_sys_qpa();
QRect geometry_sys_qpa() const;
void showMessage_sys_qpa(const QString &msg, const QString &title, QSystemTrayIcon::MessageIcon icon, int secs);
+ void addPlatformMenu(QMenu *menu) const;
};
class QBalloonTip : public QWidget
diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp
index 72a556db7c..e56fd111e5 100644
--- a/src/widgets/widgets/qplaintextedit.cpp
+++ b/src/widgets/widgets/qplaintextedit.cpp
@@ -288,8 +288,7 @@ void QPlainTextDocumentLayout::documentChanged(int from, int charsRemoved, int c
if (changeStartBlock == changeEndBlock && newBlockCount == d->blockCount) {
QTextBlock block = changeStartBlock;
- int blockLineCount = block.layout()->lineCount();
- if (block.isValid() && blockLineCount) {
+ if (block.isValid() && block.length()) {
QRectF oldBr = blockBoundingRect(block);
layoutBlock(block);
QRectF newBr = blockBoundingRect(block);
diff --git a/tests/auto/android/runtests_androiddeployqt.pl b/tests/auto/android/runtests_androiddeployqt.pl
index 8e9376da35..5ab6a63962 100755
--- a/tests/auto/android/runtests_androiddeployqt.pl
+++ b/tests/auto/android/runtests_androiddeployqt.pl
@@ -334,7 +334,7 @@ sub checkXMLOutput
while (my($test_key, $test_valule) = each (%{$function_valule})) {
next if $test_key ne "Incident";
for my $incident (@{$test_valule}) {
- if ($incident->{type} ne "pass") {
+ if (($incident->{type} ne "pass") && ($incident->{type} ne "xfail")) {
print "test $testName::$function_key failed $incident->{file}:$incident->{line}\n";
$fail = 1;
}
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/qmimedatabase-cache.pro b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/qmimedatabase-cache.pro
index 9f006b4a4f..d0dbf077c8 100644
--- a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/qmimedatabase-cache.pro
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/qmimedatabase-cache.pro
@@ -6,8 +6,8 @@ QT = core testlib concurrent
SOURCES = tst_qmimedatabase-cache.cpp
HEADERS = ../tst_qmimedatabase.h
-
-DEFINES += CORE_SOURCES='"\\"$$QT_SOURCE_TREE/src/corelib\\""'
+RESOURCES += $$QT_SOURCE_TREE/src/corelib/mimetypes/mimetypes.qrc
+RESOURCES += ../testdata.qrc
*-g++*:QMAKE_CXXFLAGS += -W -Wall -Wextra -Wshadow -Wno-long-long -Wnon-virtual-dtor
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/qmimedatabase-xml.pro b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/qmimedatabase-xml.pro
index 8dd8d930c1..6d7cbc6016 100644
--- a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/qmimedatabase-xml.pro
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/qmimedatabase-xml.pro
@@ -7,7 +7,8 @@ QT = core testlib concurrent
SOURCES += tst_qmimedatabase-xml.cpp
HEADERS += ../tst_qmimedatabase.h
-DEFINES += CORE_SOURCES='"\\"$$QT_SOURCE_TREE/src/corelib\\""'
+RESOURCES += $$QT_SOURCE_TREE/src/corelib/mimetypes/mimetypes.qrc
+RESOURCES += ../testdata.qrc
*-g++*:QMAKE_CXXFLAGS += -W -Wall -Wextra -Wshadow -Wno-long-long -Wnon-virtual-dtor
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/testdata.qrc b/tests/auto/corelib/mimetypes/qmimedatabase/testdata.qrc
new file mode 100644
index 0000000000..48d3204473
--- /dev/null
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/testdata.qrc
@@ -0,0 +1,7 @@
+<RCC>
+ <qresource prefix="/qt-project.org/qmime">
+ <file alias="yast2-metapackage-handler-mimetypes.xml">yast2-metapackage-handler-mimetypes.xml</file>
+ <file alias="qml-again.xml">qml-again.xml</file>
+ <file alias="test.qml">test.qml</file>
+ </qresource>
+</RCC>
diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
index 6dec691b1f..686e25c800 100644
--- a/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
+++ b/tests/auto/corelib/mimetypes/qmimedatabase/tst_qmimedatabase.cpp
@@ -45,6 +45,7 @@
static const char yastFileName[] ="yast2-metapackage-handler-mimetypes.xml";
static const char qmlAgainFileName[] ="qml-again.xml";
+#define RESOURCE_PREFIX ":/qt-project.org/qmime/"
void initializeLang()
{
@@ -99,9 +100,7 @@ void tst_QMimeDatabase::initTestCase()
<< "\nGlobal XDG_DATA_DIRS: " << m_globalXdgDir;
const QString freeDesktopXml = QStringLiteral("freedesktop.org.xml");
- const QString xmlFileName = QLatin1String(CORE_SOURCES)
- + QStringLiteral("/mimetypes/mime/packages/")
- + freeDesktopXml;
+ const QString xmlFileName = QLatin1String(RESOURCE_PREFIX) + freeDesktopXml;
QVERIFY2(QFileInfo(xmlFileName).exists(), qPrintable(xmlFileName + QStringLiteral(" does not exist")));
QFile xml(xmlFileName);
QVERIFY(xml.copy(globalPackageDir + '/' + freeDesktopXml));
@@ -110,11 +109,11 @@ void tst_QMimeDatabase::initTestCase()
if (m_testSuite.isEmpty())
qWarning("%s", qPrintable(testSuiteWarning()));
- m_yastMimeTypes = QFINDTESTDATA(yastFileName);
+ m_yastMimeTypes = QLatin1String(RESOURCE_PREFIX) + yastFileName;
QVERIFY2(!m_yastMimeTypes.isEmpty(),
qPrintable(QString::fromLatin1("Cannot find '%1' starting from '%2'").
arg(yastFileName, QDir::currentPath())));
- m_qmlAgainFileName = QFINDTESTDATA(qmlAgainFileName);
+ m_qmlAgainFileName = QLatin1String(RESOURCE_PREFIX) + qmlAgainFileName;
QVERIFY2(!m_qmlAgainFileName.isEmpty(),
qPrintable(QString::fromLatin1("Cannot find '%1' starting from '%2'").
arg(qmlAgainFileName, QDir::currentPath())));
@@ -844,7 +843,7 @@ void tst_QMimeDatabase::installNewGlobalMimeType()
checkHasMimeType("text/x-suse-ymp");
// Test that a double-definition of a mimetype doesn't lead to sniffing ("conflicting globs").
- const QString qmlTestFile = QFINDTESTDATA("test.qml");
+ const QString qmlTestFile = QLatin1String(RESOURCE_PREFIX "test.qml");
QVERIFY2(!qmlTestFile.isEmpty(),
qPrintable(QString::fromLatin1("Cannot find '%1' starting from '%2'").
arg("test.qml", QDir::currentPath())));
@@ -893,7 +892,7 @@ void tst_QMimeDatabase::installNewLocalMimeType()
checkHasMimeType("text/x-suse-ymp");
// Test that a double-definition of a mimetype doesn't lead to sniffing ("conflicting globs").
- const QString qmlTestFile = QFINDTESTDATA("test.qml");
+ const QString qmlTestFile = QLatin1String(RESOURCE_PREFIX "test.qml");
QVERIFY2(!qmlTestFile.isEmpty(),
qPrintable(QString::fromLatin1("Cannot find '%1' starting from '%2'").
arg("test.qml", QDir::currentPath())));
diff --git a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
index d5a628889c..346ce6fcf9 100644
--- a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
+++ b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
@@ -2355,6 +2355,24 @@ void tst_QSharedPointer::sharedFromThis()
QCOMPARE(Data::generationCounter, generations + 4);
QCOMPARE(Data::destructorCounter, destructions + 4);
+ {
+ QSharedPointer<SomeClass> scp2 = QSharedPointer<SomeClass>::create();
+ QVERIFY(!scp2.isNull());
+
+ scp = scp2->sharedFromThis();
+ QVERIFY(!scp.isNull());
+
+ QVERIFY(scp == scp2);
+ QCOMPARE(Data::generationCounter, generations + 5);
+ QCOMPARE(Data::destructorCounter, destructions + 4);
+ }
+ QCOMPARE(Data::generationCounter, generations + 5);
+ QCOMPARE(Data::destructorCounter, destructions + 4);
+
+ scp.clear();
+
+ QCOMPARE(Data::generationCounter, generations + 5);
+ QCOMPARE(Data::destructorCounter, destructions + 5);
}
namespace ReentrancyWhileDestructing {
diff --git a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp
index db09ec4486..49a3a720c7 100644
--- a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp
+++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2015 Intel Corporation.
** Contact: http://www.qt-project.org/legal
**
** This file is part of the test suite of the Qt Toolkit.
@@ -114,6 +115,8 @@ private slots:
void echo();
void linkLocalIPv6();
void linkLocalIPv4();
+ void readyRead();
+ void readyReadForEmptyDatagram();
protected slots:
void empty_readyReadSlot();
@@ -1515,5 +1518,92 @@ void tst_QUdpSocket::linkLocalIPv4()
qDeleteAll(sockets);
}
+void tst_QUdpSocket::readyRead()
+{
+ QFETCH_GLOBAL(bool, setProxy);
+ if (setProxy)
+ return;
+
+ char buf[1];
+ QUdpSocket sender, receiver;
+#ifdef FORCE_SESSION
+ sender.setProperty("_q_networksession", QVariant::fromValue(networkSession));
+ receiver.setProperty("_q_networksession", QVariant::fromValue(networkSession));
+#endif
+
+ QVERIFY(receiver.bind(QHostAddress(QHostAddress::AnyIPv4), 0));
+ quint16 port = receiver.localPort();
+ QVERIFY(port != 0);
+
+ QSignalSpy spy(&receiver, SIGNAL(readyRead()));
+
+ // send a datagram to that port
+ sender.writeDatagram("a", makeNonAny(receiver.localAddress()), port);
+
+ // wait a little
+ // if QTBUG-43857 is still going, we'll live-lock on socket notifications from receiver's socket
+ QTest::qWait(100);
+
+ // make sure only one signal was emitted
+ QCOMPARE(spy.count(), 1);
+ QVERIFY(receiver.hasPendingDatagrams());
+ QCOMPARE(receiver.bytesAvailable(), qint64(1));
+ QCOMPARE(receiver.pendingDatagramSize(), qint64(1));
+
+ // write another datagram
+ sender.writeDatagram("ab", makeNonAny(receiver.localAddress()), port);
+
+ // no new signal should be emitted because we haven't read the first datagram yet
+ QTest::qWait(100);
+ QCOMPARE(spy.count(), 1);
+ QVERIFY(receiver.hasPendingDatagrams());
+ QVERIFY(receiver.bytesAvailable() >= 1); // most likely is 1, but it could be 1 + 2 in the future
+ QCOMPARE(receiver.pendingDatagramSize(), qint64(1));
+
+ // read all the datagrams (we could read one only, but we can't be sure the OS is queueing)
+ while (receiver.hasPendingDatagrams())
+ receiver.readDatagram(buf, sizeof buf);
+
+ // write a new datagram and ensure the signal is emitted now
+ sender.writeDatagram("abc", makeNonAny(receiver.localAddress()), port);
+ QTest::qWait(100);
+ QCOMPARE(spy.count(), 2);
+ QVERIFY(receiver.hasPendingDatagrams());
+ QCOMPARE(receiver.bytesAvailable(), qint64(3));
+ QCOMPARE(receiver.pendingDatagramSize(), qint64(3));
+}
+
+void tst_QUdpSocket::readyReadForEmptyDatagram()
+{
+ QFETCH_GLOBAL(bool, setProxy);
+ if (setProxy)
+ return;
+
+ QUdpSocket sender, receiver;
+#ifdef FORCE_SESSION
+ sender.setProperty("_q_networksession", QVariant::fromValue(networkSession));
+ receiver.setProperty("_q_networksession", QVariant::fromValue(networkSession));
+#endif
+
+ QVERIFY(receiver.bind(QHostAddress(QHostAddress::AnyIPv4), 0));
+ quint16 port = receiver.localPort();
+ QVERIFY(port != 0);
+
+ connect(&receiver, SIGNAL(readyRead()), SLOT(empty_readyReadSlot()));
+
+ // send an empty datagram to that port
+ sender.writeDatagram("", makeNonAny(receiver.localAddress()), port);
+
+ // ensure that we got a readyRead, despite bytesAvailable() == 0
+ QTestEventLoop::instance().enterLoop(1);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+
+ char buf[1];
+ QVERIFY(receiver.hasPendingDatagrams());
+ QCOMPARE(receiver.pendingDatagramSize(), qint64(0));
+ QCOMPARE(receiver.bytesAvailable(), qint64(0));
+ QCOMPARE(receiver.readDatagram(buf, sizeof buf), qint64(0));
+}
+
QTEST_MAIN(tst_QUdpSocket)
#include "tst_qudpsocket.moc"
diff --git a/tests/auto/network/ssl/qsslcertificate/qsslcertificate.pro b/tests/auto/network/ssl/qsslcertificate/qsslcertificate.pro
index 69cd241f84..f2d6589410 100644
--- a/tests/auto/network/ssl/qsslcertificate/qsslcertificate.pro
+++ b/tests/auto/network/ssl/qsslcertificate/qsslcertificate.pro
@@ -6,6 +6,5 @@ SOURCES += tst_qsslcertificate.cpp
QT = core network testlib
TARGET = tst_qsslcertificate
-DEFINES += SRCDIR=\\\"$$PWD/\\\"
TESTDATA += certificates/* more-certificates/* verify-certs/* pkcs12/*
diff --git a/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp b/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp
index 82050e73fd..a300187b95 100644
--- a/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp
+++ b/tests/auto/network/ssl/qsslcertificate/tst_qsslcertificate.cpp
@@ -1301,7 +1301,7 @@ void tst_QSslCertificate::pkcs12()
return;
}
- QFile f(QLatin1String(SRCDIR "pkcs12/leaf.p12"));
+ QFile f(testDataDir + QLatin1String("/pkcs12/leaf.p12"));
bool ok = f.open(QIODevice::ReadOnly);
QVERIFY(ok);
@@ -1316,12 +1316,12 @@ void tst_QSslCertificate::pkcs12()
QVERIFY(ok);
f.close();
- QList<QSslCertificate> leafCert = QSslCertificate::fromPath(QLatin1String( SRCDIR "pkcs12/leaf.crt"));
+ QList<QSslCertificate> leafCert = QSslCertificate::fromPath(testDataDir + QLatin1String("/pkcs12/leaf.crt"));
QVERIFY(!leafCert.isEmpty());
QCOMPARE(cert, leafCert.first());
- QFile f2(QLatin1String(SRCDIR "pkcs12/leaf.key"));
+ QFile f2(testDataDir + QLatin1String("/pkcs12/leaf.key"));
ok = f2.open(QIODevice::ReadOnly);
QVERIFY(ok);
@@ -1331,7 +1331,7 @@ void tst_QSslCertificate::pkcs12()
QVERIFY(!leafKey.isNull());
QCOMPARE(key, leafKey);
- QList<QSslCertificate> caCert = QSslCertificate::fromPath(QLatin1String(SRCDIR "pkcs12/inter.crt"));
+ QList<QSslCertificate> caCert = QSslCertificate::fromPath(testDataDir + QLatin1String("/pkcs12/inter.crt"));
QVERIFY(!caCert.isEmpty());
QVERIFY(!caCerts.isEmpty());
diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
index ef70509541..e59509a944 100644
--- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
+++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
@@ -2779,7 +2779,7 @@ void tst_QAccessibility::listTest()
// Check for events
QTest::mouseClick(listView->viewport(), Qt::LeftButton, 0, listView->visualItemRect(listView->item(1)).center());
- QAccessibleEvent selectionEvent(listView, QAccessible::Selection);
+ QAccessibleEvent selectionEvent(listView, QAccessible::SelectionAdd);
selectionEvent.setChild(1);
QAccessibleEvent focusEvent(listView, QAccessible::Focus);
focusEvent.setChild(1);
@@ -2787,7 +2787,7 @@ void tst_QAccessibility::listTest()
QVERIFY(QTestAccessibility::containsEvent(&focusEvent));
QTest::mouseClick(listView->viewport(), Qt::LeftButton, 0, listView->visualItemRect(listView->item(2)).center());
- QAccessibleEvent selectionEvent2(listView, QAccessible::Selection);
+ QAccessibleEvent selectionEvent2(listView, QAccessible::SelectionAdd);
selectionEvent2.setChild(2);
QAccessibleEvent focusEvent2(listView, QAccessible::Focus);
focusEvent2.setChild(2);
@@ -3281,7 +3281,7 @@ void tst_QAccessibility::tableTest()
tableView->setSelectionBehavior(QAbstractItemView::SelectItems);
tableView->setSelectionMode(QAbstractItemView::SingleSelection);
tableView->selectionModel()->select(index00, QItemSelectionModel::ClearAndSelect);
- QAccessibleEvent event(tableView, QAccessible::Selection);
+ QAccessibleEvent event(tableView, QAccessible::SelectionAdd);
event.setChild(12);
QCOMPARE(QTestAccessibility::containsEvent(&event), true);
QTestAccessibility::clearEvents();
diff --git a/tests/auto/other/qaccessibilitylinux/qaccessibilitylinux.pro b/tests/auto/other/qaccessibilitylinux/qaccessibilitylinux.pro
index cb5bc04c1d..2ea54ab603 100644
--- a/tests/auto/other/qaccessibilitylinux/qaccessibilitylinux.pro
+++ b/tests/auto/other/qaccessibilitylinux/qaccessibilitylinux.pro
@@ -3,6 +3,7 @@ CONFIG += testcase
# This is temporary to start running the test as part of normal CI.
CONFIG += insignificant_test # QTBUG-27732
+include($$QT_SOURCE_TREE/src/platformsupport/accessibility/accessibility.pri)
include($$QT_SOURCE_TREE/src/platformsupport/linuxaccessibility/linuxaccessibility.pri)
TARGET = tst_qaccessibilitylinux
diff --git a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp
index 78aa0af43d..62bd9828ba 100644
--- a/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp
+++ b/tests/auto/printsupport/kernel/qprinter/tst_qprinter.cpp
@@ -526,7 +526,7 @@ void tst_QPrinter::testCustomPageSizes()
{
QPrinter p;
- QSizeF customSize(8.5, 11.0);
+ QSizeF customSize(7.0, 11.0);
p.setPaperSize(customSize, QPrinter::Inch);
QSizeF paperSize = p.paperSize(QPrinter::Inch);
@@ -538,6 +538,16 @@ void tst_QPrinter::testCustomPageSizes()
paperSize = p.paperSize(QPrinter::Inch);
QCOMPARE(paperSize.width(), customSize.width());
QCOMPARE(paperSize.height(), customSize.height());
+
+ const QSizeF sizeInPixels = p.paperSize(QPrinter::DevicePixel);
+ QPrinter p3;
+ p3.setPaperSize(sizeInPixels, QPrinter::DevicePixel);
+ paperSize = p3.paperSize(QPrinter::Inch);
+ QCOMPARE(paperSize.width(), customSize.width());
+ QCOMPARE(paperSize.height(), customSize.height());
+ QPageSize pageSize = p3.pageLayout().pageSize();
+ QCOMPARE(pageSize.key(), QString("Custom.504x792"));
+ QCOMPARE(pageSize.name(), QString("Custom (504pt x 792pt)"));
}
void tst_QPrinter::customPaperSizeAndMargins_data()
diff --git a/tests/auto/testlib/selftests/datetime/tst_datetime.cpp b/tests/auto/testlib/selftests/datetime/tst_datetime.cpp
index d684f46f16..95bc72298e 100644
--- a/tests/auto/testlib/selftests/datetime/tst_datetime.cpp
+++ b/tests/auto/testlib/selftests/datetime/tst_datetime.cpp
@@ -52,7 +52,7 @@ private slots:
void tst_DateTime::dateTime() const
{
const QDateTime utc(QDate(2000, 5, 3), QTime(4, 3, 4), Qt::UTC);
- const QDateTime local(QDate(2000, 5, 3), QTime(4, 3, 4), Qt::LocalTime);
+ const QDateTime local(QDate(2000, 5, 3), QTime(4, 3, 4), Qt::OffsetFromUTC, 120 /* 2 minutes */);
QCOMPARE(local, utc);
}
diff --git a/tests/auto/testlib/selftests/expected_datetime.lightxml b/tests/auto/testlib/selftests/expected_datetime.lightxml
index 48ad0933f7..1aeac37e42 100644
--- a/tests/auto/testlib/selftests/expected_datetime.lightxml
+++ b/tests/auto/testlib/selftests/expected_datetime.lightxml
@@ -10,7 +10,7 @@
<TestFunction name="dateTime">
<Incident type="fail" file="tst_datetime.cpp" line="65">
<Description><![CDATA[Compared values are not the same
- Actual (local): 2000/05/03 04:03:04.000[local time]
+ Actual (local): 2000/05/03 04:03:04.000[UTC+00:02]
Expected (utc) : 2000/05/03 04:03:04.000[UTC]]]></Description>
</Incident>
<Duration msecs="0"/>
diff --git a/tests/auto/testlib/selftests/expected_datetime.txt b/tests/auto/testlib/selftests/expected_datetime.txt
index 1139c70ab8..c29fa050a1 100644
--- a/tests/auto/testlib/selftests/expected_datetime.txt
+++ b/tests/auto/testlib/selftests/expected_datetime.txt
@@ -2,7 +2,7 @@
Config: Using QtTest library @INSERT_QT_VERSION_HERE@, Qt @INSERT_QT_VERSION_HERE@
PASS : tst_DateTime::initTestCase()
FAIL! : tst_DateTime::dateTime() Compared values are not the same
- Actual (local): 2000/05/03 04:03:04.000[local time]
+ Actual (local): 2000/05/03 04:03:04.000[UTC+00:02]
Expected (utc) : 2000/05/03 04:03:04.000[UTC]
Loc: [tst_datetime.cpp(65)]
PASS : tst_DateTime::qurl(empty urls)
diff --git a/tests/auto/testlib/selftests/expected_datetime.xml b/tests/auto/testlib/selftests/expected_datetime.xml
index 30afde60ec..4c5bb0525b 100644
--- a/tests/auto/testlib/selftests/expected_datetime.xml
+++ b/tests/auto/testlib/selftests/expected_datetime.xml
@@ -12,7 +12,7 @@
<TestFunction name="dateTime">
<Incident type="fail" file="tst_datetime.cpp" line="65">
<Description><![CDATA[Compared values are not the same
- Actual (local): 2000/05/03 04:03:04.000[local time]
+ Actual (local): 2000/05/03 04:03:04.000[UTC+00:02]
Expected (utc) : 2000/05/03 04:03:04.000[UTC]]]></Description>
</Incident>
<Duration msecs="0"/>
diff --git a/tests/auto/testlib/selftests/expected_datetime.xunitxml b/tests/auto/testlib/selftests/expected_datetime.xunitxml
index 901462b6bf..6fc95719f3 100644
--- a/tests/auto/testlib/selftests/expected_datetime.xunitxml
+++ b/tests/auto/testlib/selftests/expected_datetime.xunitxml
@@ -8,7 +8,7 @@
<testcase result="pass" name="initTestCase"/>
<testcase result="fail" name="dateTime">
<failure message="Compared values are not the same
- Actual (local): 2000/05/03 04:03:04.000[local time]
+ Actual (local): 2000/05/03 04:03:04.000[UTC+00:02]
Expected (utc) : 2000/05/03 04:03:04.000[UTC]" result="fail"/>
</testcase>
<testcase result="fail" name="qurl">
diff --git a/tests/auto/widgets/dialogs/qcolordialog/tst_qcolordialog.cpp b/tests/auto/widgets/dialogs/qcolordialog/tst_qcolordialog.cpp
index fa50d10488..e4e4fda1ca 100644
--- a/tests/auto/widgets/dialogs/qcolordialog/tst_qcolordialog.cpp
+++ b/tests/auto/widgets/dialogs/qcolordialog/tst_qcolordialog.cpp
@@ -60,6 +60,7 @@ private slots:
void defaultOkButton();
void native_activeModalWidget();
void task247349_alpha();
+ void QTBUG_43548_initialColor();
};
class TestNativeDialog : public QColorDialog
@@ -162,5 +163,14 @@ void tst_QColorDialog::task247349_alpha()
QCOMPARE(alpha, qAlpha(dialog.currentColor().rgba()));
}
+void tst_QColorDialog::QTBUG_43548_initialColor()
+{
+ QColorDialog dialog;
+ dialog.setOption(QColorDialog::DontUseNativeDialog);
+ dialog.setCurrentColor(QColor(Qt::red));
+ QColor a(Qt::red);
+ QCOMPARE(a, dialog.currentColor());
+}
+
QTEST_MAIN(tst_QColorDialog)
#include "tst_qcolordialog.moc"
diff --git a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
index 92200618d6..92f768586a 100644
--- a/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
+++ b/tests/auto/widgets/dialogs/qfiledialog/tst_qfiledialog.cpp
@@ -1299,9 +1299,6 @@ void tst_QFiledialog::clearLineEdit()
#endif
QTest::qWait(2000);
-#ifdef Q_OS_MAC
- QEXPECT_FAIL("", "QTBUG-23703", Abort);
-#endif
QVERIFY(fd.directory().absolutePath() != QDir::home().absolutePath());
QVERIFY(!lineEdit->text().isEmpty());
diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
index 6ab93ba6db..0ca836d946 100644
--- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
+++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
@@ -861,9 +861,6 @@ void tst_QTreeView::editTriggers()
}
// Check if we got an editor
-#ifdef Q_OS_MAC
- QEXPECT_FAIL("EditKeyPressed 4", "QTBUG-23696", Continue);
-#endif
QTRY_COMPARE(view.findChild<QLineEdit *>(QString()) != 0, editorOpened);
}
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index 756b22073e..d977f78b23 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -184,6 +184,14 @@ inline void setWindowsAnimationsEnabled(bool) {}
static inline bool windowsAnimationsEnabled() { return false; }
#endif // !Q_OS_WIN || Q_OS_WINCE || Q_OS_WINRT
+template <class T>
+static QByteArray msgComparisonFailed(T v1, const char *op, T v2)
+{
+ QString s;
+ QDebug(&s) << v1 << op << v2;
+ return s.toLocal8Bit();
+}
+
class tst_QWidget : public QObject
{
Q_OBJECT
@@ -1393,11 +1401,13 @@ void tst_QWidget::fonts()
newFont = newFont.resolve( testWidget->font() );
QVERIFY( cleanTestWidget->testAttribute(Qt::WA_SetFont) );
- QVERIFY( cleanTestWidget->font() == newFont );
+ QVERIFY2( cleanTestWidget->font() == newFont,
+ msgComparisonFailed(cleanTestWidget->font(), "==", newFont));
cleanTestWidget->setFont(QFont());
QVERIFY( !cleanTestWidget->testAttribute(Qt::WA_SetFont) );
- QVERIFY( cleanTestWidget->font() == originalFont );
+ QVERIFY2( cleanTestWidget->font() == originalFont,
+ msgComparisonFailed(cleanTestWidget->font(), "==", originalFont));
}
void tst_QWidget::mapFromAndTo_data()
@@ -1820,17 +1830,17 @@ void tst_QWidget::activation()
widget2.show();
QTest::qWait(waitTime);
- QVERIFY(qApp->activeWindow() == &widget2);
+ QCOMPARE(QApplication::activeWindow(), &widget2);
widget2.showMinimized();
QTest::qWait(waitTime);
- QVERIFY(qApp->activeWindow() == &widget1);
+ QCOMPARE(QApplication::activeWindow(), &widget1);
widget2.showMaximized();
QTest::qWait(waitTime);
- QVERIFY(qApp->activeWindow() == &widget2);
+ QCOMPARE(QApplication::activeWindow(), &widget2);
widget2.showMinimized();
QTest::qWait(waitTime);
- QVERIFY(qApp->activeWindow() == &widget1);
+ QCOMPARE(QApplication::activeWindow(), &widget1);
widget2.showNormal();
QTest::qWait(waitTime);
#ifndef Q_OS_WINCE
@@ -1838,10 +1848,10 @@ void tst_QWidget::activation()
QEXPECT_FAIL("", "MS introduced new behavior after XP", Continue);
#endif
QTest::qWait(waitTime);
- QVERIFY(qApp->activeWindow() == &widget2);
+ QCOMPARE(QApplication::activeWindow(), &widget2);
widget2.hide();
QTest::qWait(waitTime);
- QVERIFY(qApp->activeWindow() == &widget1);
+ QCOMPARE(QApplication::activeWindow(), &widget1);
}
#endif // Q_OS_WIN
@@ -2742,13 +2752,13 @@ void tst_QWidget::raise()
QList<QObject *> list1;
list1 << child1 << child2 << child3 << child4;
- QVERIFY(parentPtr->children() == list1);
+ QCOMPARE(parentPtr->children(), list1);
QCOMPARE(allChildren.count(), list1.count());
foreach (UpdateWidget *child, allChildren) {
int expectedPaintEvents = child == child4 ? 1 : 0;
if (expectedPaintEvents == 0) {
- QVERIFY(child->numPaintEvents == 0);
+ QCOMPARE(child->numPaintEvents, 0);
} else {
// show() issues multiple paint events on some window managers
QTRY_VERIFY(child->numPaintEvents >= expectedPaintEvents);
@@ -2771,7 +2781,7 @@ void tst_QWidget::raise()
QList<QObject *> list2;
list2 << child1 << child3 << child4 << child2;
- QVERIFY(parentPtr->children() == list2);
+ QCOMPARE(parentPtr->children(), list2);
// Creates a widget on top of all the children and checks that raising one of
// the children underneath doesn't trigger a repaint on the covering widget.
@@ -2804,7 +2814,7 @@ void tst_QWidget::raise()
QList<QObject *> list3;
list3 << child1 << child4 << child2 << child3;
- QVERIFY(parent->children() == list3);
+ QCOMPARE(parent->children(), list3);
foreach (UpdateWidget *child, allChildren) {
int expectedPaintEvents = 0;
@@ -2846,13 +2856,13 @@ void tst_QWidget::lower()
QList<QObject *> list1;
list1 << child1 << child2 << child3 << child4;
- QVERIFY(parent->children() == list1);
+ QCOMPARE(parent->children(), list1);
QCOMPARE(allChildren.count(), list1.count());
foreach (UpdateWidget *child, allChildren) {
int expectedPaintEvents = child == child4 ? 1 : 0;
if (expectedPaintEvents == 0) {
- QVERIFY(child->numPaintEvents == 0);
+ QCOMPARE(child->numPaintEvents, 0);
} else {
// show() issues multiple paint events on some window managers
QTRY_VERIFY(child->numPaintEvents >= expectedPaintEvents);
@@ -2876,7 +2886,7 @@ void tst_QWidget::lower()
QList<QObject *> list2;
list2 << child4 << child1 << child2 << child3;
- QVERIFY(parent->children() == list2);
+ QCOMPARE(parent->children(), list2);
}
#endif
@@ -2910,7 +2920,7 @@ void tst_QWidget::stackUnder()
QVERIFY(QTest::qWaitForWindowExposed(parent.data()));
QList<QObject *> list1;
list1 << child1 << child2 << child3 << child4;
- QVERIFY(parent->children() == list1);
+ QCOMPARE(parent->children(), list1);
foreach (UpdateWidget *child, allChildren) {
int expectedPaintEvents = child == child4 ? 1 : 0;
@@ -2929,7 +2939,7 @@ void tst_QWidget::stackUnder()
QList<QObject *> list2;
list2 << child1 << child4 << child2 << child3;
- QVERIFY(parent->children() == list2);
+ QCOMPARE(parent->children(), list2);
foreach (UpdateWidget *child, allChildren) {
int expectedPaintEvents = child == child3 ? 1 : 0;
@@ -2945,7 +2955,7 @@ void tst_QWidget::stackUnder()
QList<QObject *> list3;
list3 << child4 << child2 << child1 << child3;
- QVERIFY(parent->children() == list3);
+ QCOMPARE(parent->children(), list3);
foreach (UpdateWidget *child, allChildren) {
int expectedZOrderChangeEvents = child == child1 ? 1 : 0;
@@ -3757,8 +3767,10 @@ void tst_QWidget::setMinimumSize()
w.setMinimumSize(nonDefaultSize);
w.showNormal();
QTest::qWait(50);
- QVERIFY(w.height() >= nonDefaultSize.height());
- QVERIFY(w.width() >= nonDefaultSize.width());
+ QVERIFY2(w.height() >= nonDefaultSize.height(),
+ msgComparisonFailed(w.height(), ">=", nonDefaultSize.height()));
+ QVERIFY2(w.width() >= nonDefaultSize.width(),
+ msgComparisonFailed(w.width(), ">=", nonDefaultSize.width()));
#endif
}
@@ -3810,7 +3822,7 @@ void tst_QWidget::setFixedSize()
QTest::qWait(50);
if (m_platform == QStringLiteral("xcb"))
QSKIP("QTBUG-26424");
- QVERIFY(w.size() == defaultSize + QSize(150,150));
+ QCOMPARE(w.size(), defaultSize + QSize(150,150));
}
void tst_QWidget::ensureCreated()
@@ -4684,8 +4696,9 @@ void tst_QWidget::setWindowGeometry()
void tst_QWidget::setGeometry_win()
{
QWidget widget;
+
setFrameless(&widget);
- widget.setGeometry(0, 600, 100,100);
+ widget.setGeometry(QRect(m_availableTopLeft + QPoint(0, 600), QSize(100, 100)));
widget.show();
widget.setWindowState(widget.windowState() | Qt::WindowMaximized);
QRect geom = widget.normalGeometry();
@@ -4695,8 +4708,10 @@ void tst_QWidget::setGeometry_win()
widget.show();
RECT rt;
::GetWindowRect(winHandleOf(&widget), &rt);
- QVERIFY(rt.left <= 0);
- QVERIFY(rt.top <= 0);
+ QVERIFY2(rt.left <= m_availableTopLeft.x(),
+ msgComparisonFailed(int(rt.left), "<=", m_availableTopLeft.x()));
+ QVERIFY2(rt.top <= m_availableTopLeft.y(),
+ msgComparisonFailed(int(rt.top), "<=", m_availableTopLeft.y()));
}
#endif // defined (Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
@@ -6544,7 +6559,8 @@ void tst_QWidget::renderInvisible()
QPixmap pixmap(topLevel.sizeHint());
topLevel.render(&pixmap); // triggers adjustSize()
const QSize finalSize = topLevel.size();
- QVERIFY(finalSize != initialSize);
+ QVERIFY2(finalSize != initialSize,
+ msgComparisonFailed(finalSize, "!=", initialSize));
topLevel.layout()->removeWidget(widget);
QCOMPARE(topLevel.size(), finalSize);
@@ -7185,7 +7201,7 @@ void tst_QWidget::setContentsMargins()
QSize oldSize = label.sizeHint();
label.setFrameStyle(QFrame::Sunken | QFrame::Box);
QSize newSize = label.sizeHint();
- QVERIFY(oldSize != newSize);
+ QVERIFY2(oldSize != newSize, msgComparisonFailed(oldSize, "!=", newSize));
QLabel label2("why does it always rain on me?");
label2.show();
@@ -7718,8 +7734,10 @@ void tst_QWidget::adjustSize()
child->resize(123, 456);
child->adjustSize();
if (expectedSize == QSize(100000, 100000)) {
- QVERIFY(child->size().width() < sizeHint.width());
- QVERIFY(child->size().height() < sizeHint.height());
+ QVERIFY2(child->size().width() < sizeHint.width(),
+ msgComparisonFailed(child->size().width(), "<", sizeHint.width()));
+ QVERIFY2(child->size().height() < sizeHint.height(),
+ msgComparisonFailed(child->size().height(), "<", sizeHint.height()));
} else {
#if defined (Q_OS_WINCE)
if (!haveParent) {
@@ -9508,8 +9526,10 @@ void tst_QWidget::childAt_unifiedToolBar()
// we use mapToGlobal/mapFromGlobal to re-calculate the corners.
QPoint oldToolBarTopLeft = toolBarTopLeft;
toolBarTopLeft = mainWindow.mapFromGlobal(toolBar->mapToGlobal(QPoint()));
- QVERIFY(toolBarTopLeft != oldToolBarTopLeft);
- QVERIFY(toolBarTopLeft.y() < 0);
+ QVERIFY2(toolBarTopLeft != oldToolBarTopLeft,
+ msgComparisonFailed(toolBarTopLeft, "!=", oldToolBarTopLeft));
+ QVERIFY2(toolBarTopLeft.y() < 0,
+ msgComparisonFailed(toolBarTopLeft.y(), "<", 0));
labelTopLeft = mainWindow.mapFromGlobal(label->mapToGlobal(QPoint()));
QCOMPARE(mainWindow.childAt(toolBarTopLeft), static_cast<QWidget *>(toolBar));
@@ -9740,7 +9760,7 @@ void tst_QWidget::grabKeyboard()
QTest::keyClick(w.windowHandle(), Qt::Key_A);
grabber->releaseKeyboard();
QCOMPARE(grabber->text().toLower(), QStringLiteral("a"));
- QVERIFY(nonGrabber->text().isEmpty());
+ QVERIFY2(nonGrabber->text().isEmpty(), qPrintable(nonGrabber->text()));
}
class TouchMouseWidget : public QWidget {
@@ -10092,7 +10112,7 @@ void tst_QWidget::underMouse()
QVERIFY(QTest::qWaitForWindowExposed(&popupWidget));
QWindow *popupWindow = popupWidget.windowHandle();
QVERIFY(popupWindow);
- QVERIFY(QApplication::activePopupWidget() == &popupWidget);
+ QCOMPARE(QApplication::activePopupWidget(), &popupWidget);
// Send an artificial leave event for window, as it won't get generated automatically
// due to cursor not actually being over the window.
@@ -10365,13 +10385,15 @@ void tst_QWidget::largerThanScreen_QTBUG30142()
widget.resize(200, 4000);
widget.show();
QVERIFY(QTest::qWaitForWindowExposed(&widget));
- QVERIFY(widget.frameGeometry().y() >= 0);
+ QVERIFY2(widget.frameGeometry().y() >= 0,
+ msgComparisonFailed(widget.frameGeometry().y(), " >=", 0));
QWidget widget2;
widget2.resize(10000, 400);
widget2.show();
QVERIFY(QTest::qWaitForWindowExposed(&widget2));
- QVERIFY(widget2.frameGeometry().x() >= 0);
+ QVERIFY2(widget2.frameGeometry().x() >= 0,
+ msgComparisonFailed(widget.frameGeometry().x(), " >=", 0));
}
void tst_QWidget::resizeStaticContentsChildWidget_QTBUG35282()
@@ -10386,13 +10408,14 @@ void tst_QWidget::resizeStaticContentsChildWidget_QTBUG35282()
widget.showNormal();
QVERIFY(QTest::qWaitForWindowExposed(&widget));
- QVERIFY(childWidget.numPaintEvents == 0);
+ QCOMPARE(childWidget.numPaintEvents, 0);
childWidget.reset();
widget.resize(1000,1000);
QVERIFY(QTest::qWaitForWindowExposed(&widget));
QGuiApplication::sync();
- QVERIFY(childWidget.numPaintEvents >= 1);
+ QVERIFY2(childWidget.numPaintEvents >= 1,
+ msgComparisonFailed(childWidget.numPaintEvents, ">=", 1));
}
QTEST_MAIN(tst_QWidget)
diff --git a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp
index 1d6e75e76e..f8f3900372 100644
--- a/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp
+++ b/tests/auto/widgets/util/qcompleter/tst_qcompleter.cpp
@@ -601,6 +601,9 @@ void tst_QCompleter::directoryModel_data()
QTest::newRow("()") << "" << "" << "/" << "/";
QTest::newRow("(/a)") << "/a" << "" << "Applications" << "/Applications";
QTest::newRow("(/u)") << "/u" << "" << "Users" << "/Users";
+#elif defined(Q_OS_ANDROID)
+ QTest::newRow("()") << "" << "" << "/" << "/";
+ QTest::newRow("(/et)") << "/et" << "" << "etc" << "/etc";
#else
QTest::newRow("()") << "" << "" << "/" << "/";
#if !defined(Q_OS_IRIX) && !defined(Q_OS_AIX) && !defined(Q_OS_HPUX) && !defined(Q_OS_QNX)
@@ -647,6 +650,9 @@ void tst_QCompleter::fileSystemModel_data()
QTest::newRow("()") << "" << "" << "/" << "/";
QTest::newRow("(/a)") << "/a" << "" << "Applications" << "/Applications";
// QTest::newRow("(/d)") << "/d" << "" << "Developer" << "/Developer";
+#elif defined(Q_OS_ANDROID)
+ QTest::newRow("()") << "" << "" << "/" << "/";
+ QTest::newRow("(/et)") << "/et" << "" << "etc" << "/etc";
#else
QTest::newRow("()") << "" << "" << "/" << "/";
#if !defined(Q_OS_IRIX) && !defined(Q_OS_AIX) && !defined(Q_OS_HPUX) && !defined(Q_OS_QNX)
diff --git a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp
index d8e7fb7a99..cf495e2238 100644
--- a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp
+++ b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp
@@ -148,6 +148,7 @@ private slots:
#endif
void layoutAfterMultiLineRemove();
void undoCommandRemovesAndReinsertsBlock();
+ void taskQTBUG_43562_lineCountCrash();
private:
void createSelection();
@@ -1629,5 +1630,37 @@ void tst_QPlainTextEdit::undoCommandRemovesAndReinsertsBlock()
}
+class ContentsChangedFunctor {
+public:
+ ContentsChangedFunctor(QPlainTextEdit *t) : textEdit(t) {}
+ void operator()(int, int, int)
+ {
+ QTextCursor c(textEdit->textCursor());
+ c.beginEditBlock();
+ c.movePosition(QTextCursor::Start);
+ c.movePosition(QTextCursor::End, QTextCursor::KeepAnchor);
+ c.setCharFormat(QTextCharFormat());
+ c.endEditBlock();
+ }
+
+private:
+ QPlainTextEdit *textEdit;
+};
+
+void tst_QPlainTextEdit::taskQTBUG_43562_lineCountCrash()
+{
+ connect(ed->document(), &QTextDocument::contentsChange, ContentsChangedFunctor(ed));
+ // Don't crash
+ QTest::keyClicks(ed, "Some text");
+ QTest::keyClick(ed, Qt::Key_Left);
+ QTest::keyClick(ed, Qt::Key_Right);
+ QTest::keyClick(ed, Qt::Key_A);
+ QTest::keyClick(ed, Qt::Key_Left);
+ QTest::keyClick(ed, Qt::Key_Right);
+ QTest::keyClick(ed, Qt::Key_Space);
+ QTest::keyClicks(ed, "nd some more");
+ disconnect(ed->document(), SIGNAL(contentsChange(int, int, int)), 0, 0);
+}
+
QTEST_MAIN(tst_QPlainTextEdit)
#include "tst_qplaintextedit.moc"
diff --git a/tests/manual/diaglib/nativewindowdump_win.cpp b/tests/manual/diaglib/nativewindowdump_win.cpp
index 814b580f4b..a8e715583d 100644
--- a/tests/manual/diaglib/nativewindowdump_win.cpp
+++ b/tests/manual/diaglib/nativewindowdump_win.cpp
@@ -166,7 +166,7 @@ static void dumpNativeWindows(const WIdVector& wins)
dc.stream = QSharedPointer<QTextStream>(new QTextStream(&s));
foreach (WId win, wins)
dumpNativeWindowRecursion(reinterpret_cast<HWND>(win), &dc);
-#if QT_VERSION > 0x050000
+#if QT_VERSION >= 0x050400
qDebug().noquote() << s;
#else
qDebug("%s", qPrintable(s));
diff --git a/tests/manual/diaglib/qwidgetdump.cpp b/tests/manual/diaglib/qwidgetdump.cpp
index d4f985c7c8..894f51bce3 100644
--- a/tests/manual/diaglib/qwidgetdump.cpp
+++ b/tests/manual/diaglib/qwidgetdump.cpp
@@ -84,7 +84,7 @@ void dumpAllWidgets(FormatWindowOptions options)
str << "### QWidgets:\n";
foreach (QWidget *tw, QApplication::topLevelWidgets())
dumpWidgetRecursion(str, tw, options);
-#if QT_VERSION > 0x050000
+#if QT_VERSION >= 0x050400
qDebug().noquote() << d;
#else
qDebug("%s", qPrintable(d));
diff --git a/tests/manual/diaglib/qwindowdump.cpp b/tests/manual/diaglib/qwindowdump.cpp
index 2ecc52ca77..228472cd44 100644
--- a/tests/manual/diaglib/qwindowdump.cpp
+++ b/tests/manual/diaglib/qwindowdump.cpp
@@ -157,7 +157,11 @@ void dumpAllWindows(FormatWindowOptions options)
str << "### QWindows:\n";
foreach (QWindow *w, QGuiApplication::topLevelWindows())
dumpWindowRecursion(str, w, options);
+#if QT_VERSION >= 0x050400
qDebug().noquote() << d;
+#else
+ qDebug() << d;
+#endif
}
#else // Qt 5
diff --git a/tests/manual/windowflags/controllerwindow.cpp b/tests/manual/windowflags/controllerwindow.cpp
index 5c06a9a646..2fcc205ca7 100644
--- a/tests/manual/windowflags/controllerwindow.cpp
+++ b/tests/manual/windowflags/controllerwindow.cpp
@@ -137,7 +137,10 @@ void ControllerWindow::updatePreview()
parentWindow->hide();
}
- previewWidget->setWindowFlags(flags);
+ if (previewWidgetButton->isChecked())
+ previewWindow->setWindowFlags(flags);
+ else
+ previewDialog->setWindowFlags(flags);
if (fixedSizeWindowCheckBox->isChecked()) {
previewWidget->setFixedSize(300, 300);