diff options
21 files changed, 161 insertions, 52 deletions
diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf index 90e318e2a4..d16b3cf1be 100644 --- a/mkspecs/features/qt.prf +++ b/mkspecs/features/qt.prf @@ -231,7 +231,7 @@ for(ever) { !isEmpty(MODULE_MODULE) { contains(MODULE_CONFIG, lib_bundle) { framework = $$MODULE_MODULE - qtConfig(debug_and_release):!macx-xcode { + qtConfig(debug_and_release):qt_link_suffixed_framework:!macx-xcode { platform_target_suffix = $$qtPlatformTargetSuffix() !isEmpty(platform_target_suffix): \ # The -framework linker argument supports a name[,suffix] version, diff --git a/mkspecs/features/qt_configure.prf b/mkspecs/features/qt_configure.prf index 44d8a3e639..d75365cd0a 100644 --- a/mkspecs/features/qt_configure.prf +++ b/mkspecs/features/qt_configure.prf @@ -709,6 +709,13 @@ defineTest(qtConfLibrary_pkgConfig) { eval(libs = $$libpaths $$libs) !qtConfResolveLibs($${1}.libs, $$libs): \ return(false) + contains($${1}.libs, ".*\\.$${QMAKE_EXTENSION_STATICLIB}$") { + qtRunLoggedCommand("$$pkg_config --static --libs-only-L $$args", libpaths)|return(false) + qtRunLoggedCommand("$$pkg_config --static --libs-only-l $$args", libs)|return(false) + eval(libs = $$libpaths $$libs) + !qtConfResolveLibs($${1}.libs, $$libs): \ + return(false) + } qtRunLoggedCommand("$$pkg_config --cflags $$args", $${1}.cflags)|return(false) # Split CFLAGS into stuff that goes into DEFINES, INCLUDEPATH, and other stuff. diff --git a/mkspecs/features/testcase.prf b/mkspecs/features/testcase.prf index 79883b7f09..bfc28c6861 100644 --- a/mkspecs/features/testcase.prf +++ b/mkspecs/features/testcase.prf @@ -21,6 +21,9 @@ testcase_lowdpi { } } +# Make sure we explicitly link to the debug version of the Qt libraries if needed +macos: CONFIG += qt_link_suffixed_framework + benchmark: type = benchmark else: type = check diff --git a/src/3rdparty/angle/id/commit.h b/src/3rdparty/angle/id/commit.h index 4c89a657c5..d5446432f7 100644 --- a/src/3rdparty/angle/id/commit.h +++ b/src/3rdparty/angle/id/commit.h @@ -7,8 +7,8 @@ // This is a default commit hash header, when git is not available. // -#define ANGLE_COMMIT_HASH "unknown hash" +#define ANGLE_COMMIT_HASH "57ea533f79a7" #define ANGLE_COMMIT_HASH_SIZE 12 -#define ANGLE_COMMIT_DATE "unknown date" +#define ANGLE_COMMIT_DATE "2017-11-22 14:04:48 -0800" #define ANGLE_DISABLE_PROGRAM_BINARY_LOAD diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java index 8f218d34f0..74b515ef5b 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java @@ -674,6 +674,13 @@ public class QtActivityDelegate Bundle extras = m_activity.getIntent().getExtras(); if (extras != null) { try { + // do NOT remove !!!! + final String dc = "--Added-by-androiddeployqt--/debugger.command"; + new BufferedReader(new InputStreamReader(m_activity.getAssets().open(dc))).readLine(); + // do NOT remove !!!! + // The previous lines are needed to check if the debug mode is enabled. + // We are not allowed to use extraenvvars or extraappparams in a non debuggable environment. + if (extras.containsKey("extraenvvars")) { try { m_environmentVariables += "\t" + new String(Base64.decode(extras.getString("extraenvvars"), Base64.DEFAULT), "UTF-8"); diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 74ec1801d0..d2887ee184 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -1599,12 +1599,14 @@ bool QConfFileSettingsPrivate::readIniLine(const QByteArray &data, int &dataPos, int i = lineStart; while (i < dataLen) { - while (!(charTraits[uint(uchar(data.at(i)))] & Special)) { + char ch = data.at(i); + while (!(charTraits[uchar(ch)] & Special)) { if (++i == dataLen) goto break_out_of_outer_loop; + ch = data.at(i); } - char ch = data.at(i++); + ++i; if (ch == '=') { if (!inQuotes && equalsPos == -1) equalsPos = i - 1; @@ -1631,9 +1633,10 @@ bool QConfFileSettingsPrivate::readIniLine(const QByteArray &data, int &dataPos, Q_ASSERT(ch == ';'); if (i == lineStart + 1) { - char ch; while (i < dataLen && (((ch = data.at(i)) != '\n') && ch != '\r')) ++i; + while (i < dataLen && charTraits[uchar(data.at(i))] & Space) + ++i; lineStart = i; } else if (!inQuotes) { --i; diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index d3f60eea4f..05bc064005 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -650,6 +650,13 @@ QThread::Priority QThread::priority() const Forces the current thread to sleep for \a secs seconds. + Avoid using this function if you need to wait for a given condition to + change. Instead, connect a slot to the signal that indicates the change or + use an event handler (see \l QObject::event()). + + \note This function does not guarantee accuracy. The application may sleep + longer than \a secs under heavy load conditions. + \sa msleep(), usleep() */ @@ -658,6 +665,14 @@ QThread::Priority QThread::priority() const Forces the current thread to sleep for \a msecs milliseconds. + Avoid using this function if you need to wait for a given condition to + change. Instead, connect a slot to the signal that indicates the change or + use an event handler (see \l QObject::event()). + + \note This function does not guarantee accuracy. The application may sleep + longer than \a msecs under heavy load conditions. Some OSes might round \a + msecs up to 10 ms or 15 ms. + \sa sleep(), usleep() */ @@ -666,6 +681,15 @@ QThread::Priority QThread::priority() const Forces the current thread to sleep for \a usecs microseconds. + Avoid using this function if you need to wait for a given condition to + change. Instead, connect a slot to the signal that indicates the change or + use an event handler (see \l QObject::event()). + + \note This function does not guarantee accuracy. The application may sleep + longer than \a usecs under heavy load conditions. Some OSes might round \a + usecs up to 10 ms or 15 ms; on Windows, it will be rounded up to a multiple + of 1 ms. + \sa sleep(), msleep() */ diff --git a/src/gui/configure.json b/src/gui/configure.json index 25ff553876..6a2f1fe434 100644 --- a/src/gui/configure.json +++ b/src/gui/configure.json @@ -618,16 +618,6 @@ { "type": "pkgConfig", "args": "xkbcommon-x11" } ] }, - "xkbcommon_evdev": { - "label": "xkbcommon_evdev TRANSITION HACK", - "test": { - "include": [ "xkbcommon/xkbcommon.h" ], - "main": "xkb_context_new(XKB_CONTEXT_NO_FLAGS);" - }, - "sources": [ - { "type": "pkgConfig", "args": "xkbcommon >= 0.5.0" } - ] - }, "xrender": { "label": "XRender for native painting", "test": "x11/xrender", @@ -1378,11 +1368,6 @@ "condition": "libs.xkbcommon", "output": [ "privateFeature" ] }, - "xkbcommon-evdev": { - "label": "xkbcommon-evdev TRANSITION HACK", - "condition": "libs.xkbcommon_evdev", - "output": [ "privateFeature" ] - }, "xlib": { "label": "XLib", "autoDetect": "!config.darwin || features.xcb", diff --git a/src/gui/image/qiconengine.h b/src/gui/image/qiconengine.h index 0c67ef2686..0c5b51dc71 100644 --- a/src/gui/image/qiconengine.h +++ b/src/gui/image/qiconengine.h @@ -90,6 +90,7 @@ public: QPixmap pixmap; }; + // ### Qt6: move content to proper virtual functions virtual void virtual_hook(int id, void *data); private: diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp index 8750a841f6..ed2235ad28 100644 --- a/src/network/access/qnetworkreplyhttpimpl.cpp +++ b/src/network/access/qnetworkreplyhttpimpl.cpp @@ -1676,13 +1676,13 @@ QNetworkCacheMetaData QNetworkReplyHttpImplPrivate::fetchCacheMetaData(const QNe || header == "content-range" || header == "content-type") continue; - - // For MS servers that send "Content-Length: 0" on 304 responses - // ignore this too - if (header == "content-length") - continue; } + // IIS has been known to send "Content-Length: 0" on 304 responses, so + // ignore this too + if (header == "content-length" && statusCode == 304) + continue; + #if defined(QNETWORKACCESSHTTPBACKEND_DEBUG) QByteArray n = q->rawHeader(header); QByteArray o; diff --git a/src/platformsupport/input/libinput/qlibinputkeyboard_p.h b/src/platformsupport/input/libinput/qlibinputkeyboard_p.h index 9e09bccd79..14ae71b545 100644 --- a/src/platformsupport/input/libinput/qlibinputkeyboard_p.h +++ b/src/platformsupport/input/libinput/qlibinputkeyboard_p.h @@ -43,7 +43,9 @@ #include <QtCore/QPoint> #include <QtCore/QTimer> -#ifndef QT_NO_XKBCOMMON_EVDEV +#include <QtGui/private/qtguiglobal_p.h> + +#if QT_CONFIG(xkbcommon) #include <xkbcommon/xkbcommon.h> #endif @@ -70,7 +72,7 @@ public: void processKey(libinput_event_keyboard *e); -#ifndef QT_NO_XKBCOMMON_EVDEV +#if QT_CONFIG(xkbcommon) void handleRepeat(); private: diff --git a/src/plugins/imageformats/jpeg/qjpeghandler.cpp b/src/plugins/imageformats/jpeg/qjpeghandler.cpp index e52a19703c..54fe857908 100644 --- a/src/plugins/imageformats/jpeg/qjpeghandler.cpp +++ b/src/plugins/imageformats/jpeg/qjpeghandler.cpp @@ -56,13 +56,12 @@ // including jpeglib.h seems to be a little messy extern "C" { -// mingw includes rpcndr.h but does not define boolean -#if defined(Q_OS_WIN) && defined(Q_CC_GNU) -# if defined(__RPCNDR_H__) && !defined(boolean) - typedef unsigned char boolean; -# define HAVE_BOOLEAN -# endif +// jpeglib.h->jmorecfg.h tries to typedef int boolean; but this conflicts with +// some Windows headers that may or may not have been included +#ifdef HAVE_BOOLEAN +# undef HAVE_BOOLEAN #endif +#define boolean jboolean #define XMD_H // shut JPEGlib up #include <jpeglib.h> diff --git a/src/plugins/platforms/windows/qwindowspointerhandler.cpp b/src/plugins/platforms/windows/qwindowspointerhandler.cpp index 0bac382a90..7935d0c36f 100644 --- a/src/plugins/platforms/windows/qwindowspointerhandler.cpp +++ b/src/plugins/platforms/windows/qwindowspointerhandler.cpp @@ -187,6 +187,12 @@ static bool draggingActive() bool QWindowsPointerHandler::translatePointerEvent(QWindow *window, HWND hwnd, QtWindows::WindowsEventType et, MSG msg, LRESULT *result) { *result = 0; + + // If we are inside the move/resize modal loop, let DefWindowProc() handle it (but process NC button release). + QWindowsWindow *platformWindow = static_cast<QWindowsWindow *>(window->handle()); + if (msg.message != WM_NCPOINTERUP && platformWindow->testFlag(QWindowsWindow::ResizeMoveActive)) + return false; + const quint32 pointerId = GET_POINTERID_WPARAM(msg.wParam); POINTER_INPUT_TYPE pointerType; @@ -195,6 +201,18 @@ bool QWindowsPointerHandler::translatePointerEvent(QWindow *window, HWND hwnd, Q return false; } + // Handle non-client pen/touch as generic mouse events for compatibility with QDockWindow. + if ((pointerType == QT_PT_TOUCH || pointerType == QT_PT_PEN) && (et & QtWindows::NonClientEventFlag)) { + POINTER_INFO pointerInfo; + if (!QWindowsContext::user32dll.getPointerInfo(pointerId, &pointerInfo)) { + qWarning() << "GetPointerInfo() failed:" << qt_error_string(); + return false; + } + if (pointerInfo.pointerFlags & (POINTER_FLAG_UP | POINTER_FLAG_DOWN)) + return translateMouseTouchPadEvent(window, hwnd, et, msg, &pointerInfo); + return false; + } + switch (pointerType) { case QT_PT_POINTER: case QT_PT_MOUSE: @@ -564,6 +582,7 @@ bool QWindowsPointerHandler::translateTouchEvent(QWindow *window, HWND hwnd, QList<QWindowSystemInterface::TouchPoint> touchPoints; bool primaryPointer = false; + bool pressRelease = false; if (QWindowsContext::verbose > 1) qCDebug(lcQpaEvents).noquote().nospace() << showbase @@ -600,9 +619,11 @@ bool QWindowsPointerHandler::translateTouchEvent(QWindow *window, HWND hwnd, if (touchInfo[i].pointerInfo.pointerFlags & POINTER_FLAG_DOWN) { touchPoint.state = Qt::TouchPointPressed; m_lastTouchPositions.insert(touchPoint.id, touchPoint.normalPosition); + pressRelease = true; } else if (touchInfo[i].pointerInfo.pointerFlags & POINTER_FLAG_UP) { touchPoint.state = Qt::TouchPointReleased; m_lastTouchPositions.remove(touchPoint.id); + pressRelease = true; } else { touchPoint.state = stationaryTouchPoint ? Qt::TouchPointStationary : Qt::TouchPointMoved; m_lastTouchPositions.insert(touchPoint.id, touchPoint.normalPosition); @@ -615,7 +636,7 @@ bool QWindowsPointerHandler::translateTouchEvent(QWindow *window, HWND hwnd, // Avoid getting repeated messages for this frame if there are multiple pointerIds QWindowsContext::user32dll.skipPointerFrameMessages(touchInfo[i].pointerInfo.pointerId); } - if (primaryPointer) { + if (primaryPointer && !pressRelease) { // Postpone event delivery to avoid hanging inside DoDragDrop(). // Only the primary pointer will generate mouse messages. enqueueTouchEvent(window, touchPoints, QWindowsKeyMapper::queryKeyboardModifiers()); diff --git a/src/testlib/qtest.h b/src/testlib/qtest.h index 82078ad7a8..900050f012 100644 --- a/src/testlib/qtest.h +++ b/src/testlib/qtest.h @@ -49,6 +49,7 @@ #include <QtCore/qbytearray.h> #include <QtCore/qstring.h> #include <QtCore/qstringlist.h> +#include <QtCore/qcborcommon.h> #include <QtCore/qdatetime.h> #include <QtCore/qobject.h> #include <QtCore/qvariant.h> @@ -110,6 +111,12 @@ template<> inline char *toString(const QDateTime &dateTime) } #endif // datestring +template<> inline char *toString(const QCborError &c) +{ + // use the Q_ENUM formatting + return toString(c.c); +} + template<> inline char *toString(const QChar &c) { const ushort uc = c.unicode(); diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp index e81eab4c46..3a9bfab298 100644 --- a/src/widgets/graphicsview/qgraphicsitem.cpp +++ b/src/widgets/graphicsview/qgraphicsitem.cpp @@ -10569,14 +10569,11 @@ void QGraphicsTextItemPrivate::_q_update(QRectF rect) */ void QGraphicsTextItemPrivate::_q_updateBoundingRect(const QSizeF &size) { - if (!control) return; // can't happen - const QSizeF pageSize = control->document()->pageSize(); - // paged items have a constant (page) size - if (size == boundingRect.size() || pageSize.height() != -1) - return; - qq->prepareGeometryChange(); - boundingRect.setSize(size); - qq->update(); + if (size != boundingRect.size()) { + qq->prepareGeometryChange(); + boundingRect.setSize(size); + qq->update(); + } } /*! diff --git a/src/widgets/util/qscroller.cpp b/src/widgets/util/qscroller.cpp index e229a885a8..abb203b8cc 100644 --- a/src/widgets/util/qscroller.cpp +++ b/src/widgets/util/qscroller.cpp @@ -1725,10 +1725,12 @@ void QScrollerPrivate::setState(QScroller::State newstate) sendEvent(target, &se); firstScroll = true; } - if (state == QScroller::Dragging || state == QScroller::Scrolling) - qt_activeScrollers()->push_back(q); - else + if (state == QScroller::Dragging || state == QScroller::Scrolling) { + if (!qt_activeScrollers()->contains(q)) + qt_activeScrollers()->push_back(q); + } else { qt_activeScrollers()->removeOne(q); + } emit q->stateChanged(state); } diff --git a/src/widgets/widgets/qwidgetlinecontrol_p.h b/src/widgets/widgets/qwidgetlinecontrol_p.h index b730b415f0..f4df95865d 100644 --- a/src/widgets/widgets/qwidgetlinecontrol_p.h +++ b/src/widgets/widgets/qwidgetlinecontrol_p.h @@ -280,6 +280,13 @@ public: cancelPasswordEchoTimer(); m_echoMode = mode; m_passwordEchoEditing = false; + + // If this control is used for password input, we want to minimize + // the possibility of string reallocation not to leak (parts of) + // the password. + if (m_echoMode != QLineEdit::Normal) + m_text.reserve(30); + updateDisplayText(); } diff --git a/tests/auto/corelib/io/qsettings/qsettings.qrc b/tests/auto/corelib/io/qsettings/qsettings.qrc index c664a6f68c..db1d8c663f 100644 --- a/tests/auto/corelib/io/qsettings/qsettings.qrc +++ b/tests/auto/corelib/io/qsettings/qsettings.qrc @@ -7,5 +7,6 @@ <file>resourcefile5.ini</file> <file>resourcefile6.plist</file> <file>bom.ini</file> + <file>withcomments.ini</file> </qresource> </RCC> diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp index 5357194406..8b69518ef7 100644 --- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp +++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp @@ -187,6 +187,7 @@ private slots: void bom(); void embeddedZeroByte_data(); void embeddedZeroByte(); + void spaceAfterComment(); void testXdg(); private: @@ -764,6 +765,34 @@ void tst_QSettings::embeddedZeroByte() } } +void tst_QSettings::spaceAfterComment() +{ + QSettings settings(QFINDTESTDATA("withcomments.ini"), QSettings::IniFormat); + QCOMPARE(settings.status(), QSettings::NoError); + + QStringList groups = settings.childGroups(); + QVERIFY(groups.contains("Regular")); + QVERIFY(groups.contains("WithSpaces")); + QVERIFY(groups.contains("WithTab")); + QVERIFY(groups.contains("SpacedGroup")); + + settings.beginGroup("Regular"); + QCOMPARE(settings.value("bar"), QVariant(2)); + settings.endGroup(); + + settings.beginGroup("WithSpaces"); + QCOMPARE(settings.value("bar"), QVariant(4)); + settings.endGroup(); + + settings.beginGroup("WithTab"); + QCOMPARE(settings.value("bar"), QVariant(6)); + settings.endGroup(); + + settings.beginGroup("SpacedGroup"); + QCOMPARE(settings.value("bar"), QVariant(7)); + settings.endGroup(); +} + void tst_QSettings::testErrorHandling_data() { QTest::addColumn<int>("filePerms"); // -1 means file should not exist diff --git a/tests/auto/corelib/io/qsettings/withcomments.ini b/tests/auto/corelib/io/qsettings/withcomments.ini new file mode 100644 index 0000000000..d2de3a356b --- /dev/null +++ b/tests/auto/corelib/io/qsettings/withcomments.ini @@ -0,0 +1,19 @@ +; -*- conf -*- +; If you edit this file, make sure, that "WithSpaces" has spaces and that +; "WithTab" has one tab + +[Regular] +;bar = 1 +bar = 2 + +[WithSpaces] +;bar = 3 + bar = 4 + +[WithTab] +;bar = 5 + bar = 6 + +; [SpacedGroup] + [SpacedGroup] + bar = 7 diff --git a/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp b/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp index 00b22dab6c..2d65d3433f 100644 --- a/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp +++ b/tests/auto/corelib/tools/qcollator/tst_qcollator.cpp @@ -96,11 +96,6 @@ void tst_QCollator::compare_data() QTest::addColumn<int>("punctuationResult"); /* - A few tests below are commented out on the mac. It's unclear why they fail, - as it looks like the collator for the locale is created correctly. - */ - - /* It's hard to test English, because it's treated differently on different platforms. For example, on Linux, it uses the iso14651_t1 template file, which happens to provide good @@ -164,7 +159,7 @@ void tst_QCollator::compare_data() QTest::newRow("german13") << QString("de_DE") << QString("test.19") << QString("test,19") << 1 << 1 << true << true << 0; /* - French sorting of e and e with accent + French sorting of e and e with acute accent */ QTest::newRow("french1") << QString("fr_FR") << QString::fromLatin1("\xe9") << QString::fromLatin1("e") << 1 << 1 << false << false << 1; QTest::newRow("french2") << QString("fr_FR") << QString::fromLatin1("\xe9t") << QString::fromLatin1("et") << 1 << 1 << false << false << 1; |