diff options
author | Liang Qi <liang.qi@qt.io> | 2017-12-05 13:32:35 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-12-05 13:37:21 +0100 |
commit | 53b141dcebc2ca423dbc31e5b6321a769155e9a4 (patch) | |
tree | e62c7d9875acab8094d64d137c90e7e5f53c0893 | |
parent | 2c6c044500a92a3a125ce4b5d936992bdf02a487 (diff) | |
parent | 6508fdca1dcc7105947befadba272d0fd4bbc27f (diff) |
Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts:
src/plugins/platforms/ios/quiview.mm
Change-Id: I88384c70047391c75d9ff166c8d9881ff6751dbf
28 files changed, 143 insertions, 103 deletions
diff --git a/mkspecs/common/msvc-desktop.conf b/mkspecs/common/msvc-desktop.conf index f7f7e54d26..20f594c601 100644 --- a/mkspecs/common/msvc-desktop.conf +++ b/mkspecs/common/msvc-desktop.conf @@ -1,10 +1,14 @@ # -# qmake configuration for Microsoft Visual Studio C/C++ Compiler -# This mkspec is used by the win32-msvc and win32-clang-msvc specs +# This file is used as a basis for the following compilers: # - +# - Microsoft C/C++ Optimizing Compiler (all desktop versions) +# - Intel C++ Compiler on Windows +# - Clang-cl +# +# Baseline: +# +# - Visual Studio 2005 (8.0), VC++ 14.0 # -# Baseline: Visual Studio 2005 (8.0), VC++ 14.0 # Version-specific settings go in msvc-version.conf (loaded by default_pre) # diff --git a/mkspecs/win32-g++/qmake.conf b/mkspecs/win32-g++/qmake.conf index 884286ea30..36ec1c5c78 100644 --- a/mkspecs/win32-g++/qmake.conf +++ b/mkspecs/win32-g++/qmake.conf @@ -1,7 +1,7 @@ # # qmake configuration for win32-g++ # -# Written for MinGW / gcc 4.6 or higher +# Written for MinGW-w64 / gcc 5.3 or higher # # Cross compile example for i686-w64-mingw32-g++: # configure -xplatform win32-g++ -device-option CROSS_COMPILE=i686-w64-mingw32- diff --git a/mkspecs/win32-icc/qmake.conf b/mkspecs/win32-icc/qmake.conf index 863fd77ea9..8c14a6609e 100644 --- a/mkspecs/win32-icc/qmake.conf +++ b/mkspecs/win32-icc/qmake.conf @@ -1,16 +1,17 @@ # # qmake configuration for win32-icc # -# Written for Intel C++ +# Written for Intel C++ Compiler on Windows / icl 16.0 or higher # -# Use the Visual Studio configuration +# Use the Microsoft (R) C/C++ Optimizing Compiler configuration, +# since ICC on Windows pretends to be MSVC include(../common/msvc-desktop.conf) -# Now override with the Intel compiler settings +# modifications to msvc-desktop.conf -QMAKE_COMPILER += intel_icl # icl pretends to be msvc +QMAKE_COMPILER += intel_icl QMAKE_CC = icl QMAKE_CFLAGS = -nologo -Zm200 /Qprec /Qwd1744,1738,809,3373 diff --git a/mkspecs/win32-msvc/qmake.conf b/mkspecs/win32-msvc/qmake.conf index 1d8b8f0e97..5c38330add 100644 --- a/mkspecs/win32-msvc/qmake.conf +++ b/mkspecs/win32-msvc/qmake.conf @@ -1,7 +1,7 @@ # # qmake configuration for win32-msvc # -# Written for Microsoft Visual C++ (all desktop versions) +# Written for Microsoft C/C++ Optimizing Compiler (all desktop versions) # include(../common/msvc-desktop.conf) diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp index 0173311bc6..5118bdbe9c 100644 --- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp +++ b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp @@ -2645,7 +2645,7 @@ bool Renderer11::getShareHandleSupport() const if (deviceType == d3d11::ANGLE_D3D11_DEVICE_TYPE_WARP) { -#if !defined(ANGLE_ENABLE_WINDOWS_STORE) && !defined(__GNUC__) +#ifndef ANGLE_ENABLE_WINDOWS_STORE if (!IsWindows8OrGreater()) { // WARP on Windows 7 doesn't support shared handles diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java index f15c7f3a97..1cf3bca5f7 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java @@ -500,15 +500,16 @@ public class QtNative } } - static public void sendGenericMotionEvent(MotionEvent event, int id) + static public boolean sendGenericMotionEvent(MotionEvent event, int id) { if (event.getActionMasked() != MotionEvent.ACTION_SCROLL || (event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != InputDevice.SOURCE_CLASS_POINTER) { - return; + return false; } mouseWheel(id, (int) event.getX(), (int) event.getY(), event.getAxisValue(MotionEvent.AXIS_HSCROLL), event.getAxisValue(MotionEvent.AXIS_VSCROLL)); + return true; } public static Context getContext() { diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java b/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java index e994002dd3..08b5a80f7e 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java @@ -116,7 +116,6 @@ public class QtSurface extends SurfaceView implements SurfaceHolder.Callback @Override public boolean onGenericMotionEvent(MotionEvent event) { - QtNative.sendGenericMotionEvent(event, getId()); - return true; + return QtNative.sendGenericMotionEvent(event, getId()); } } diff --git a/src/angle/patches/0002-ANGLE-Fix-compilation-with-MinGW.patch b/src/angle/patches/0002-ANGLE-Fix-compilation-with-MinGW.patch index dc091b0497..f42ff2141b 100644 --- a/src/angle/patches/0002-ANGLE-Fix-compilation-with-MinGW.patch +++ b/src/angle/patches/0002-ANGLE-Fix-compilation-with-MinGW.patch @@ -405,15 +405,6 @@ index ea84783..62badcc 100644 if (mD3d11Module) { -@@ -2618,7 +2642,7 @@ bool Renderer11::getShareHandleSupport() const - - if (deviceType == d3d11::ANGLE_D3D11_DEVICE_TYPE_WARP) - { --#ifndef ANGLE_ENABLE_WINDOWS_STORE -+#if !defined(ANGLE_ENABLE_WINDOWS_STORE) && !defined(__GNUC__) - if (!IsWindows8OrGreater()) - { - // WARP on Windows 7 doesn't support shared handles diff --git a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.h b/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.h index 62e9816..b4e7761 100644 --- a/src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.h diff --git a/src/corelib/doc/snippets/qstring/main.cpp b/src/corelib/doc/snippets/qstring/main.cpp index 3d09e3618e..63918afbcd 100644 --- a/src/corelib/doc/snippets/qstring/main.cpp +++ b/src/corelib/doc/snippets/qstring/main.cpp @@ -810,6 +810,18 @@ void Widget::splitCaseSensitiveFunction() QStringList list2 = str.split(',', QString::SkipEmptyParts); // list2: [ "a", "b", "c" ] //! [62] + + //! [62-empty] + QString str = "abc"; + auto parts = str.split(""); + // parts: {"", "a", "b", "c", ""} + //! [62-empty] + + //! [62-slashes] + QString str = "/a/b/c/"; + auto parts = str.split('/'); + // parts: {"", "a", "b", "c", ""} + //! [62-slashes] } void Widget::sprintfFunction() diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index c01052e152..7e8a8dca9a 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -7246,6 +7246,16 @@ static ResultList splitString(const StringSource &source, const QChar *sep, \snippet qstring/main.cpp 62 + If \a sep is empty, split() returns an empty string, followed + by each of the string's characters, followed by another empty string: + + \snippet qstring/main.cpp 62-empty + + To understand this behavior, recall that the empty string matches + everywhere, so the above is qualitatively the same as: + + \snippet qstring/main.cpp 62-slashes + \sa QStringList::join(), section() */ QStringList QString::split(const QString &sep, SplitBehavior behavior, Qt::CaseSensitivity cs) const @@ -7255,15 +7265,10 @@ QStringList QString::split(const QString &sep, SplitBehavior behavior, Qt::CaseS /*! Splits the string into substring references wherever \a sep occurs, and - returns the list of those strings. If \a sep does not match - anywhere in the string, splitRef() returns a single-element vector - containing this string reference. - - \a cs specifies whether \a sep should be matched case - sensitively or case insensitively. + returns the list of those strings. - If \a behavior is QString::SkipEmptyParts, empty entries don't - appear in the result. By default, empty entries are kept. + See QString::split() for how \a sep, \a behavior and \a cs interact to form + the result. \note All references are valid as long this string is alive. Destroying this string will cause all references be dangling pointers. @@ -7294,15 +7299,10 @@ QVector<QStringRef> QString::splitRef(QChar sep, SplitBehavior behavior, Qt::Cas /*! Splits the string into substrings references wherever \a sep occurs, and - returns the list of those strings. If \a sep does not match - anywhere in the string, split() returns a single-element vector - containing this string reference. - - \a cs specifies whether \a sep should be matched case - sensitively or case insensitively. + returns the list of those strings. - If \a behavior is QString::SkipEmptyParts, empty entries don't - appear in the result. By default, empty entries are kept. + See QString::split() for how \a sep, \a behavior and \a cs interact to form + the result. \note All references are valid as long this string is alive. Destroying this string will cause all references be dangling pointers. diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 4daf894887..3a3d416775 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -164,9 +164,10 @@ public: const const_iterator ce = this->cend(), cit = std::find(this->cbegin(), ce, t); if (cit == ce) return 0; - // next operation detaches, so ce, cit may become invalidated: + // next operation detaches, so ce, cit, t may become invalidated: + const T tCopy = t; const int firstFoundIdx = std::distance(this->cbegin(), cit); - const iterator e = end(), it = std::remove(begin() + firstFoundIdx, e, t); + const iterator e = end(), it = std::remove(begin() + firstFoundIdx, e, tCopy); const int result = std::distance(it, e); erase(it, e); return result; diff --git a/src/gui/configure.json b/src/gui/configure.json index 0a591e110c..2c1fe6c86e 100644 --- a/src/gui/configure.json +++ b/src/gui/configure.json @@ -1193,6 +1193,7 @@ "label": "XCB", "section": "Platform plugins", "autoDetect": "!config.darwin", + "enable": "input.xcb == 'system' || input.xcb == 'qt'", "condition": "libs.xcb", "output": [ "privateFeature" ] }, diff --git a/src/gui/text/qdistancefield.cpp b/src/gui/text/qdistancefield.cpp index af13b96c32..e7ca00b3a9 100644 --- a/src/gui/text/qdistancefield.cpp +++ b/src/gui/text/qdistancefield.cpp @@ -177,8 +177,8 @@ void drawTriangle(qint32 *bits, int width, int height, const QPoint *center, const int y2 = clip == Clip ? qBound(0, v2->y() >> 8, height) : v2->y() >> 8; const int yC = clip == Clip ? qBound(0, center->y() >> 8, height) : center->y() >> 8; - const int v1Frac = clip == Clip ? (y1 << 8) + 0xff - v1->y() : ~v2->y() & 0xff; - const int v2Frac = clip == Clip ? (y2 << 8) + 0xff - v2->y() : ~v1->y() & 0xff; + const int v1Frac = clip == Clip ? (y1 << 8) + 0xff - v1->y() : ~v1->y() & 0xff; + const int v2Frac = clip == Clip ? (y2 << 8) + 0xff - v2->y() : ~v2->y() & 0xff; const int centerFrac = clip == Clip ? (yC << 8) + 0xff - center->y() : ~center->y() & 0xff; int dx1 = 0, x1 = 0, dx2 = 0, x2 = 0; diff --git a/src/plugins/platforms/ios/qiosapplicationstate.mm b/src/plugins/platforms/ios/qiosapplicationstate.mm index 13e7e1150f..7c8e1f9927 100644 --- a/src/plugins/platforms/ios/qiosapplicationstate.mm +++ b/src/plugins/platforms/ios/qiosapplicationstate.mm @@ -75,7 +75,7 @@ static void handleApplicationStateChanged(UIApplicationState uiApplicationState) { Qt::ApplicationState state = qtApplicationState(uiApplicationState); qCDebug(lcQpaApplication) << "moved to" << state; - QWindowSystemInterface::handleApplicationStateChanged<QWindowSystemInterface::SynchronousDelivery>(state); + QWindowSystemInterface::handleApplicationStateChanged(state); } QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/ios/qioseventdispatcher.mm b/src/plugins/platforms/ios/qioseventdispatcher.mm index cf7680529a..de2c30cdfb 100644 --- a/src/plugins/platforms/ios/qioseventdispatcher.mm +++ b/src/plugins/platforms/ios/qioseventdispatcher.mm @@ -294,7 +294,7 @@ static bool rootLevelRunLoopIntegration() { [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(applicationDidFinishLaunching) + selector:@selector(applicationDidFinishLaunching:) name:UIApplicationDidFinishLaunchingNotification object:nil]; @@ -320,8 +320,10 @@ static bool rootLevelRunLoopIntegration() # error "Unknown processor family" #endif -+ (void)applicationDidFinishLaunching ++ (void)applicationDidFinishLaunching:(NSNotification *)notification { + qCDebug(lcQpaApplication) << "Application launched with options" << notification.userInfo; + if (!isQtApplication()) return; @@ -329,7 +331,7 @@ static bool rootLevelRunLoopIntegration() // We schedule the main-redirection for the next run-loop pass, so that we // can return from this function and let UIApplicationMain finish its job. // This results in running Qt's application eventloop as a nested runloop. - qEventDispatcherDebug() << "Scheduling main() on next run-loop pass"; + qCDebug(lcQpaApplication) << "Scheduling main() on next run-loop pass"; CFRunLoopTimerRef userMainTimer = CFRunLoopTimerCreateWithHandler(kCFAllocatorDefault, CFAbsoluteTimeGetCurrent(), 0, 0, 0, ^(CFRunLoopTimerRef) { user_main_trampoline(); }); CFRunLoopAddTimer(CFRunLoopGetMain(), userMainTimer, kCFRunLoopCommonModes); @@ -339,7 +341,7 @@ static bool rootLevelRunLoopIntegration() switch (setjmp(processEventEnterJumpPoint)) { case kJumpPointSetSuccessfully: - qEventDispatcherDebug() << "Running main() on separate stack"; qIndent(); + qCDebug(lcQpaApplication) << "Running main() on separate stack"; qIndent(); // Redirect the stack pointer to the start of the reserved stack. This ensures // that when we longjmp out of the event dispatcher and continue execution, the @@ -358,7 +360,7 @@ static bool rootLevelRunLoopIntegration() case kJumpedFromEventDispatcherProcessEvents: // We've returned from the longjmp in the event dispatcher, // and the stack has been restored to its old self. - qUnIndent(); qEventDispatcherDebug() << "Returned from processEvents"; + qUnIndent(); qCDebug(lcQpaApplication) << "Returned from processEvents"; if (Q_UNLIKELY(debugStackUsage)) userMainStack.printUsage(); @@ -422,6 +424,8 @@ QIOSEventDispatcher::QIOSEventDispatcher(QObject *parent) , m_processEventLevel(0) , m_runLoopExitObserver(this, &QIOSEventDispatcher::handleRunLoopExit, kCFRunLoopExit) { + // We want all delivery of events from the system to be handled synchronously + QWindowSystemInterface::setSynchronousWindowSystemEvents(true); } bool __attribute__((returns_twice)) QIOSEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags) diff --git a/src/plugins/platforms/ios/qiosscreen.mm b/src/plugins/platforms/ios/qiosscreen.mm index e8854a4c4b..7c88cddd54 100644 --- a/src/plugins/platforms/ios/qiosscreen.mm +++ b/src/plugins/platforms/ios/qiosscreen.mm @@ -180,12 +180,12 @@ QT_BEGIN_NAMESPACE /*! Returns the model identifier of the device. - - When running under the simulator, the identifier will not - match the simulated device, but will be x86_64 or i386. */ static QString deviceModelIdentifier() { +#if TARGET_OS_SIMULATOR + return QString::fromLocal8Bit(qgetenv("SIMULATOR_MODEL_IDENTIFIER")); +#else static const char key[] = "hw.machine"; size_t size; @@ -195,6 +195,7 @@ static QString deviceModelIdentifier() sysctlbyname(key, &value, &size, NULL, 0); return QString::fromLatin1(value); +#endif } QIOSScreen::QIOSScreen(UIScreen *screen) @@ -203,25 +204,30 @@ QIOSScreen::QIOSScreen(UIScreen *screen) , m_uiWindow(0) , m_orientationListener(0) { - if (screen == [UIScreen mainScreen]) { - QString deviceIdentifier = deviceModelIdentifier(); + QString deviceIdentifier = deviceModelIdentifier(); + if (screen == [UIScreen mainScreen] && !deviceIdentifier.startsWith("AppleTV")) { // Based on https://en.wikipedia.org/wiki/List_of_iOS_devices#Display // iPhone (1st gen), 3G, 3GS, and iPod Touch (1st–3rd gen) are 18-bit devices - if (deviceIdentifier.contains(QRegularExpression("^(iPhone1,[12]|iPhone2,1|iPod[1-3],1)$"))) - m_depth = 18; - else - m_depth = 24; + static QRegularExpression lowBitDepthDevices("^(iPhone1,[12]|iPhone2,1|iPod[1-3],1)$"); + m_depth = deviceIdentifier.contains(lowBitDepthDevices) ? 18 : 24; + + static QRegularExpression iPhoneXModels("^iPhone(10,[36])$"); + static QRegularExpression iPhonePlusModels("^iPhone(7,1|8,2|9,[24]|10,[25])$"); + static QRegularExpression iPadMiniModels("^iPad(2,[567]|4,[4-9]|5,[12])$"); - if (deviceIdentifier.contains(QRegularExpression("^iPhone(7,1|8,2|9,2|9,4)$"))) { - // iPhone Plus models + if (deviceIdentifier.contains(iPhoneXModels)) { + m_physicalDpi = 458; + } else if (deviceIdentifier.contains(iPhonePlusModels)) { m_physicalDpi = 401; - } else if (deviceIdentifier.contains(QRegularExpression("^iPad(1,1|2,[1-4]|3,[1-6]|4,[1-3]|5,[3-4]|6,[7-8])$"))) { - // All iPads except the iPad Mini series - m_physicalDpi = 132 * devicePixelRatio(); + } else if (deviceIdentifier.startsWith("iPad")) { + if (deviceIdentifier.contains(iPadMiniModels)) + m_physicalDpi = 163 * devicePixelRatio(); + else + m_physicalDpi = 132 * devicePixelRatio(); } else { - // All non-Plus iPhones, and iPad Minis + // All normal iPhones, and iPods m_physicalDpi = 163 * devicePixelRatio(); } } else { diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm index 7d48a012dd..b029c49a67 100644 --- a/src/plugins/platforms/ios/qiostextresponder.mm +++ b/src/plugins/platforms/ios/qiostextresponder.mm @@ -377,7 +377,6 @@ QScopedValueRollback<BOOL> rollback(m_inSendEventToFocusObject, true); QWindowSystemInterface::handleKeyEvent(qApp->focusWindow(), QEvent::KeyPress, key, modifiers); QWindowSystemInterface::handleKeyEvent(qApp->focusWindow(), QEvent::KeyRelease, key, modifiers); - QWindowSystemInterface::flushWindowSystemEvents(); } #ifndef QT_NO_SHORTCUT diff --git a/src/plugins/platforms/ios/quiview.mm b/src/plugins/platforms/ios/quiview.mm index a56530e1d9..a2ecc8c3cd 100644 --- a/src/plugins/platforms/ios/quiview.mm +++ b/src/plugins/platforms/ios/quiview.mm @@ -161,7 +161,7 @@ QRect lastReportedGeometry = qt_window_private(window)->geometry; QRect currentGeometry = QRectF::fromCGRect(self.frame).toRect(); qCDebug(lcQpaWindow) << m_qioswindow->window() << "new geometry is" << currentGeometry; - QWindowSystemInterface::handleGeometryChange<QWindowSystemInterface::SynchronousDelivery>(window, currentGeometry); + QWindowSystemInterface::handleGeometryChange(window, currentGeometry); if (currentGeometry.size() != lastReportedGeometry.size()) { // Trigger expose event on resize @@ -194,7 +194,7 @@ } qCDebug(lcQpaWindow) << m_qioswindow->window() << region << "isExposed" << m_qioswindow->isExposed(); - QWindowSystemInterface::handleExposeEvent<QWindowSystemInterface::SynchronousDelivery>(m_qioswindow->window(), region); + QWindowSystemInterface::handleExposeEvent(m_qioswindow->window(), region); } // ------------------------------------------------------------------------- @@ -225,7 +225,7 @@ } if (qGuiApp->focusWindow() != m_qioswindow->window()) - QWindowSystemInterface::handleWindowActivated<QWindowSystemInterface::SynchronousDelivery>(m_qioswindow->window()); + QWindowSystemInterface::handleWindowActivated(m_qioswindow->window()); else qImDebug() << m_qioswindow->window() << "already active, not sending window activation"; @@ -263,7 +263,7 @@ UIResponder *newResponder = FirstResponderCandidate::currentCandidate(); if ([self responderShouldTriggerWindowDeactivation:newResponder]) - QWindowSystemInterface::handleWindowActivated<QWindowSystemInterface::SynchronousDelivery>(0); + QWindowSystemInterface::handleWindowActivated(0); return YES; } @@ -354,7 +354,7 @@ - (void)sendTouchEventWithTimestamp:(ulong)timeStamp { QIOSIntegration *iosIntegration = QIOSIntegration::instance(); - QWindowSystemInterface::handleTouchEvent<QWindowSystemInterface::SynchronousDelivery>(m_qioswindow->window(), timeStamp, iosIntegration->touchDevice(), m_activeTouches.values()); + QWindowSystemInterface::handleTouchEvent(m_qioswindow->window(), timeStamp, iosIntegration->touchDevice(), m_activeTouches.values()); } - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event @@ -433,7 +433,7 @@ NSTimeInterval timestamp = event ? event.timestamp : [[NSProcessInfo processInfo] systemUptime]; QIOSIntegration *iosIntegration = static_cast<QIOSIntegration *>(QGuiApplicationPrivate::platformIntegration()); - QWindowSystemInterface::handleTouchCancelEvent<QWindowSystemInterface::SynchronousDelivery>(m_qioswindow->window(), ulong(timestamp * 1000), iosIntegration->touchDevice()); + QWindowSystemInterface::handleTouchCancelEvent(m_qioswindow->window(), ulong(timestamp * 1000), iosIntegration->touchDevice()); } - (int)mapPressTypeToKey:(UIPress*)press @@ -461,7 +461,7 @@ int key = [self mapPressTypeToKey:press]; if (key == Qt::Key_unknown) continue; - if (QWindowSystemInterface::handleKeyEvent<QWindowSystemInterface::SynchronousDelivery>(m_qioswindow->window(), type, key, Qt::NoModifier)) + if (QWindowSystemInterface::handleKeyEvent(m_qioswindow->window(), type, key, Qt::NoModifier)) handled = true; } diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp index d4521de8e0..1e963268ef 100644 --- a/src/plugins/platforms/xcb/qxcbdrag.cpp +++ b/src/plugins/platforms/xcb/qxcbdrag.cpp @@ -165,6 +165,9 @@ void QXcbDrag::init() QXcbCursor::queryPointer(connection(), ¤t_virtual_desktop, 0); drag_types.clear(); + + dropped = false; + canceled = false; } bool QXcbDrag::eventFilter(QObject *o, QEvent *e) @@ -215,6 +218,10 @@ void QXcbDrag::startDrag() void QXcbDrag::endDrag() { QBasicDrag::endDrag(); + if (!dropped && !canceled && canDrop()) { + // Set executed drop action when dropping outside application. + setExecutedDropAction(accepted_drop_action); + } initiatorWindow.clear(); } @@ -989,6 +996,8 @@ void QXcbDrag::handleDrop(QPlatformWindow *, const xcb_client_message_event_t *e // reset target_time = XCB_CURRENT_TIME; + + dropped = true; } @@ -1087,6 +1096,8 @@ void QXcbDrag::cancel() // remove canceled object currentDrag()->deleteLater(); + + canceled = true; } // find an ancestor with XdndAware on it diff --git a/src/plugins/platforms/xcb/qxcbdrag.h b/src/plugins/platforms/xcb/qxcbdrag.h index f261cc1322..31f1c47d83 100644 --- a/src/plugins/platforms/xcb/qxcbdrag.h +++ b/src/plugins/platforms/xcb/qxcbdrag.h @@ -135,6 +135,10 @@ private: QRect source_sameanswer; bool waiting_for_status; + // helpers for setting executed drop action outside application + bool dropped; + bool canceled; + // top-level window we sent position to last. xcb_window_t current_target; // window to send events to (always valid if current_target) diff --git a/src/plugins/sqldrivers/db2/db2.pro b/src/plugins/sqldrivers/db2/db2.pro index eef65fac66..b99fe91fe3 100644 --- a/src/plugins/sqldrivers/db2/db2.pro +++ b/src/plugins/sqldrivers/db2/db2.pro @@ -7,5 +7,7 @@ QMAKE_USE += db2 OTHER_FILES += db2.json +equals(QT_ARCH, x86_64): DEFINES += ODBC64 + PLUGIN_CLASS_NAME = QDB2DriverPlugin include(../qsqldriverbase.pri) diff --git a/src/plugins/sqldrivers/db2/qsql_db2.cpp b/src/plugins/sqldrivers/db2/qsql_db2.cpp index 1a9631f1eb..2bfd99cfa9 100644 --- a/src/plugins/sqldrivers/db2/qsql_db2.cpp +++ b/src/plugins/sqldrivers/db2/qsql_db2.cpp @@ -272,7 +272,7 @@ static QSqlField qMakeFieldInfo(const QDB2ResultPrivate* d, int i) { SQLSMALLINT colNameLen; SQLSMALLINT colType; - SQLUINTEGER colSize; + SQLULEN colSize; SQLSMALLINT colScale; SQLSMALLINT nullable; SQLRETURN r = SQL_ERROR; @@ -314,7 +314,7 @@ static int qGetIntData(SQLHANDLE hStmt, int column, bool& isNull) { SQLINTEGER intbuf; isNull = false; - SQLINTEGER lengthIndicator = 0; + SQLLEN lengthIndicator = 0; SQLRETURN r = SQLGetData(hStmt, column + 1, SQL_C_SLONG, @@ -332,7 +332,7 @@ static double qGetDoubleData(SQLHANDLE hStmt, int column, bool& isNull) { SQLDOUBLE dblbuf; isNull = false; - SQLINTEGER lengthIndicator = 0; + SQLLEN lengthIndicator = 0; SQLRETURN r = SQLGetData(hStmt, column+1, SQL_C_DOUBLE, @@ -351,7 +351,7 @@ static SQLBIGINT qGetBigIntData(SQLHANDLE hStmt, int column, bool& isNull) { SQLBIGINT lngbuf = Q_INT64_C(0); isNull = false; - SQLINTEGER lengthIndicator = 0; + SQLLEN lengthIndicator = 0; SQLRETURN r = SQLGetData(hStmt, column+1, SQL_C_SBIGINT, @@ -368,7 +368,7 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool& is { QString fieldVal; SQLRETURN r = SQL_ERROR; - SQLINTEGER lengthIndicator = 0; + SQLLEN lengthIndicator = 0; if (colSize <= 0) colSize = 255; @@ -404,12 +404,12 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool& is return fieldVal; } -static QByteArray qGetBinaryData(SQLHANDLE hStmt, int column, SQLINTEGER& lengthIndicator, bool& isNull) +static QByteArray qGetBinaryData(SQLHANDLE hStmt, int column, SQLLEN& lengthIndicator, bool& isNull) { QByteArray fieldVal; SQLSMALLINT colNameLen; SQLSMALLINT colType; - SQLUINTEGER colSize; + SQLULEN colSize; SQLSMALLINT colScale; SQLSMALLINT nullable; SQLRETURN r = SQL_ERROR; @@ -643,9 +643,9 @@ bool QDB2Result::exec() { Q_D(QDB2Result); QList<QByteArray> tmpStorage; // holds temporary ptrs - QVarLengthArray<SQLINTEGER, 32> indicators(boundValues().count()); + QVarLengthArray<SQLLEN, 32> indicators(boundValues().count()); - memset(indicators.data(), 0, indicators.size() * sizeof(SQLINTEGER)); + memset(indicators.data(), 0, indicators.size() * sizeof(SQLLEN)); setActive(false); setAt(QSql::BeforeFirstRow); SQLRETURN r; @@ -661,7 +661,7 @@ bool QDB2Result::exec() int i; for (i = 0; i < values.count(); ++i) { // bind parameters - only positional binding allowed - SQLINTEGER *ind = &indicators[i]; + SQLLEN *ind = &indicators[i]; if (values.at(i).isNull()) *ind = SQL_NULL_DATA; if (bindValueType(i) & QSql::Out) @@ -1006,7 +1006,7 @@ QVariant QDB2Result::data(int field) return QVariant(); } SQLRETURN r = 0; - SQLINTEGER lengthIndicator = 0; + SQLLEN lengthIndicator = 0; bool isNull = false; const QSqlField info = d->recInf.field(field); @@ -1119,7 +1119,7 @@ bool QDB2Result::isNull(int i) int QDB2Result::numRowsAffected() { Q_D(const QDB2Result); - SQLINTEGER affectedRowCount = 0; + SQLLEN affectedRowCount = 0; SQLRETURN r = SQLRowCount(d->hStmt, &affectedRowCount); if (r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) return affectedRowCount; @@ -1248,7 +1248,7 @@ bool QDB2Driver::open(const QString& db, const QString& user, const QString& pas const QString opt(tmp.left(idx)); const QString val(tmp.mid(idx + 1).simplified()); - SQLUINTEGER v = 0; + SQLULEN v = 0; r = SQL_SUCCESS; if (opt == QLatin1String("SQL_ATTR_ACCESS_MODE")) { if (val == QLatin1String("SQL_MODE_READ_ONLY")) { @@ -1634,7 +1634,7 @@ bool QDB2Driver::rollbackTransaction() bool QDB2Driver::setAutoCommit(bool autoCommit) { Q_D(QDB2Driver); - SQLUINTEGER ac = autoCommit ? SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF; + SQLULEN ac = autoCommit ? SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF; SQLRETURN r = SQLSetConnectAttr(d->hDbc, SQL_ATTR_AUTOCOMMIT, reinterpret_cast<SQLPOINTER>(ac), diff --git a/src/plugins/sqldrivers/psql/qsql_psql.cpp b/src/plugins/sqldrivers/psql/qsql_psql.cpp index 0f4b7a80af..35b0f9a3e3 100644 --- a/src/plugins/sqldrivers/psql/qsql_psql.cpp +++ b/src/plugins/sqldrivers/psql/qsql_psql.cpp @@ -229,7 +229,7 @@ class QPSQLResultPrivate : public QSqlResultPrivate { Q_DECLARE_PUBLIC(QPSQLResult) public: - Q_DECLARE_SQLDRIVER_PRIVATE(QPSQLDriver); + Q_DECLARE_SQLDRIVER_PRIVATE(QPSQLDriver) QPSQLResultPrivate(QPSQLResult *q, const QPSQLDriver *drv) : QSqlResultPrivate(q, drv), result(0), diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp index 3b53e664c6..0b36dec003 100644 --- a/src/printsupport/dialogs/qprintdialog_unix.cpp +++ b/src/printsupport/dialogs/qprintdialog_unix.cpp @@ -673,7 +673,9 @@ QUnixPrintWidgetPrivate::QUnixPrintWidgetPrivate(QUnixPrintWidget *p, QPrinter * widget.printers->addItems(printers); - const int idx = printers.indexOf(defaultPrinter); + const QString selectedPrinter = prn && !prn->printerName().isEmpty() ? prn->printerName() : defaultPrinter; + const int idx = printers.indexOf(selectedPrinter); + if (idx >= 0) currentPrinterIndex = idx; } diff --git a/src/sql/kernel/qsqlquery.cpp b/src/sql/kernel/qsqlquery.cpp index f9cc07daa1..b89d20976f 100644 --- a/src/sql/kernel/qsqlquery.cpp +++ b/src/sql/kernel/qsqlquery.cpp @@ -649,11 +649,10 @@ bool QSqlQuery::next() { if (!isSelect() || !isActive()) return false; - bool b = false; + switch (at()) { case QSql::BeforeFirstRow: - b = d->sqlResult->fetchFirst(); - return b; + return d->sqlResult->fetchFirst(); case QSql::AfterLastRow: return false; default: @@ -703,13 +702,11 @@ bool QSqlQuery::previous() return false; } - bool b = false; switch (at()) { case QSql::BeforeFirstRow: return false; case QSql::AfterLastRow: - b = d->sqlResult->fetchLast(); - return b; + return d->sqlResult->fetchLast(); default: if (!d->sqlResult->fetchPrevious()) { d->sqlResult->setAt(QSql::BeforeFirstRow); @@ -737,9 +734,7 @@ bool QSqlQuery::first() qWarning("QSqlQuery::seek: cannot seek backwards in a forward only query"); return false; } - bool b = false; - b = d->sqlResult->fetchFirst(); - return b; + return d->sqlResult->fetchFirst(); } /*! @@ -758,9 +753,7 @@ bool QSqlQuery::last() { if (!isSelect() || !isActive()) return false; - bool b = false; - b = d->sqlResult->fetchLast(); - return b; + return d->sqlResult->fetchLast(); } /*! diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index c5b912e35b..57d7fb1bc8 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -902,8 +902,7 @@ void QMenuPrivate::adjustMenuScreen(const QPoint &p) // The windowHandle must point to the screen where the menu will be shown. // The (item) size calculations depend on the menu screen, // so a wrong screen would often cause wrong sizes (on high DPI) - const QScreen *primaryScreen = QApplication::primaryScreen(); - const QScreen *currentScreen = q->windowHandle() ? q->windowHandle()->screen() : primaryScreen; + const QScreen *currentScreen = q->windowHandle() ? q->windowHandle()->screen() : nullptr; const int screenNumberForPoint = QApplication::desktop()->screenNumber(p); QScreen *actualScreen = QGuiApplication::screens().at(screenNumberForPoint); if (actualScreen && currentScreen != actualScreen) { diff --git a/tests/auto/corelib/tools/qvector/tst_qvector.cpp b/tests/auto/corelib/tools/qvector/tst_qvector.cpp index 374fec221e..6975452d76 100644 --- a/tests/auto/corelib/tools/qvector/tst_qvector.cpp +++ b/tests/auto/corelib/tools/qvector/tst_qvector.cpp @@ -245,6 +245,7 @@ private slots: void qhashInt() const { qhash<int>(); } void qhashMovable() const { qhash<Movable>(); } void qhashCustom() const { qhash<Custom>(); } + void removeAllWithAlias() const; void removeInt() const; void removeMovable() const; void removeCustom() const; @@ -1722,6 +1723,13 @@ void tst_QVector::prependCustom() const QCOMPARE(instancesCount, Custom::counter.loadAcquire()); } +void tst_QVector::removeAllWithAlias() const +{ + QVector<QString> strings; + strings << "One" << "Two" << "Three" << "One" /* must be distinct, but equal */; + QCOMPARE(strings.removeAll(strings.front()), 2); // will trigger asan/ubsan +} + template<typename T> void tst_QVector::remove() const { diff --git a/tests/auto/network/access/qnetworkreply/BLACKLIST b/tests/auto/network/access/qnetworkreply/BLACKLIST index d6fc717e37..1052239797 100644 --- a/tests/auto/network/access/qnetworkreply/BLACKLIST +++ b/tests/auto/network/access/qnetworkreply/BLACKLIST @@ -32,6 +32,8 @@ linux windows [putToFtp] windows ci +[putToFtpWithInvalidCredentials] +windows ci [putWithServerClosingConnectionImmediately] windows [qtbug28035browserDoesNotLoadQtProjectOrgCorrectly] |