diff options
author | Liang Qi <liang.qi@qt.io> | 2018-02-16 08:54:58 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2018-02-16 08:54:58 +0100 |
commit | 942ab490724fcc9544e786e5783718e1a07aa50b (patch) | |
tree | feb7d3ff716edb37b2ca60e33c05adf8777bd964 /src/gui | |
parent | 0fb8271a467202990c90321066e40faed640a7a8 (diff) | |
parent | 24adaa9a742e6f95ff897d0eb9a2bce0527dd042 (diff) |
Merge remote-tracking branch 'origin/5.11' into dev
Conflicts:
src/corelib/tools/tools.pri
Change-Id: I705630f9cecbf0ce51a22fc6116b8c49611259e9
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/configure.json | 21 | ||||
-rw-r--r-- | src/gui/doc/src/qtgui.qdoc | 5 | ||||
-rw-r--r-- | src/gui/image/qmovie.cpp | 8 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 4 | ||||
-rw-r--r-- | src/gui/kernel/qopenglcontext.cpp | 1 | ||||
-rw-r--r-- | src/gui/kernel/qplatforminputcontext.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qsimpledrag.cpp | 30 | ||||
-rw-r--r-- | src/gui/kernel/qsimpledrag_p.h | 6 | ||||
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface.cpp | 3 | ||||
-rw-r--r-- | src/gui/opengl/qopengltexture.cpp | 2 | ||||
-rw-r--r-- | src/gui/painting/painting.pri | 2 | ||||
-rw-r--r-- | src/gui/painting/qmatrix.h | 4 | ||||
-rw-r--r-- | src/gui/painting/qtransform.h | 6 | ||||
-rw-r--r-- | src/gui/text/qtextengine_p.h | 8 | ||||
-rw-r--r-- | src/gui/text/qtextobject.h | 4 |
15 files changed, 71 insertions, 35 deletions
diff --git a/src/gui/configure.json b/src/gui/configure.json index ccaf38e4b7..27e913877f 100644 --- a/src/gui/configure.json +++ b/src/gui/configure.json @@ -167,25 +167,20 @@ "label": "Fontconfig", "test": { "head": [ - "#include <ft2build.h>", - "#include FT_FREETYPE_H", "#include <fontconfig/fontconfig.h>", "#ifndef FC_RGBA_UNKNOWN", "# error This version of fontconfig is tool old, it is missing the FC_RGBA_UNKNOWN define", - "#endif", - "#if ((FREETYPE_MAJOR*10000 + FREETYPE_MINOR*100 + FREETYPE_PATCH) < 20110)", - "# error This version of freetype is too old.", "#endif" ], "main": [ - "FT_Face face = 0;", "FcPattern *pattern = 0;" ] }, "sources": [ - { "type": "pkgConfig", "args": "fontconfig freetype2" }, - { "type": "freetype", "libs": "-lfontconfig -lfreetype" } - ] + { "type": "pkgConfig", "args": "fontconfig" }, + { "type": "freetype", "libs": "-lfontconfig" } + ], + "use": "freetype" }, "gbm": { "label": "GBM", @@ -637,7 +632,13 @@ "angle_d3d11_qdtd": { "label": "D3D11_QUERY_DATA_TIMESTAMP_DISJOINT", "type": "compile", - "test": "win/angle_d3d11_qdtd" + "test": { + "include": "d3d11.h", + "main": [ + "D3D11_QUERY_DATA_TIMESTAMP_DISJOINT qdtd;", + "(void) qdtd;" + ] + } }, "directwrite2": { "label": "DirectWrite 2", diff --git a/src/gui/doc/src/qtgui.qdoc b/src/gui/doc/src/qtgui.qdoc index da3d419735..010659df8c 100644 --- a/src/gui/doc/src/qtgui.qdoc +++ b/src/gui/doc/src/qtgui.qdoc @@ -215,12 +215,13 @@ \section1 Licenses and Attributions Qt GUI is available under commercial licenses from \l{The Qt Company}. - In addition, it is available under the + In addition, it is available under free software licenses. Since Qt 5.4, + these free software licenses are \l{GNU Lesser General Public License, version 3}, or the \l{GNU General Public License, version 2}. See \l{Qt Licensing} for further details. - Furthermore Qt GUI potentially contains third party + Furthermore, Qt GUI in Qt \QtVersion may contain third-party modules under following permissive licenses: \generatelist{groupsbymodule attributions-qtgui} diff --git a/src/gui/image/qmovie.cpp b/src/gui/image/qmovie.cpp index d5e8b1b974..010760de4c 100644 --- a/src/gui/image/qmovie.cpp +++ b/src/gui/image/qmovie.cpp @@ -470,6 +470,10 @@ bool QMoviePrivate::next() currentPixmap = QPixmap::fromImage( info.pixmap.toImage().scaled(scaledSize) ); else currentPixmap = info.pixmap; + + if (!speed) + return true; + nextDelay = speedAdjustedDelay(info.delay); // Adjust delay according to the time it took to read the frame int processingTime = time.elapsed(); @@ -504,7 +508,7 @@ void QMoviePrivate::_q_loadNextFrame(bool starting) emit q->updated(frameRect); emit q->frameChanged(currentFrameNumber); - if (movieState == QMovie::Running) + if (speed && movieState == QMovie::Running) nextImageTimer.start(nextDelay); } else { // Could not read another frame @@ -926,6 +930,8 @@ void QMovie::setPaused(bool paused) void QMovie::setSpeed(int percentSpeed) { Q_D(QMovie); + if (!d->speed && d->movieState == Running) + d->nextImageTimer.start(nextFrameDelay()); d->speed = percentSpeed; } diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 36c9b1a964..f7da94d111 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -2122,7 +2122,7 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE QWindow *window = e->window.data(); modifier_buttons = e->modifiers; if (e->nullWindow() -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) || e->key == Qt::Key_Back || e->key == Qt::Key_Menu #endif ) { @@ -2158,7 +2158,7 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE if (window && !window->d_func()->blockedByModalWindow) QGuiApplication::sendSpontaneousEvent(window, &ev); -#if defined(Q_OS_ANDROID) +#if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) else ev.setAccepted(false); diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index 27ea3864b9..6f332c8ad6 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -1002,6 +1002,7 @@ bool QOpenGLContext::makeCurrent(QSurface *surface) if (rendererString) needsWorkaround = qstrncmp(rendererString, "Mali-4xx", 6) == 0 // Mali-400, Mali-450 + || qstrcmp(rendererString, "Mali-T880") == 0 || qstrncmp(rendererString, "Adreno (TM) 2xx", 13) == 0 // Adreno 200, 203, 205 || qstrncmp(rendererString, "Adreno 2xx", 8) == 0 // Same as above but without the '(TM)' || qstrncmp(rendererString, "Adreno (TM) 30x", 14) == 0 // Adreno 302, 305 diff --git a/src/gui/kernel/qplatforminputcontext.cpp b/src/gui/kernel/qplatforminputcontext.cpp index 3f59116e9a..9771e6ba11 100644 --- a/src/gui/kernel/qplatforminputcontext.cpp +++ b/src/gui/kernel/qplatforminputcontext.cpp @@ -287,6 +287,8 @@ void QPlatformInputContext::setSelectionOnFocusObject(const QPointF &anchorPos, if (success) { int cursor = QInputMethod::queryFocusObject(Qt::ImCursorPosition, cursorPos * mapToLocal).toInt(&success); if (success) { + if (anchor == cursor && anchorPos != cursorPos) + return; QList<QInputMethodEvent::Attribute> imAttributes; imAttributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Selection, anchor, cursor - anchor, QVariant())); QInputMethodEvent event(QString(), imAttributes); diff --git a/src/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp index 1b56c7d9f2..c98b879a15 100644 --- a/src/gui/kernel/qsimpledrag.cpp +++ b/src/gui/kernel/qsimpledrag.cpp @@ -58,6 +58,7 @@ #include <QtCore/QEventLoop> #include <QtCore/QDebug> +#include <QtCore/QLoggingCategory> #include <private/qguiapplication_p.h> #include <private/qdnd_p.h> @@ -69,6 +70,8 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_DRAGANDDROP +Q_LOGGING_CATEGORY(lcDnd, "qt.gui.dnd") + static QWindow* topLevelAt(const QPoint &pos) { QWindowList list = QGuiApplication::topLevelWindows(); @@ -94,9 +97,9 @@ static QWindow* topLevelAt(const QPoint &pos) */ QBasicDrag::QBasicDrag() : - m_restoreCursor(false), m_eventLoop(0), + m_current_window(nullptr), m_restoreCursor(false), m_eventLoop(nullptr), m_executed_drop_action(Qt::IgnoreAction), m_can_drop(false), - m_drag(0), m_drag_icon_window(0), m_useCompositing(true), + m_drag(nullptr), m_drag_icon_window(nullptr), m_useCompositing(true), m_screen(nullptr) { } @@ -161,6 +164,7 @@ bool QBasicDrag::eventFilter(QObject *o, QEvent *e) return true; // Eat all mouse move events } case QEvent::MouseButtonRelease: + { disableEventFilter(); if (canDrop()) { QPoint nativePosition = getNativeMousePos(e, m_drag_icon_window); @@ -169,8 +173,25 @@ bool QBasicDrag::eventFilter(QObject *o, QEvent *e) cancel(); } exitDndEventLoop(); - QCoreApplication::postEvent(o, new QMouseEvent(*static_cast<QMouseEvent *>(e))); + + // If a QShapedPixmapWindow (drag feedback) is being dragged along, the + // mouse event's localPos() will be relative to that, which is useless. + // We want a position relative to the window where the drag ends, if possible (?). + // If there is no such window (belonging to this Qt application), + // make the event relative to the window where the drag started. (QTBUG-66103) + const QMouseEvent *release = static_cast<QMouseEvent *>(e); + const QWindow *releaseWindow = topLevelAt(release->globalPos()); + qCDebug(lcDnd) << "mouse released over" << releaseWindow << "after drag from" << m_current_window << "globalPos" << release->globalPos(); + if (!releaseWindow) + releaseWindow = m_current_window; + QPoint releaseWindowPos = (releaseWindow ? releaseWindow->mapFromGlobal(release->globalPos()) : release->globalPos()); + QMouseEvent *newRelease = new QMouseEvent(release->type(), + releaseWindowPos, releaseWindowPos, release->screenPos(), + release->button(), release->buttons(), + release->modifiers(), release->source()); + QCoreApplication::postEvent(o, newRelease); return true; // defer mouse release events until drag event loop has returned + } case QEvent::MouseButtonDblClick: case QEvent::Wheel: return true; @@ -349,7 +370,7 @@ static inline QPoint fromNativeGlobalPixels(const QPoint &point) into account. */ -QSimpleDrag::QSimpleDrag() : m_current_window(0) +QSimpleDrag::QSimpleDrag() { } @@ -366,6 +387,7 @@ void QSimpleDrag::startDrag() updateCursor(Qt::IgnoreAction); } setExecutedDropAction(Qt::IgnoreAction); + qCDebug(lcDnd) << "drag began from" << m_current_window<< "cursor pos" << QCursor::pos() << "can drop?" << canDrop(); } void QSimpleDrag::cancel() diff --git a/src/gui/kernel/qsimpledrag_p.h b/src/gui/kernel/qsimpledrag_p.h index 4db8eb4505..e56c7bf306 100644 --- a/src/gui/kernel/qsimpledrag_p.h +++ b/src/gui/kernel/qsimpledrag_p.h @@ -105,6 +105,9 @@ protected: QDrag *drag() const { return m_drag; } +protected: + QWindow *m_current_window; + private: void enableEventFilter(); void disableEventFilter(); @@ -131,9 +134,6 @@ protected: virtual void cancel() override; virtual void move(const QPoint &globalPos) override; virtual void drop(const QPoint &globalPos) override; - -private: - QWindow *m_current_window; }; #endif // QT_NO_DRAGANDDROP diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index 35a9ede227..318a280a40 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -283,9 +283,10 @@ QT_DEFINE_QPA_EVENT_HANDLER(void, handleApplicationStateChanged, Qt::Application QWindowSystemInterfacePrivate::GeometryChangeEvent::GeometryChangeEvent(QWindow *window, const QRect &newGeometry) : WindowSystemEvent(GeometryChange) , window(window) - , requestedGeometry(window->handle() ? window->handle()->QPlatformWindow::geometry() : QRect()) , newGeometry(newGeometry) { + if (const QPlatformWindow *pw = window->handle()) + requestedGeometry = QHighDpi::fromNativePixels(pw->QPlatformWindow::geometry(), window); } QT_DEFINE_QPA_EVENT_HANDLER(void, handleGeometryChange, QWindow *window, const QRect &newRect) diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp index 3563f1b5d3..b825b56d45 100644 --- a/src/gui/opengl/qopengltexture.cpp +++ b/src/gui/opengl/qopengltexture.cpp @@ -778,6 +778,8 @@ static QOpenGLTexture::PixelFormat pixelFormatCompatibleWithInternalFormat(QOpen return QOpenGLTexture::Alpha; case QOpenGLTexture::RGBFormat: + return QOpenGLTexture::RGB; + case QOpenGLTexture::RGBAFormat: return QOpenGLTexture::RGBA; diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 1e14498f79..29bef14f0c 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -127,7 +127,7 @@ AVX2_SOURCES += painting/qdrawhelper_avx2.cpp NEON_SOURCES += painting/qdrawhelper_neon.cpp painting/qimagescale_neon.cpp NEON_HEADERS += painting/qdrawhelper_neon_p.h NEON_ASM += ../3rdparty/pixman/pixman-arm-neon-asm.S painting/qdrawhelper_neon_asm.S -!uikit:contains(QT_ARCH, "arm"): CONFIG += no_clang_integrated_as +!uikit:!win32:contains(QT_ARCH, "arm"): CONFIG += no_clang_integrated_as !uikit:!win32:!contains(QT_ARCH, "arm64"): DEFINES += ENABLE_PIXMAN_DRAWHELPERS MIPS_DSP_SOURCES += painting/qdrawhelper_mips_dsp.cpp diff --git a/src/gui/painting/qmatrix.h b/src/gui/painting/qmatrix.h index 74ecef767e..d8a4fcfb1c 100644 --- a/src/gui/painting/qmatrix.h +++ b/src/gui/painting/qmatrix.h @@ -65,10 +65,10 @@ public: #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove; the compiler-generated ones are fine! QMatrix &operator=(QMatrix &&other) Q_DECL_NOTHROW // = default - { memcpy(this, &other, sizeof(QMatrix)); return *this; } + { memcpy(static_cast<void *>(this), static_cast<void *>(&other), sizeof(QMatrix)); return *this; } QMatrix &operator=(const QMatrix &) Q_DECL_NOTHROW; // = default QMatrix(QMatrix &&other) Q_DECL_NOTHROW // = default - { memcpy(this, &other, sizeof(QMatrix)); } + { memcpy(static_cast<void *>(this), static_cast<void *>(&other), sizeof(QMatrix)); } QMatrix(const QMatrix &other) Q_DECL_NOTHROW; // = default #endif diff --git a/src/gui/painting/qtransform.h b/src/gui/painting/qtransform.h index 79835b36e2..63c4a241c1 100644 --- a/src/gui/painting/qtransform.h +++ b/src/gui/painting/qtransform.h @@ -78,14 +78,14 @@ public: #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove; the compiler-generated ones are fine! QTransform &operator=(QTransform &&other) Q_DECL_NOTHROW // = default - { memcpy(this, &other, sizeof(QTransform)); return *this; } + { memcpy(static_cast<void *>(this), static_cast<void *>(&other), sizeof(QTransform)); return *this; } QTransform &operator=(const QTransform &) Q_DECL_NOTHROW; // = default QTransform(QTransform &&other) Q_DECL_NOTHROW // = default : affine(Qt::Uninitialized) - { memcpy(this, &other, sizeof(QTransform)); } + { memcpy(static_cast<void *>(this), static_cast<void *>(&other), sizeof(QTransform)); } QTransform(const QTransform &other) Q_DECL_NOTHROW // = default : affine(Qt::Uninitialized) - { memcpy(this, &other, sizeof(QTransform)); } + { memcpy(static_cast<void *>(this), static_cast<const void *>(&other), sizeof(QTransform)); } #endif bool isAffine() const; diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h index 8cdbeafd7d..4b1564e69c 100644 --- a/src/gui/text/qtextengine_p.h +++ b/src/gui/text/qtextengine_p.h @@ -237,13 +237,13 @@ struct QGlyphLayout last = numGlyphs; if (first == 0 && last == numGlyphs && reinterpret_cast<char *>(offsets + numGlyphs) == reinterpret_cast<char *>(glyphs)) { - memset(offsets, 0, (numGlyphs * SpaceNeeded)); + memset(static_cast<void *>(offsets), 0, (numGlyphs * SpaceNeeded)); } else { const int num = last - first; - memset(offsets + first, 0, num * sizeof(QFixedPoint)); + memset(static_cast<void *>(offsets + first), 0, num * sizeof(QFixedPoint)); memset(glyphs + first, 0, num * sizeof(glyph_t)); - memset(advances + first, 0, num * sizeof(QFixed)); - memset(justifications + first, 0, num * sizeof(QGlyphJustification)); + memset(static_cast<void *>(advances + first), 0, num * sizeof(QFixed)); + memset(static_cast<void *>(justifications + first), 0, num * sizeof(QGlyphJustification)); memset(attributes + first, 0, num * sizeof(QGlyphAttributes)); } } diff --git a/src/gui/text/qtextobject.h b/src/gui/text/qtextobject.h index 7e4efa28f8..067f8473ea 100644 --- a/src/gui/text/qtextobject.h +++ b/src/gui/text/qtextobject.h @@ -154,9 +154,9 @@ public: iterator(const iterator &o) Q_DECL_NOTHROW; // = default iterator &operator=(const iterator &o) Q_DECL_NOTHROW; // = default iterator(iterator &&other) Q_DECL_NOTHROW // = default - { memcpy(this, &other, sizeof(iterator)); } + { memcpy(static_cast<void *>(this), static_cast<void *>(&other), sizeof(iterator)); } iterator &operator=(iterator &&other) Q_DECL_NOTHROW // = default - { memcpy(this, &other, sizeof(iterator)); return *this; } + { memcpy(static_cast<void *>(this), static_cast<void *>(&other), sizeof(iterator)); return *this; } #endif QTextFrame *parentFrame() const { return f; } |