diff --git a/examples/corelib/threads/doc/src/mandelbrot.qdoc b/examples/corelib/threads/doc/src/mandelbrot.qdoc index dd0e4e5ef2..274874632e 100644 --- a/examples/corelib/threads/doc/src/mandelbrot.qdoc +++ b/examples/corelib/threads/doc/src/mandelbrot.qdoc @@ -39,7 +39,7 @@ The heavy computation here is the Mandelbrot set, probably the world's most famous fractal. These days, while sophisticated - programs such as \l{http://xaos.sourceforge.net/}{XaoS} that provide real-time zooming in the + programs such as \l{http://matek.hu/xaos/doku.php}{XaoS} that provide real-time zooming in the Mandelbrot set, the standard Mandelbrot algorithm is just slow enough for our purposes. @@ -201,7 +201,7 @@ \snippet threads/mandelbrot/renderthread.cpp 9 Once we're done with all the iterations, we call - QWaitCondition::wait() to put the thread to sleep by calling, + QWaitCondition::wait() to put the thread to sleep, unless \c restart is \c true. There's no use in keeping a worker thread looping indefinitely while there's nothing to do. @@ -232,7 +232,7 @@ \snippet threads/mandelbrot/mandelbrotwidget.cpp 0 - The implementation starts with a few contants that we'll need + The implementation starts with a few constants that we'll need later on. \snippet threads/mandelbrot/mandelbrotwidget.cpp 1 @@ -256,15 +256,15 @@ slot later on. Qt knows how to take of copy of many C++ and Qt types, but QImage isn't one of them. We must therefore call the template function qRegisterMetaType() before we can use QImage - as parameter in queued connections. + as a parameter in queued connections. \snippet threads/mandelbrot/mandelbrotwidget.cpp 2 \snippet threads/mandelbrot/mandelbrotwidget.cpp 3 \snippet threads/mandelbrot/mandelbrotwidget.cpp 4 In \l{QWidget::paintEvent()}{paintEvent()}, we start by filling - the background with black. If we have nothing yet to paint (\c - pixmap is null), we print a message on the widget asking the user + the background with black. If we have nothing to paint yet (\c + pixmap is null), we display a message on the widget asking the user to be patient and return from the function immediately. \snippet threads/mandelbrot/mandelbrotwidget.cpp 5 @@ -293,7 +293,7 @@ Notice that we rely on \c resizeEvent() being automatically called by Qt when the widget is shown the first time to generate - the image the very first time. + the initial image. \snippet threads/mandelbrot/mandelbrotwidget.cpp 11 @@ -307,7 +307,7 @@ control the zoom level. QWheelEvent::delta() returns the angle of the wheel mouse movement, in eights of a degree. For most mice, one wheel step corresponds to 15 degrees. We find out how many - mouse steps we have and determine the zoom factor in consequence. + mouse steps we have and determine the resulting zoom factor. For example, if we have two wheel steps in the positive direction (i.e., +30 degrees), the zoom factor becomes \c ZoomInFactor to the second power, i.e. 0.8 * 0.8 = 0.64. diff --git a/examples/examples.pro b/examples/examples.pro index 4ec5ca60e2..077e5828a9 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -4,8 +4,7 @@ CONFIG += no_docs_target SUBDIRS = \ corelib \ embedded \ - qpa \ - touch + qpa qtHaveModule(dbus): SUBDIRS += dbus qtHaveModule(network): SUBDIRS += network diff --git a/examples/touch/dials/dials.pro b/examples/widgets/touch/dials/dials.pro similarity index 58% rename from examples/touch/dials/dials.pro rename to examples/widgets/touch/dials/dials.pro index 2c522a46f0..0e823551cc 100644 --- a/examples/touch/dials/dials.pro +++ b/examples/widgets/touch/dials/dials.pro @@ -4,5 +4,5 @@ SOURCES += main.cpp FORMS += dials.ui # install -target.path = $$[QT_INSTALL_EXAMPLES]/touch/dials +target.path = $$[QT_INSTALL_EXAMPLES]/widgets/touch/dials INSTALLS += target diff --git a/examples/touch/dials/dials.ui b/examples/widgets/touch/dials/dials.ui similarity index 100% rename from examples/touch/dials/dials.ui rename to examples/widgets/touch/dials/dials.ui diff --git a/examples/touch/dials/doc/images/touch-dials-example.png b/examples/widgets/touch/dials/doc/images/touch-dials-example.png similarity index 100% rename from examples/touch/dials/doc/images/touch-dials-example.png rename to examples/widgets/touch/dials/doc/images/touch-dials-example.png diff --git a/examples/touch/dials/doc/src/touch-dials.qdoc b/examples/widgets/touch/dials/doc/src/touch-dials.qdoc similarity index 99% rename from examples/touch/dials/doc/src/touch-dials.qdoc rename to examples/widgets/touch/dials/doc/src/touch-dials.qdoc index 10784c8c0d..dec8248efb 100644 --- a/examples/touch/dials/doc/src/touch-dials.qdoc +++ b/examples/widgets/touch/dials/doc/src/touch-dials.qdoc @@ -29,7 +29,7 @@ \example touch/dials \title Touch Dials Example \ingroup touchinputexamples - \brief Shows how to apply touch to a set of standard Qt widgets + \brief Shows how to apply touch to a set of standard Qt widgets. The Touch Dials example shows how to apply touch to a set of standard Qt widgets. diff --git a/examples/touch/dials/main.cpp b/examples/widgets/touch/dials/main.cpp similarity index 100% rename from examples/touch/dials/main.cpp rename to examples/widgets/touch/dials/main.cpp diff --git a/doc/src/examples/fingerpaint.qdoc b/examples/widgets/touch/fingerpaint/doc/src/fingerpaint.qdoc similarity index 99% rename from doc/src/examples/fingerpaint.qdoc rename to examples/widgets/touch/fingerpaint/doc/src/fingerpaint.qdoc index 79001ddc7d..6f8f636f86 100644 --- a/doc/src/examples/fingerpaint.qdoc +++ b/examples/widgets/touch/fingerpaint/doc/src/fingerpaint.qdoc @@ -29,7 +29,7 @@ \example touch/fingerpaint \title Finger Paint Example \ingroup touchinputexamples - \brief Shows the use of a touchscreen to make a simple painting application + \brief Shows the use of a touchscreen to make a simple painting application. The Finger Paint example shows the use of a touchscreen with a custom widget to create a simple painting application. diff --git a/examples/touch/fingerpaint/fingerpaint.pro b/examples/widgets/touch/fingerpaint/fingerpaint.pro similarity index 81% rename from examples/touch/fingerpaint/fingerpaint.pro rename to examples/widgets/touch/fingerpaint/fingerpaint.pro index f196f7eed4..6370da6607 100644 --- a/examples/touch/fingerpaint/fingerpaint.pro +++ b/examples/widgets/touch/fingerpaint/fingerpaint.pro @@ -9,5 +9,5 @@ SOURCES = main.cpp \ scribblearea.cpp # install -target.path = $$[QT_INSTALL_EXAMPLES]/touch/fingerpaint +target.path = $$[QT_INSTALL_EXAMPLES]/widgets/touch/fingerpaint INSTALLS += target diff --git a/examples/touch/fingerpaint/main.cpp b/examples/widgets/touch/fingerpaint/main.cpp similarity index 100% rename from examples/touch/fingerpaint/main.cpp rename to examples/widgets/touch/fingerpaint/main.cpp diff --git a/examples/touch/fingerpaint/mainwindow.cpp b/examples/widgets/touch/fingerpaint/mainwindow.cpp similarity index 100% rename from examples/touch/fingerpaint/mainwindow.cpp rename to examples/widgets/touch/fingerpaint/mainwindow.cpp diff --git a/examples/touch/fingerpaint/mainwindow.h b/examples/widgets/touch/fingerpaint/mainwindow.h similarity index 100% rename from examples/touch/fingerpaint/mainwindow.h rename to examples/widgets/touch/fingerpaint/mainwindow.h diff --git a/examples/touch/fingerpaint/scribblearea.cpp b/examples/widgets/touch/fingerpaint/scribblearea.cpp similarity index 100% rename from examples/touch/fingerpaint/scribblearea.cpp rename to examples/widgets/touch/fingerpaint/scribblearea.cpp diff --git a/examples/touch/fingerpaint/scribblearea.h b/examples/widgets/touch/fingerpaint/scribblearea.h similarity index 100% rename from examples/touch/fingerpaint/scribblearea.h rename to examples/widgets/touch/fingerpaint/scribblearea.h diff --git a/examples/touch/knobs/doc/images/touch-knobs-example.png b/examples/widgets/touch/knobs/doc/images/touch-knobs-example.png similarity index 100% rename from examples/touch/knobs/doc/images/touch-knobs-example.png rename to examples/widgets/touch/knobs/doc/images/touch-knobs-example.png diff --git a/examples/touch/knobs/doc/src/touch-knobs.qdoc b/examples/widgets/touch/knobs/doc/src/touch-knobs.qdoc similarity index 99% rename from examples/touch/knobs/doc/src/touch-knobs.qdoc rename to examples/widgets/touch/knobs/doc/src/touch-knobs.qdoc index d39dd564b2..6da5992195 100644 --- a/examples/touch/knobs/doc/src/touch-knobs.qdoc +++ b/examples/widgets/touch/knobs/doc/src/touch-knobs.qdoc @@ -29,7 +29,7 @@ \example touch/knobs \title Touch Knobs Example \ingroup touchinputexamples - \brief Shows how to create custom controls that accept touch input + \brief Shows how to create custom controls that accept touch input. The Touch Knobs example shows how to create custom controls that accept touch input. diff --git a/examples/touch/knobs/knob.cpp b/examples/widgets/touch/knobs/knob.cpp similarity index 100% rename from examples/touch/knobs/knob.cpp rename to examples/widgets/touch/knobs/knob.cpp diff --git a/examples/touch/knobs/knob.h b/examples/widgets/touch/knobs/knob.h similarity index 100% rename from examples/touch/knobs/knob.h rename to examples/widgets/touch/knobs/knob.h diff --git a/examples/touch/knobs/knobs.pro b/examples/widgets/touch/knobs/knobs.pro similarity index 60% rename from examples/touch/knobs/knobs.pro rename to examples/widgets/touch/knobs/knobs.pro index 267ba26167..0915b0665a 100644 --- a/examples/touch/knobs/knobs.pro +++ b/examples/widgets/touch/knobs/knobs.pro @@ -4,5 +4,5 @@ HEADERS = knob.h SOURCES = main.cpp knob.cpp # install -target.path = $$[QT_INSTALL_EXAMPLES]/touch/knobs +target.path = $$[QT_INSTALL_EXAMPLES]/widgets/touch/knobs INSTALLS += target diff --git a/examples/touch/knobs/main.cpp b/examples/widgets/touch/knobs/main.cpp similarity index 100% rename from examples/touch/knobs/main.cpp rename to examples/widgets/touch/knobs/main.cpp diff --git a/examples/widgets/touch/pinchzoom/doc/images/pinch-zoom-example.png b/examples/widgets/touch/pinchzoom/doc/images/pinch-zoom-example.png new file mode 100644 index 0000000000..7db51fbf55 Binary files /dev/null and b/examples/widgets/touch/pinchzoom/doc/images/pinch-zoom-example.png differ diff --git a/doc/src/examples/pinchzoom.qdoc b/examples/widgets/touch/pinchzoom/doc/src/pinchzoom.qdoc similarity index 97% rename from doc/src/examples/pinchzoom.qdoc rename to examples/widgets/touch/pinchzoom/doc/src/pinchzoom.qdoc index 077e9c5ee3..61db2f96c5 100644 --- a/doc/src/examples/pinchzoom.qdoc +++ b/examples/widgets/touch/pinchzoom/doc/src/pinchzoom.qdoc @@ -29,7 +29,7 @@ \example touch/pinchzoom \title Pinch Zoom Example \ingroup touchinputexamples - \brief Shows how to recognize a gesture + \brief Shows how to recognize a gesture. The Pinch Zoom example shows how to use low-level touch information to recognize a gesture. diff --git a/examples/touch/pinchzoom/graphicsview.cpp b/examples/widgets/touch/pinchzoom/graphicsview.cpp similarity index 100% rename from examples/touch/pinchzoom/graphicsview.cpp rename to examples/widgets/touch/pinchzoom/graphicsview.cpp diff --git a/examples/touch/pinchzoom/graphicsview.h b/examples/widgets/touch/pinchzoom/graphicsview.h similarity index 100% rename from examples/touch/pinchzoom/graphicsview.h rename to examples/widgets/touch/pinchzoom/graphicsview.h diff --git a/examples/touch/pinchzoom/images/cheese.jpg b/examples/widgets/touch/pinchzoom/images/cheese.jpg similarity index 100% rename from examples/touch/pinchzoom/images/cheese.jpg rename to examples/widgets/touch/pinchzoom/images/cheese.jpg diff --git a/examples/touch/pinchzoom/main.cpp b/examples/widgets/touch/pinchzoom/main.cpp similarity index 100% rename from examples/touch/pinchzoom/main.cpp rename to examples/widgets/touch/pinchzoom/main.cpp diff --git a/examples/touch/pinchzoom/mice.qrc b/examples/widgets/touch/pinchzoom/mice.qrc similarity index 100% rename from examples/touch/pinchzoom/mice.qrc rename to examples/widgets/touch/pinchzoom/mice.qrc diff --git a/examples/touch/pinchzoom/mouse.cpp b/examples/widgets/touch/pinchzoom/mouse.cpp similarity index 100% rename from examples/touch/pinchzoom/mouse.cpp rename to examples/widgets/touch/pinchzoom/mouse.cpp diff --git a/examples/touch/pinchzoom/mouse.h b/examples/widgets/touch/pinchzoom/mouse.h similarity index 100% rename from examples/touch/pinchzoom/mouse.h rename to examples/widgets/touch/pinchzoom/mouse.h diff --git a/examples/touch/pinchzoom/pinchzoom.pro b/examples/widgets/touch/pinchzoom/pinchzoom.pro similarity index 75% rename from examples/touch/pinchzoom/pinchzoom.pro rename to examples/widgets/touch/pinchzoom/pinchzoom.pro index 9441cc1d92..ebbc7ddf1f 100644 --- a/examples/touch/pinchzoom/pinchzoom.pro +++ b/examples/widgets/touch/pinchzoom/pinchzoom.pro @@ -12,5 +12,5 @@ RESOURCES += \ mice.qrc # install -target.path = $$[QT_INSTALL_EXAMPLES]/touch/pinchzoom +target.path = $$[QT_INSTALL_EXAMPLES]/widgets/touch/pinchzoom INSTALLS += target diff --git a/examples/touch/touch.pro b/examples/widgets/touch/touch.pro similarity index 100% rename from examples/touch/touch.pro rename to examples/widgets/touch/touch.pro diff --git a/examples/widgets/widgets.pro b/examples/widgets/widgets.pro index f9d863b69e..8bd85bfe6b 100644 --- a/examples/widgets/widgets.pro +++ b/examples/widgets/widgets.pro @@ -19,6 +19,7 @@ SUBDIRS = \ scroller \ statemachine \ tools \ + touch \ tutorials \ widgets diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 37144dcf17..42009e0b5e 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -245,7 +245,10 @@ QEvent::MouseMove, QEvent::TouchUpdate, and changes in window size and position will be combined whenever they occur more frequently than the application handles them, so that they don't accumulate and overwhelm the - application later. On other platforms, the default is false. + application later. + On Windows 8 and above the default value is also true, but it only applies + to touch events. Mouse and window events remain unaffected by this flag. + On other platforms, the default is false. (In the future, the compression feature may be implemented across platforms.) You can test the attribute to see whether compression is enabled. If your application needs to handle all events with no compression, @@ -256,8 +259,9 @@ \value AA_CompressTabletEvents Enables compression of input events from tablet devices. Notice that AA_CompressHighFrequencyEvents must be true for events compression - to be enabled, and that this flag extends the former to tablet events. Its default - value is false. + to be enabled, and that this flag extends the former to tablet events. + Currently supported on the X11 windowing system, Windows 8 and above. + The default value is false. This value was added in Qt 5.10. \value AA_DontCheckOpenGLContextThreadAffinity When making a context diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index 6c17535f07..a6ee12ede1 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -970,9 +970,9 @@ static const QMetaObject *QMetaObject_findMetaObject(const QMetaObject *self, co int QMetaObject::indexOfEnumerator(const char *name) const { const QMetaObject *m = this; - const int intsPerEnum = priv(m->d.data)->revision >= 8 ? 5 : 4; while (m) { const QMetaObjectPrivate *d = priv(m->d.data); + const int intsPerEnum = d->revision >= 8 ? 5 : 4; for (int i = d->enumeratorCount - 1; i >= 0; --i) { const char *prop = rawStringData(m, m->d.data[d->enumeratorData + intsPerEnum * i]); if (name[0] == prop[0] && strcmp(name + 1, prop + 1) == 0) { @@ -986,6 +986,7 @@ int QMetaObject::indexOfEnumerator(const char *name) const m = this; while (m) { const QMetaObjectPrivate *d = priv(m->d.data); + const int intsPerEnum = d->revision >= 8 ? 5 : 4; for (int i = d->enumeratorCount - 1; i >= 0; --i) { const char *prop = rawStringData(m, m->d.data[d->enumeratorData + intsPerEnum * i + 1]); if (name[0] == prop[0] && strcmp(name + 1, prop + 1) == 0) { diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 82952919dd..eb67544f21 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -1058,7 +1058,7 @@ int QMetaType::registerType(const char *typeName, Deleter deleter, \internal \since 5.12 - Registers a user type for marshalling, with \a typeName, a \a + Registers a user type for marshalling, with \a typeName, a \a destructor, a \a constructor, and a \a size. Returns the type's handle, or -1 if the type could not be registered. */ diff --git a/src/gui/image/qbmphandler.cpp b/src/gui/image/qbmphandler.cpp index 587f375ce7..5dff4ab0ac 100644 --- a/src/gui/image/qbmphandler.cpp +++ b/src/gui/image/qbmphandler.cpp @@ -188,6 +188,8 @@ static bool read_dib_infoheader(QDataStream &s, BMP_INFOHDR &bi) if (!(comp == BMP_RGB || (nbits == 4 && comp == BMP_RLE4) || (nbits == 8 && comp == BMP_RLE8) || ((nbits == 16 || nbits == 32) && comp == BMP_BITFIELDS))) return false; // weird compression type + if (bi.biWidth < 0 || quint64(bi.biWidth) * qAbs(bi.biHeight) > 16384 * 16384) + return false; return true; } diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h index 7764c19452..4b7a3b1ead 100644 --- a/src/gui/image/qimage.h +++ b/src/gui/image/qimage.h @@ -334,7 +334,7 @@ public: static QPixelFormat toPixelFormat(QImage::Format format) Q_DECL_NOTHROW; static QImage::Format toImageFormat(QPixelFormat format) Q_DECL_NOTHROW; - // Platform spesific conversion functions + // Platform specific conversion functions #if defined(Q_OS_DARWIN) || defined(Q_QDOC) CGImageRef toCGImage() const Q_DECL_CF_RETURNS_RETAINED; #endif diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp index ea3e9c1441..c5cd0b92d9 100644 --- a/src/plugins/platforms/android/qandroidinputcontext.cpp +++ b/src/plugins/platforms/android/qandroidinputcontext.cpp @@ -58,6 +58,7 @@ #include #include +#include #include @@ -1020,8 +1021,19 @@ jint QAndroidInputContext::getCursorCapsMode(jint /*reqModes*/) return res; const uint qtInputMethodHints = query->value(Qt::ImHints).toUInt(); + const int localPos = query->value(Qt::ImCursorPosition).toInt(); - if (!(qtInputMethodHints & Qt::ImhLowercaseOnly) && !(qtInputMethodHints & Qt::ImhNoAutoUppercase)) + bool atWordBoundary = (localPos == 0); + if (!atWordBoundary) { + QString surroundingText = query->value(Qt::ImSurroundingText).toString(); + surroundingText.truncate(localPos); + // Add a character to see if it is at the end of the sentence or not + QTextBoundaryFinder finder(QTextBoundaryFinder::Sentence, surroundingText + QLatin1Char('A')); + finder.setPosition(localPos); + if (finder.isAtBoundary()) + atWordBoundary = finder.isAtBoundary(); + } + if (atWordBoundary && !(qtInputMethodHints & Qt::ImhLowercaseOnly) && !(qtInputMethodHints & Qt::ImhNoAutoUppercase)) res |= CAP_MODE_SENTENCES; if (qtInputMethodHints & Qt::ImhUppercaseOnly) diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm index f11016679a..069429796e 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm @@ -393,8 +393,10 @@ bool QCocoaGLContext::setDrawable(QPlatformSurface *surface) return true; } -// NSOpenGLContext is not re-entrant (https://openradar.appspot.com/37064579) -static QMutex s_contextMutex; +// NSOpenGLContext is not re-entrant. Even when using separate contexts per thread, +// view, and window, calls into the API will still deadlock. For more information +// see https://openradar.appspot.com/37064579 +static QMutex s_reentrancyMutex; void QCocoaGLContext::update() { @@ -403,7 +405,7 @@ void QCocoaGLContext::update() // render-loop that doesn't return to one of the outer pools. QMacAutoReleasePool pool; - QMutexLocker locker(&s_contextMutex); + QMutexLocker locker(&s_reentrancyMutex); qCInfo(lcQpaOpenGLContext) << "Updating" << m_context << "for" << m_context.view; [m_context update]; } @@ -422,7 +424,7 @@ void QCocoaGLContext::swapBuffers(QPlatformSurface *surface) return; } - QMutexLocker locker(&s_contextMutex); + QMutexLocker locker(&s_reentrancyMutex); [m_context flushBuffer]; } diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 03bb1bee48..373758b49e 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -201,7 +201,9 @@ void QWindowsUser32DLL::init() getPointerDeviceRects = (GetPointerDeviceRects)library.resolve("GetPointerDeviceRects"); getPointerTouchInfo = (GetPointerTouchInfo)library.resolve("GetPointerTouchInfo"); getPointerFrameTouchInfo = (GetPointerFrameTouchInfo)library.resolve("GetPointerFrameTouchInfo"); + getPointerFrameTouchInfoHistory = (GetPointerFrameTouchInfoHistory)library.resolve("GetPointerFrameTouchInfoHistory"); getPointerPenInfo = (GetPointerPenInfo)library.resolve("GetPointerPenInfo"); + getPointerPenInfoHistory = (GetPointerPenInfoHistory)library.resolve("GetPointerPenInfoHistory"); skipPointerFrameMessages = (SkipPointerFrameMessages)library.resolve("SkipPointerFrameMessages"); } @@ -216,8 +218,8 @@ void QWindowsUser32DLL::init() bool QWindowsUser32DLL::supportsPointerApi() { return enableMouseInPointer && getPointerType && getPointerInfo && getPointerDeviceRects - && getPointerTouchInfo && getPointerFrameTouchInfo && getPointerPenInfo - && skipPointerFrameMessages; + && getPointerTouchInfo && getPointerFrameTouchInfo && getPointerFrameTouchInfoHistory + && getPointerPenInfo && getPointerPenInfoHistory && skipPointerFrameMessages; } void QWindowsShcoreDLL::init() diff --git a/src/plugins/platforms/windows/qwindowscontext.h b/src/plugins/platforms/windows/qwindowscontext.h index 8102e0bf19..622c729a10 100644 --- a/src/plugins/platforms/windows/qwindowscontext.h +++ b/src/plugins/platforms/windows/qwindowscontext.h @@ -92,7 +92,9 @@ struct QWindowsUser32DLL typedef BOOL (WINAPI *GetPointerDeviceRects)(HANDLE, RECT *, RECT *); typedef BOOL (WINAPI *GetPointerTouchInfo)(UINT32, PVOID); typedef BOOL (WINAPI *GetPointerFrameTouchInfo)(UINT32, UINT32 *, PVOID); + typedef BOOL (WINAPI *GetPointerFrameTouchInfoHistory)(UINT32, UINT32 *, UINT32 *, PVOID); typedef BOOL (WINAPI *GetPointerPenInfo)(UINT32, PVOID); + typedef BOOL (WINAPI *GetPointerPenInfoHistory)(UINT32, UINT32 *, PVOID); typedef BOOL (WINAPI *SkipPointerFrameMessages)(UINT32); typedef BOOL (WINAPI *SetProcessDPIAware)(); typedef BOOL (WINAPI *AddClipboardFormatListener)(HWND); @@ -110,7 +112,9 @@ struct QWindowsUser32DLL GetPointerDeviceRects getPointerDeviceRects = nullptr; GetPointerTouchInfo getPointerTouchInfo = nullptr; GetPointerFrameTouchInfo getPointerFrameTouchInfo = nullptr; + GetPointerFrameTouchInfoHistory getPointerFrameTouchInfoHistory = nullptr; GetPointerPenInfo getPointerPenInfo = nullptr; + GetPointerPenInfoHistory getPointerPenInfoHistory = nullptr; SkipPointerFrameMessages skipPointerFrameMessages = nullptr; // Windows Vista onwards diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 0694435427..7d621126b9 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -236,7 +236,9 @@ QWindowsIntegrationPrivate::QWindowsIntegrationPrivate(const QStringList ¶mL m_options = parseOptions(paramList, &tabletAbsoluteRange, &dpiAwareness); QWindowsFontDatabase::setFontOptions(m_options); - if (!m_context.initPointer(m_options)) { + if (m_context.initPointer(m_options)) { + QCoreApplication::setAttribute(Qt::AA_CompressHighFrequencyEvents); + } else { m_context.initTablet(m_options); if (tabletAbsoluteRange >= 0) m_context.setTabletAbsoluteRange(tabletAbsoluteRange); diff --git a/src/plugins/platforms/windows/qwindowspointerhandler.cpp b/src/plugins/platforms/windows/qwindowspointerhandler.cpp index d8918d1b3d..7ead14822a 100644 --- a/src/plugins/platforms/windows/qwindowspointerhandler.cpp +++ b/src/plugins/platforms/windows/qwindowspointerhandler.cpp @@ -106,6 +106,32 @@ bool QWindowsPointerHandler::translatePointerEvent(QWindow *window, HWND hwnd, Q qWarning() << "GetPointerFrameTouchInfo() failed:" << qt_error_string(); return false; } + + if (!pointerCount) + return false; + + // The history count is the same for all the touchpoints in touchInfo + quint32 historyCount = touchInfo[0].pointerInfo.historyCount; + // dispatch any skipped frames if event compression is disabled by the app + if (historyCount > 1 && !QCoreApplication::testAttribute(Qt::AA_CompressHighFrequencyEvents)) { + touchInfo.resize(pointerCount * historyCount); + if (!QWindowsContext::user32dll.getPointerFrameTouchInfoHistory(pointerId, + &historyCount, + &pointerCount, + touchInfo.data())) { + qWarning() << "GetPointerFrameTouchInfoHistory() failed:" << qt_error_string(); + return false; + } + + // history frames are returned with the most recent frame first so we iterate backwards + bool result = true; + for (auto it = touchInfo.rbegin(), end = touchInfo.rend(); it != end; it += pointerCount) { + result &= translateTouchEvent(window, hwnd, et, msg, + &(*(it + (pointerCount - 1))), pointerCount); + } + return result; + } + return translateTouchEvent(window, hwnd, et, msg, touchInfo.data(), pointerCount); } case QT_PT_PEN: { @@ -114,6 +140,29 @@ bool QWindowsPointerHandler::translatePointerEvent(QWindow *window, HWND hwnd, Q qWarning() << "GetPointerPenInfo() failed:" << qt_error_string(); return false; } + + quint32 historyCount = penInfo.pointerInfo.historyCount; + // dispatch any skipped frames if generic or tablet event compression is disabled by the app + if (historyCount > 1 + && (!QCoreApplication::testAttribute(Qt::AA_CompressHighFrequencyEvents) + || !QCoreApplication::testAttribute(Qt::AA_CompressTabletEvents))) { + QVarLengthArray penInfoHistory(historyCount); + + if (!QWindowsContext::user32dll.getPointerPenInfoHistory(pointerId, + &historyCount, + penInfoHistory.data())) { + qWarning() << "GetPointerPenInfoHistory() failed:" << qt_error_string(); + return false; + } + + // history frames are returned with the most recent frame first so we iterate backwards + bool result = true; + for (auto it = penInfoHistory.rbegin(), end = penInfoHistory.rend(); it != end; ++it) { + result &= translatePenEvent(window, hwnd, et, msg, &(*(it))); + } + return result; + } + return translatePenEvent(window, hwnd, et, msg, &penInfo); } } diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index b0c36e61b0..94f8a8876a 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -414,6 +414,8 @@ public: bool imageNeedsEndianSwap() const { + if (!hasShm()) + return false; // The non-Shm path does its own swapping #if Q_BYTE_ORDER == Q_BIG_ENDIAN return m_setup->image_byte_order != XCB_IMAGE_ORDER_MSB_FIRST; #else diff --git a/src/plugins/sqldrivers/odbc/qsql_odbc.cpp b/src/plugins/sqldrivers/odbc/qsql_odbc.cpp index daf9686b5e..1fbbcd0ef1 100644 --- a/src/plugins/sqldrivers/odbc/qsql_odbc.cpp +++ b/src/plugins/sqldrivers/odbc/qsql_odbc.cpp @@ -1307,7 +1307,7 @@ QVariant QODBCResult::data(int field) bool QODBCResult::isNull(int field) { Q_D(const QODBCResult); - if (field < 0 || field > d->fieldCache.size()) + if (field < 0 || field >= d->fieldCache.size()) return true; if (field <= d->fieldCacheIdx) { // since there is no good way to find out whether the value is NULL diff --git a/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp index 81b5776a7c..f1a003ddcd 100644 --- a/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp +++ b/src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp @@ -106,7 +106,7 @@ static QVariant::Type qGetColumnType(const QString &tpName) } static QSqlError qMakeError(sqlite3 *access, const QString &descr, QSqlError::ErrorType type, - int errorCode = -1) + int errorCode) { return QSqlError(descr, QString(reinterpret_cast(sqlite3_errmsg16(access))), @@ -772,7 +772,9 @@ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, c openMode |= SQLITE_OPEN_NOMUTEX; - if (sqlite3_open_v2(db.toUtf8().constData(), &d->access, openMode, NULL) == SQLITE_OK) { + const int res = sqlite3_open_v2(db.toUtf8().constData(), &d->access, openMode, NULL); + + if (res == SQLITE_OK) { sqlite3_busy_timeout(d->access, timeOut); setOpen(true); setOpenError(false); @@ -785,14 +787,15 @@ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, c #endif return true; } else { + setLastError(qMakeError(d->access, tr("Error opening database"), + QSqlError::ConnectionError, res)); + setOpenError(true); + if (d->access) { sqlite3_close(d->access); d->access = 0; } - setLastError(qMakeError(d->access, tr("Error opening database"), - QSqlError::ConnectionError)); - setOpenError(true); return false; } } @@ -809,8 +812,10 @@ void QSQLiteDriver::close() sqlite3_update_hook(d->access, NULL, NULL); } - if (sqlite3_close(d->access) != SQLITE_OK) - setLastError(qMakeError(d->access, tr("Error closing database"), QSqlError::ConnectionError)); + const int res = sqlite3_close(d->access); + + if (res != SQLITE_OK) + setLastError(qMakeError(d->access, tr("Error closing database"), QSqlError::ConnectionError, res)); d->access = 0; setOpen(false); setOpenError(false); diff --git a/tests/auto/opengl/qgl/BLACKLIST b/tests/auto/opengl/qgl/BLACKLIST index 71be4bf19d..1eb0197484 100644 --- a/tests/auto/opengl/qgl/BLACKLIST +++ b/tests/auto/opengl/qgl/BLACKLIST @@ -19,6 +19,7 @@ winrt [graphicsViewClipping] windows winrt +rhel-7.4 ci [glFBOUseInGLWidget] windows winrt diff --git a/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp index 1f055e9c33..8cf43e243b 100644 --- a/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/sql/kernel/qsqldatabase/tst_qsqldatabase.cpp @@ -197,6 +197,8 @@ private slots: void sqlite_enableRegexp_data() { generic_data("QSQLITE"); } void sqlite_enableRegexp(); + void sqlite_openError(); + private: void createTestTables(QSqlDatabase db); void dropTestTables(QSqlDatabase db); @@ -2332,6 +2334,22 @@ void tst_QSqlDatabase::sqlite_enableRegexp() QFAIL_SQL(q, next()); } +void tst_QSqlDatabase::sqlite_openError() +{ + // see QTBUG-70506 + if (!QSqlDatabase::drivers().contains("QSQLITE")) + QSKIP("Database driver QSQLITE not available"); + + QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE", "sqlite_openError"); + db.setDatabaseName("/doesnotexist/foo.sqlite"); + QVERIFY(db.isValid()); + + QVERIFY(!db.open()); + QSqlError error = db.lastError(); + QCOMPARE(error.nativeErrorCode(), "14"); // SQLITE_CANTOPEN + QCOMPARE(error.databaseText(), "unable to open database file"); +} + void tst_QSqlDatabase::cloneDatabase() { QFETCH(QString, dbName); diff --git a/tests/auto/widgets/dialogs/qfiledialog2/BLACKLIST b/tests/auto/widgets/dialogs/qfiledialog2/BLACKLIST new file mode 100644 index 0000000000..e0887d8ad1 --- /dev/null +++ b/tests/auto/widgets/dialogs/qfiledialog2/BLACKLIST @@ -0,0 +1,2 @@ +[QTBUG4419_lineEditSelectAll] +osx diff --git a/tests/auto/widgets/widgets/qdoublespinbox/BLACKLIST b/tests/auto/widgets/widgets/qdoublespinbox/BLACKLIST new file mode 100644 index 0000000000..c1b6c9693e --- /dev/null +++ b/tests/auto/widgets/widgets/qdoublespinbox/BLACKLIST @@ -0,0 +1,2 @@ +[editingFinished] +* diff --git a/tests/auto/widgets/widgets/qmdisubwindow/qmdisubwindow.pro b/tests/auto/widgets/widgets/qmdisubwindow/qmdisubwindow.pro index 4299f7711e..e33271428f 100644 --- a/tests/auto/widgets/widgets/qmdisubwindow/qmdisubwindow.pro +++ b/tests/auto/widgets/widgets/qmdisubwindow/qmdisubwindow.pro @@ -1,6 +1,6 @@ CONFIG += testcase TARGET = tst_qmdisubwindow -QT += widgets testlib +QT += widgets widgets-private testlib INCLUDEPATH += . SOURCES += tst_qmdisubwindow.cpp DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII diff --git a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp index 4908f1b9f7..8b2f032172 100644 --- a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp +++ b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp @@ -30,6 +30,7 @@ #include #include "qmdisubwindow.h" +#include "private/qmdisubwindow_p.h" #include "qmdiarea.h" #include @@ -723,7 +724,9 @@ void tst_QMdiSubWindow::setOpaqueResizeAndMove() resizeSpy.clear(); QCOMPARE(resizeSpy.count(), 0); - QTest::qWait(250); // delayed update of dirty regions + // we need to wait for the resizeTimer to make sure updateDirtyRegions is called + auto priv = static_cast(qt_widget_private(window)); + QTRY_COMPARE(priv->resizeTimerId, -1); // Enter resize mode. int offset = window->style()->pixelMetric(QStyle::PM_MDIFrameWidth) / 2;