From 8dcfb43d8f6bdd9d1331391bb4dfbee73de30658 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 17 Dec 2014 16:05:23 +0100 Subject: Resolve GLES3 functions from the shared lib MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unfortunately the few functions that are part of the OpenGL ES 3.0 standard and are used by QtGui have to have special handling after all. Just directly calling the functions causes issues when building on a GLES3 capable system and deploying somewhere where only GLES2 is available. Using eglGetProcAddress and such is not an option because the ES spec does not guarantee that standard functions are resolvable via that mechanism. Task-number: QTBUG-43318 Change-Id: I72f985d75ca669835839016573cbb8e4a3fb41db Reviewed-by: Jørgen Lind --- src/gui/opengl/qopenglextensions_p.h | 27 ++++++++ src/gui/opengl/qopenglfunctions.cpp | 99 +++++++++++++++++++++-------- src/gui/opengl/qopengltexturehelper.cpp | 33 +++++----- src/gui/opengl/qopenglvertexarrayobject.cpp | 16 ++--- 4 files changed, 124 insertions(+), 51 deletions(-) (limited to 'src') diff --git a/src/gui/opengl/qopenglextensions_p.h b/src/gui/opengl/qopenglextensions_p.h index 23cfe16467..f53addaf0e 100644 --- a/src/gui/opengl/qopenglextensions_p.h +++ b/src/gui/opengl/qopenglextensions_p.h @@ -46,11 +46,36 @@ // #include "qopenglfunctions.h" +#include QT_BEGIN_NAMESPACE class QOpenGLExtensionsPrivate; +class QOpenGLES3Helper +{ +public: + QOpenGLES3Helper(); + + GLvoid* (QOPENGLF_APIENTRYP MapBufferRange)(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr length, GLbitfield access); + GLboolean (QOPENGLF_APIENTRYP UnmapBuffer)(GLenum target); + void (QOPENGLF_APIENTRYP BlitFramebuffer)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); + void (QOPENGLF_APIENTRYP RenderbufferStorageMultisample)(GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height); + + void (QOPENGLF_APIENTRYP GenVertexArrays)(GLsizei n, GLuint *arrays); + void (QOPENGLF_APIENTRYP DeleteVertexArrays)(GLsizei n, const GLuint *arrays); + void (QOPENGLF_APIENTRYP BindVertexArray)(GLuint array); + GLboolean (QOPENGLF_APIENTRYP IsVertexArray)(GLuint array); + + void (QOPENGLF_APIENTRYP TexImage3D)(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); + void (QOPENGLF_APIENTRYP TexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); + void (QOPENGLF_APIENTRYP CompressedTexImage3D)(GLenum target, GLint level, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); + void (QOPENGLF_APIENTRYP CompressedTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); + +private: + QLibrary m_gl; +}; + class Q_GUI_EXPORT QOpenGLExtensions : public QOpenGLFunctions { Q_DECLARE_PRIVATE(QOpenGLExtensions) @@ -102,6 +127,8 @@ public: void glGetBufferSubData(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, GLvoid *data); + QOpenGLES3Helper *gles3Helper(); + private: static bool isInitialized(const QOpenGLFunctionsPrivate *d) { return d != 0; } }; diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp index 44b56699df..d561e65d8e 100644 --- a/src/gui/opengl/qopenglfunctions.cpp +++ b/src/gui/opengl/qopenglfunctions.cpp @@ -3187,65 +3187,105 @@ static void QOPENGLF_APIENTRY qopenglfResolveVertexAttribPointer(GLuint indx, GL #endif // !QT_OPENGL_ES_2 +// Functions part of the OpenGL ES 3.0+ standard need special handling. These, +// just like the 2.0 functions, are not guaranteed to be resolvable via +// eglGetProcAddress or similar. Calling them directly is, unlike the 2.0 +// functions, not feasible because one may build the binaries on a GLES3-capable +// system and then deploy on a GLES2-only system that does not have these +// symbols. Until ES3 gets universally available, they have to be dlsym'ed. + +Q_GLOBAL_STATIC(QOpenGLES3Helper, qgles3Helper) + +QOpenGLES3Helper::QOpenGLES3Helper() +{ +#ifdef Q_OS_WIN +#ifdef QT_DEBUG + m_gl.setFileName(QStringLiteral("libGLESv2")); +#else + m_gl.setFileName(QStringLiteral("libGLESv2d")); +#endif +#else + m_gl.setFileName(QStringLiteral("GLESv2")); +#endif + if (m_gl.load()) { + MapBufferRange = (GLvoid* (QOPENGLF_APIENTRYP)(GLenum, qopengl_GLintptr, qopengl_GLsizeiptr, GLbitfield)) m_gl.resolve("glMapBufferRange"); + UnmapBuffer = (GLboolean (QOPENGLF_APIENTRYP)(GLenum)) m_gl.resolve("glUnmapBuffer"); + BlitFramebuffer = (void (QOPENGLF_APIENTRYP)(GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum)) m_gl.resolve("glBlitFramebuffer"); + RenderbufferStorageMultisample = (void (QOPENGLF_APIENTRYP)(GLenum, GLsizei, GLenum, GLsizei, GLsizei)) m_gl.resolve("glRenderbufferStorageMultisample"); + + GenVertexArrays = (void (QOPENGLF_APIENTRYP)(GLsizei, GLuint *)) m_gl.resolve("glGenVertexArrays"); + DeleteVertexArrays = (void (QOPENGLF_APIENTRYP)(GLsizei, const GLuint *)) m_gl.resolve("glDeleteVertexArrays"); + BindVertexArray = (void (QOPENGLF_APIENTRYP)(GLuint)) m_gl.resolve("glBindVertexArray"); + IsVertexArray = (GLboolean (QOPENGLF_APIENTRYP)(GLuint)) m_gl.resolve("glIsVertexArray"); + + TexImage3D = (void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *)) m_gl.resolve("glTexImage3D"); + TexSubImage3D = (void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *)) m_gl.resolve("glTexSubImage3D"); + CompressedTexImage3D = (void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *)) m_gl.resolve("glCompressedTexImage3D"); + CompressedTexSubImage3D = (void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *)) m_gl.resolve("glCompressedTexSubImage3D"); + + if (!MapBufferRange || !GenVertexArrays || !TexImage3D) + qFatal("OpenGL ES 3.0 entry points not found"); + } else { + qFatal("Failed to load libGLESv2"); + } +} + +static inline bool isES3() +{ + QOpenGLContext *ctx = QOpenGLContext::currentContext(); + return ctx->isOpenGLES() && ctx->format().majorVersion() >= 3; +} + static GLvoid *QOPENGLF_APIENTRY qopenglfResolveMapBuffer(GLenum target, GLenum access) { -#ifdef QT_OPENGL_ES_3 // It is possible that GL_OES_map_buffer is present, but then having to // differentiate between glUnmapBufferOES and glUnmapBuffer causes extra // headache. QOpenGLBuffer::map() will handle this automatically, while direct // calls are better off with migrating to the standard glMapBufferRange. - if (QOpenGLContext::currentContext()->format().majorVersion() >= 3) { + if (isES3()) { qWarning("QOpenGLFunctions: glMapBuffer is not available in OpenGL ES 3.0 and up. Use glMapBufferRange instead."); return 0; - } else -#endif - RESOLVE_FUNC(GLvoid *, ResolveOES, MapBuffer)(target, access); + } else { + RESOLVE_FUNC(GLvoid *, ResolveOES, MapBuffer)(target, access); + } } static GLvoid *QOPENGLF_APIENTRY qopenglfResolveMapBufferRange(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr length, GLbitfield access) { -#ifdef QT_OPENGL_ES_3 - if (QOpenGLContext::currentContext()->format().majorVersion() >= 3) - return ::glMapBufferRange(target, offset, length, access); + if (isES3()) + return qgles3Helper()->MapBufferRange(target, offset, length, access); else -#endif - RESOLVE_FUNC(GLvoid *, 0, MapBufferRange)(target, offset, length, access); + RESOLVE_FUNC(GLvoid *, 0, MapBufferRange)(target, offset, length, access); } static GLboolean QOPENGLF_APIENTRY qopenglfResolveUnmapBuffer(GLenum target) { -#ifdef QT_OPENGL_ES_3 - if (QOpenGLContext::currentContext()->format().majorVersion() >= 3) - return ::glUnmapBuffer(target); + if (isES3()) + return qgles3Helper()->UnmapBuffer(target); else -#endif - RESOLVE_FUNC(GLboolean, ResolveOES, UnmapBuffer)(target); + RESOLVE_FUNC(GLboolean, ResolveOES, UnmapBuffer)(target); } static void QOPENGLF_APIENTRY qopenglfResolveBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) { -#ifdef QT_OPENGL_ES_3 - if (QOpenGLContext::currentContext()->format().majorVersion() >= 3) - ::glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); + if (isES3()) + qgles3Helper()->BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); else -#endif - RESOLVE_FUNC_VOID(ResolveEXT | ResolveANGLE | ResolveNV, BlitFramebuffer) - (srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); + RESOLVE_FUNC_VOID(ResolveEXT | ResolveANGLE | ResolveNV, BlitFramebuffer) + (srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); } static void QOPENGLF_APIENTRY qopenglfResolveRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height) { -#ifdef QT_OPENGL_ES_3 - if (QOpenGLContext::currentContext()->format().majorVersion() >= 3) - ::glRenderbufferStorageMultisample(target, samples, internalFormat, width, height); + if (isES3()) + qgles3Helper()->RenderbufferStorageMultisample(target, samples, internalFormat, width, height); else -#endif - RESOLVE_FUNC_VOID(ResolveEXT | ResolveANGLE | ResolveNV, RenderbufferStorageMultisample) - (target, samples, internalFormat, width, height); + RESOLVE_FUNC_VOID(ResolveEXT | ResolveANGLE | ResolveNV, RenderbufferStorageMultisample) + (target, samples, internalFormat, width, height); } static void QOPENGLF_APIENTRY qopenglfResolveGetBufferSubData(GLenum target, qopengl_GLintptr offset, qopengl_GLsizeiptr size, GLvoid *data) @@ -3494,4 +3534,9 @@ QOpenGLExtensionsPrivate::QOpenGLExtensionsPrivate(QOpenGLContext *ctx) GetBufferSubData = qopenglfResolveGetBufferSubData; } +QOpenGLES3Helper *QOpenGLExtensions::gles3Helper() +{ + return qgles3Helper(); +} + QT_END_NAMESPACE diff --git a/src/gui/opengl/qopengltexturehelper.cpp b/src/gui/opengl/qopengltexturehelper.cpp index 29cecf0ea8..e1e3593f4f 100644 --- a/src/gui/opengl/qopengltexturehelper.cpp +++ b/src/gui/opengl/qopengltexturehelper.cpp @@ -34,6 +34,7 @@ #include "qopengltexturehelper_p.h" #include +#include QT_BEGIN_NAMESPACE @@ -242,21 +243,23 @@ QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context) CompressedTexImage3D = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glCompressedTexImage3DOES"))); CompressedTexSubImage3D = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glCompressedTexSubImage3DOES"))); } else { -#ifdef QT_OPENGL_ES_3 - // OpenGL ES 3.0+ has glTexImage3D. - TexImage3D = ::glTexImage3D; - TexSubImage3D = ::glTexSubImage3D; - CompressedTexImage3D = ::glCompressedTexImage3D; - CompressedTexSubImage3D = ::glCompressedTexSubImage3D; -#else - // OpenGL 1.2 - TexImage3D = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glTexImage3D"))); - TexSubImage3D = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glTexSubImage3D"))); - - // OpenGL 1.3 - CompressedTexImage3D = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glCompressedTexImage3D"))); - CompressedTexSubImage3D = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glCompressedTexSubImage3D"))); -#endif + QOpenGLContext *ctx = QOpenGLContext::currentContext(); + if (ctx->isOpenGLES() && ctx->format().majorVersion() >= 3) { + // OpenGL ES 3.0+ has glTexImage3D. + QOpenGLES3Helper *es3 = static_cast(ctx->functions())->gles3Helper(); + TexImage3D = es3->TexImage3D; + TexSubImage3D = es3->TexSubImage3D; + CompressedTexImage3D = es3->CompressedTexImage3D; + CompressedTexSubImage3D = es3->CompressedTexSubImage3D; + } else { + // OpenGL 1.2 + TexImage3D = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glTexImage3D"))); + TexSubImage3D = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glTexSubImage3D"))); + + // OpenGL 1.3 + CompressedTexImage3D = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glCompressedTexImage3D"))); + CompressedTexSubImage3D = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glCompressedTexSubImage3D"))); + } } #ifndef QT_OPENGL_ES_2 diff --git a/src/gui/opengl/qopenglvertexarrayobject.cpp b/src/gui/opengl/qopenglvertexarrayobject.cpp index 5520dfed08..d3eadf9ae1 100644 --- a/src/gui/opengl/qopenglvertexarrayobject.cpp +++ b/src/gui/opengl/qopenglvertexarrayobject.cpp @@ -35,12 +35,12 @@ #include #include -#include #include #include #include +#include #include QT_BEGIN_NAMESPACE @@ -56,16 +56,14 @@ void qtInitializeVertexArrayObjectHelper(QOpenGLVertexArrayObjectHelper *helper, bool tryARB = true; if (context->isOpenGLES()) { -#ifdef QT_OPENGL_ES_3 if (context->format().majorVersion() >= 3) { - helper->GenVertexArrays = ::glGenVertexArrays; - helper->DeleteVertexArrays = ::glDeleteVertexArrays; - helper->BindVertexArray = ::glBindVertexArray; - helper->IsVertexArray = ::glIsVertexArray; + QOpenGLES3Helper *es3 = static_cast(context->functions())->gles3Helper(); + helper->GenVertexArrays = es3->GenVertexArrays; + helper->DeleteVertexArrays = es3->DeleteVertexArrays; + helper->BindVertexArray = es3->BindVertexArray; + helper->IsVertexArray = es3->IsVertexArray; tryARB = false; - } else -#endif - if (context->hasExtension(QByteArrayLiteral("GL_OES_vertex_array_object"))) { + } else if (context->hasExtension(QByteArrayLiteral("GL_OES_vertex_array_object"))) { helper->GenVertexArrays = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glGenVertexArraysOES"))); helper->DeleteVertexArrays = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glDeleteVertexArraysOES"))); helper->BindVertexArray = reinterpret_cast(context->getProcAddress(QByteArrayLiteral("glBindVertexArrayOES"))); -- cgit v1.2.3 From be5cfa960b617fb31a2a1f4ce850c35dcb23fde5 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Thu, 8 Jan 2015 14:24:34 +0100 Subject: QMacPasteboardMimeFileUri: Use file paths instead of file references Change-Id: I732d94bc6add2814c8ebd2c7fe80592024dd1b9a Task-number: QTBUG-40449 Reviewed-by: Eike Ziller --- src/platformsupport/clipboard/qmacmime.mm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/platformsupport/clipboard/qmacmime.mm b/src/platformsupport/clipboard/qmacmime.mm index 6fcd19e07b..44580b017c 100644 --- a/src/platformsupport/clipboard/qmacmime.mm +++ b/src/platformsupport/clipboard/qmacmime.mm @@ -611,9 +611,21 @@ QVariant QMacPasteboardMimeFileUri::convertToMime(const QString &mime, QList ret; for (int i = 0; i < data.size(); ++i) { - QUrl url = QUrl::fromEncoded(data.at(i)); + const QByteArray &a = data.at(i); + NSString *urlString = [[[NSString alloc] initWithBytesNoCopy:(void *)a.data() length:a.size() + encoding:NSUTF8StringEncoding freeWhenDone:NO] autorelease]; + NSURL *nsurl = [NSURL URLWithString:urlString]; + QUrl url; + // OS X 10.10 sends file references instead of file paths + if ([nsurl isFileReferenceURL]) { + url = QUrl::fromNSURL([nsurl filePathURL]); + } else { + url = QUrl::fromNSURL(nsurl); + } + if (url.host().toLower() == QLatin1String("localhost")) url.setHost(QString()); + url.setPath(url.path().normalized(QString::NormalizationForm_C)); ret.append(url); } -- cgit v1.2.3 From ea9a366d3f01262f32134d1e9f7853d17832dbac Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 11 Dec 2014 09:47:43 +0100 Subject: Swallow wheel events while a popup widget is open. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wheel events should not cause a popup widget parented on a scrollable widget to be closed or moved to correctly reflect the system behavior on OS X and Windows. Task-number: QTBUG-42731 Task-number: QTBUG-40656 Change-Id: I4ef75aa8331390309c251316ac76db2cf9ec51f7 Reviewed-by: Morten Johan Sørvig --- src/widgets/kernel/qapplication.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index b7d0869289..abd0231b00 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -3320,12 +3320,10 @@ bool QApplication::notify(QObject *receiver, QEvent *e) QWidget* w = static_cast(receiver); QWheelEvent* wheel = static_cast(e); - // QTBUG-40656, combo and other popups should close when the main window gets a wheel event. - while (QWidget *popup = QApplication::activePopupWidget()) { + // QTBUG-40656, QTBUG-42731: ignore wheel events when a popup (QComboBox) is open. + if (const QWidget *popup = QApplication::activePopupWidget()) { if (w->window() != popup) - popup->close(); - else - break; + return true; } QPoint relpos = wheel->pos(); -- cgit v1.2.3 From ecd74bcc945b60ac0d21a28c5fd18528f1a19090 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 13 Jan 2015 09:00:44 +0100 Subject: Bump copyright year to 2015 Bump copyright year in tool output and user visible strings to 2015. Change-Id: I9b29907fe3f555e78005cb296a49d92f601fb7ec Reviewed-by: Lars Knoll Reviewed-by: Martin Smith --- src/corelib/global/qlibraryinfo.cpp | 4 ++-- src/corelib/kernel/qtcore_eval.cpp | 6 +++--- src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp | 4 ++-- src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp | 4 ++-- src/tools/qdoc/doc/qdoc-manual-markupcmds.qdoc | 4 ++-- src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc | 4 ++-- src/tools/qlalr/cppgenerator.cpp | 4 ++-- src/widgets/dialogs/qmessagebox.cpp | 4 ++-- 8 files changed, 17 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 7ca0aa7f0b..2698098be0 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies). ** Copyright (C) 2014 Intel Corporation ** Contact: http://www.qt-project.org/legal ** @@ -605,7 +605,7 @@ extern "C" void qt_core_boilerplate(); void qt_core_boilerplate() { printf("This is the QtCore library version " QT_BUILD_STR "\n" - "Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).\n" + "Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).\n" "Contact: http://www.qt-project.org/legal\n" "\n" "Build date: %s\n" diff --git a/src/corelib/kernel/qtcore_eval.cpp b/src/corelib/kernel/qtcore_eval.cpp index eb1019534c..2ee8c20bc3 100644 --- a/src/corelib/kernel/qtcore_eval.cpp +++ b/src/corelib/kernel/qtcore_eval.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtCore module of the Qt Toolkit. @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE static const char boilerplate_supported_but_time_limited[] = "\nQt %1 Evaluation License\n" - "Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).\n" + "Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).\n" "This trial version may only be used for evaluation purposes\n" "and will shut down after 120 minutes.\n" "Registered to:\n" @@ -57,7 +57,7 @@ static const char boilerplate_supported_but_time_limited[] = static const char boilerplate_supported[] = "\nQt %1 Evaluation License\n" - "Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).\n" + "Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).\n" "This trial version may only be used for evaluation purposes\n" "Registered to:\n" " Licensee: %2\n\n" diff --git a/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp b/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp index dc735df297..8b13334ca0 100644 --- a/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp +++ b/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the tools applications of the Qt Toolkit. @@ -67,7 +67,7 @@ static const char docTypeHeader[] = #define PROGRAMNAME "qdbuscpp2xml" #define PROGRAMVERSION "0.2" -#define PROGRAMCOPYRIGHT "Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies)." +#define PROGRAMCOPYRIGHT "Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies)." static QString outputFile; static int flags; diff --git a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp index a85dd44f65..5b8de7c2ab 100644 --- a/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp +++ b/src/tools/qdbusxml2cpp/qdbusxml2cpp.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the tools applications of the Qt Toolkit. @@ -49,7 +49,7 @@ #define PROGRAMNAME "qdbusxml2cpp" #define PROGRAMVERSION "0.8" -#define PROGRAMCOPYRIGHT "Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies)." +#define PROGRAMCOPYRIGHT "Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies)." #define ANNOTATION_NO_WAIT "org.freedesktop.DBus.Method.NoReply" diff --git a/src/tools/qdoc/doc/qdoc-manual-markupcmds.qdoc b/src/tools/qdoc/doc/qdoc-manual-markupcmds.qdoc index c04cdeca2b..7825fc3a91 100644 --- a/src/tools/qdoc/doc/qdoc-manual-markupcmds.qdoc +++ b/src/tools/qdoc/doc/qdoc-manual-markupcmds.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the documentation of the Qt Toolkit. @@ -3789,7 +3789,7 @@ Qt Development Frameworks Qt Project - + Qt Project diff --git a/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc b/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc index 093f9cc2c6..cf1f7b2426 100644 --- a/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc +++ b/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the documentation of the Qt Toolkit. @@ -1576,7 +1576,7 @@ dita.metadata.default.author = Qt Development Frameworks dita.metadata.default.permissions = all dita.metadata.default.publisher = Qt Project - dita.metadata.default.copyryear = 2014 + dita.metadata.default.copyryear = 2015 dita.metadata.default.copyrholder = Qt Project dita.metadata.default.audience = programmer \endcode diff --git a/src/tools/qlalr/cppgenerator.cpp b/src/tools/qlalr/cppgenerator.cpp index 05c3c94cc9..6ffe322217 100644 --- a/src/tools/qlalr/cppgenerator.cpp +++ b/src/tools/qlalr/cppgenerator.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QLALR module of the Qt Toolkit. @@ -47,7 +47,7 @@ QString CppGenerator::copyrightHeader() const return QLatin1String( "/****************************************************************************\n" "**\n" - "** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).\n" + "** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).\n" "** Contact: http://www.qt-project.org/legal\n" "**\n" "** This file is part of the Qt Toolkit.\n" diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index effcef2bc9..391c1d4fb9 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtWidgets module of the Qt Toolkit. @@ -1906,7 +1906,7 @@ void QMessageBox::aboutQt(QWidget *parent, const QString &title) "

Qt and the Qt logo are trademarks of Digia Plc and/or its subsidiary(-ies).

" "

Qt is a Digia product developed as an open source project. See %3 " "for more information.

" - ).arg(QStringLiteral("2014"), + ).arg(QStringLiteral("2015"), QStringLiteral("qt.io/licensing"), QStringLiteral("qt.io")); QMessageBox *msgBox = new QMessageBox(parent); -- cgit v1.2.3 From 0fa092cbae1593ca73577ecf9ec71283ae3f2498 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 8 Jan 2015 15:43:29 +0100 Subject: Windows: Add GPU detection. Compile qwindowsopengltester on all platforms and add struct GpuDescription with detection method based on IDirect3D9 (dynamically loaded). Expose as a QVariantMap-property to QWindowsNativeInterface to be able to access it from qtdiag. Task-number: QTBUG-43263 Change-Id: I3c6cd0bbbe36465e0e05f7064ecfc943d6ea4101 Reviewed-by: Laszlo Agocs --- .../platforms/windows/qwindowsnativeinterface.cpp | 8 +- .../platforms/windows/qwindowsnativeinterface.h | 5 +- .../platforms/windows/qwindowsopengltester.cpp | 142 ++++++++++++++++++++- .../platforms/windows/qwindowsopengltester.h | 58 ++++++++- src/plugins/platforms/windows/windows.pri | 11 +- 5 files changed, 213 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp index 002f4ae92c..12ecc53f92 100644 --- a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp +++ b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. @@ -35,6 +35,7 @@ #include "qwindowswindow.h" #include "qwindowscontext.h" #include "qwindowsopenglcontext.h" +#include "qwindowsopengltester.h" #include "qwindowsintegration.h" #include "qwindowsmime.h" @@ -216,4 +217,9 @@ int QWindowsNativeInterface::registerMimeType(const QString &mimeType) return QWindowsMime::registerMimeType(mimeType); } +QVariant QWindowsNativeInterface::gpu() const +{ + return GpuDescription::detect().toVariant(); +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsnativeinterface.h b/src/plugins/platforms/windows/qwindowsnativeinterface.h index 3d47dbe721..349ed28b1d 100644 --- a/src/plugins/platforms/windows/qwindowsnativeinterface.h +++ b/src/plugins/platforms/windows/qwindowsnativeinterface.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. @@ -58,6 +58,7 @@ class QWindowsNativeInterface : public QPlatformNativeInterface { Q_OBJECT Q_PROPERTY(bool asyncExpose READ asyncExpose WRITE setAsyncExpose) + Q_PROPERTY(QVariant gpu READ gpu STORED false) public: void *nativeResourceForIntegration(const QByteArray &resource) Q_DECL_OVERRIDE; @@ -81,6 +82,8 @@ public: bool asyncExpose() const; void setAsyncExpose(bool value); + QVariant gpu() const; + QVariantMap windowProperties(QPlatformWindow *window) const Q_DECL_OVERRIDE; QVariant windowProperty(QPlatformWindow *window, const QString &name) const Q_DECL_OVERRIDE; QVariant windowProperty(QPlatformWindow *window, const QString &name, const QVariant &defaultValue) const Q_DECL_OVERRIDE; diff --git a/src/plugins/platforms/windows/qwindowsopengltester.cpp b/src/plugins/platforms/windows/qwindowsopengltester.cpp index ba3a95ce7a..5ef3dc0855 100644 --- a/src/plugins/platforms/windows/qwindowsopengltester.cpp +++ b/src/plugins/platforms/windows/qwindowsopengltester.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. @@ -32,13 +32,148 @@ ****************************************************************************/ #include "qwindowsopengltester.h" -#include "qt_windows.h" #include "qwindowscontext.h" +#include +#include +#include + +#ifndef Q_OS_WINCE +# include +# include +# include +#endif + QT_BEGIN_NAMESPACE +QString GpuDriverVersion::toString() const +{ + return QString::number(product) + + QLatin1Char('.') + QString::number(version) + + QLatin1Char('.') + QString::number(subVersion) + + QLatin1Char('.') + QString::number(build); +} + +int GpuDriverVersion::compare(const GpuDriverVersion &rhs) const +{ + if (product < rhs.product) + return -1; + if (product > rhs.product) + return 1; + if (version < rhs.version) + return -1; + if (version > rhs.version) + return 1; + if (subVersion < rhs.subVersion) + return -1; + if (subVersion > rhs.subVersion) + return 1; + if (build < rhs.build) + return -1; + if (build > rhs.build) + return 1; + return 0; +} + +GpuDescription GpuDescription::detect() +{ +#ifndef Q_OS_WINCE + typedef IDirect3D9 * (WINAPI *PtrDirect3DCreate9)(UINT); + + GpuDescription result; + QSystemLibrary d3d9lib(QStringLiteral("d3d9")); + if (!d3d9lib.load()) + return result; + PtrDirect3DCreate9 direct3DCreate9 = (PtrDirect3DCreate9)d3d9lib.resolve("Direct3DCreate9"); + if (!direct3DCreate9) + return result; + IDirect3D9 *direct3D9 = direct3DCreate9(D3D_SDK_VERSION); + if (!direct3D9) + return result; + D3DADAPTER_IDENTIFIER9 adapterIdentifier; + const HRESULT hr = direct3D9->GetAdapterIdentifier(0, 0, &adapterIdentifier); + direct3D9->Release(); + if (SUCCEEDED(hr)) { + result.vendorId = int(adapterIdentifier.VendorId); + result.deviceId = int(adapterIdentifier.DeviceId); + result.revision = int(adapterIdentifier.Revision); + result.subSysId = int(adapterIdentifier.SubSysId); + result.driverVersion.product = HIWORD(adapterIdentifier.DriverVersion.HighPart); + result.driverVersion.version = LOWORD(adapterIdentifier.DriverVersion.HighPart); + result.driverVersion.subVersion = HIWORD(adapterIdentifier.DriverVersion.LowPart); + result.driverVersion.build = LOWORD(adapterIdentifier.DriverVersion.LowPart); + result.driverName = adapterIdentifier.Driver; + result.description = adapterIdentifier.Description; + } + return result; +#else // !Q_OS_WINCE + GpuDescription result; + result.vendorId = result.deviceId = result.revision + = result.driverVersion.product = result.driverVersion.version + = result.driverVersion.build = 1; + result.driverName = result.description = QByteArrayLiteral("Generic"); + return result; +#endif +} + +QDebug operator<<(QDebug d, const GpuDriverVersion &v) +{ + QDebugStateSaver s(d); + d.nospace(); + d << v.product << '.' << v.version << '.' << v.subVersion << '.' << v.build; + return d; +} + +QDebug operator<<(QDebug d, const GpuDescription &gd) +{ + QDebugStateSaver s(d); + d.nospace(); + d << hex << showbase << "GpuDescription(vendorId=" << gd.vendorId + << ", deviceId=" << gd.deviceId << ", subSysId=" << gd.subSysId + << dec << noshowbase << ", revision=" << gd.revision + << ", driver: " << gd.driverName + << ", version=" << gd.driverVersion << ", " << gd.description << ')'; + return d; +} + +// Return printable string formatted like the output of the dxdiag tool. +QString GpuDescription::toString() const +{ + QString result; + QTextStream str(&result); + str << " Card name: " << description + << "\n Driver Name: " << driverName + << "\n Driver Version: " << driverVersion.toString() + << "\n Vendor ID: 0x" << qSetPadChar(QLatin1Char('0')) + << uppercasedigits << hex << qSetFieldWidth(4) << vendorId + << "\n Device ID: 0x" << qSetFieldWidth(4) << deviceId + << "\n SubSys ID: 0x" << qSetFieldWidth(8) << subSysId + << "\n Revision ID: 0x" << qSetFieldWidth(4) << revision + << dec; + return result; +} + +QVariant GpuDescription::toVariant() const +{ + QVariantMap result; + result.insert(QStringLiteral("vendorId"), QVariant(vendorId)); + result.insert(QStringLiteral("deviceId"), QVariant(deviceId)); + result.insert(QStringLiteral("subSysId"),QVariant(subSysId)); + result.insert(QStringLiteral("revision"), QVariant(revision)); + result.insert(QStringLiteral("driver"), QVariant(QLatin1String(driverName))); + result.insert(QStringLiteral("driverProduct"), QVariant(driverVersion.product)); + result.insert(QStringLiteral("driverVersion"), QVariant(driverVersion.version)); + result.insert(QStringLiteral("driverSubVersion"), QVariant(driverVersion.subVersion)); + result.insert(QStringLiteral("driverBuild"), QVariant(driverVersion.build)); + result.insert(QStringLiteral("driverVersionString"), driverVersion.toString()); + result.insert(QStringLiteral("description"), QVariant(QLatin1String(description))); + result.insert(QStringLiteral("printable"), QVariant(toString())); + return result; +} + bool QWindowsOpenGLTester::testDesktopGL() { +#ifndef Q_OS_WINCE HMODULE lib = 0; HWND wnd = 0; HDC dc = 0; @@ -133,6 +268,9 @@ cleanup: // No FreeLibrary. Some implementations, Mesa in particular, deadlock when trying to unload. return result; +#else // !Q_OS_WINCE + return false; +#endif } QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsopengltester.h b/src/plugins/platforms/windows/qwindowsopengltester.h index 40a8e9d3ac..98b707dcd2 100644 --- a/src/plugins/platforms/windows/qwindowsopengltester.h +++ b/src/plugins/platforms/windows/qwindowsopengltester.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. @@ -31,10 +31,64 @@ ** ****************************************************************************/ +#ifndef QWINDOWSOPENGLTESTER_H +#define QWINDOWSOPENGLTESTER_H + #include +#include + QT_BEGIN_NAMESPACE +class QDebug; +class QVariant; + +struct GpuDriverVersion // ### fixme: Use QVersionNumber in Qt 5.5? +{ + GpuDriverVersion(int p = 0, int v = 0, int sv =0, int b = 0) : product(p), version(v), subVersion(sv), build(b) {} + QString toString() const; + int compare(const GpuDriverVersion &rhs) const; + + int product; + int version; + int subVersion; + int build; +}; + +inline bool operator==(const GpuDriverVersion &v1, const GpuDriverVersion &v2) + { return !v1.compare(v2); } +inline bool operator!=(const GpuDriverVersion &v1, const GpuDriverVersion &v2) + { return v1.compare(v2); } +inline bool operator< (const GpuDriverVersion &v1, const GpuDriverVersion &v2) + { return v1.compare(v2) < 0; } +inline bool operator<=(const GpuDriverVersion &v1, const GpuDriverVersion &v2) + { return v1.compare(v2) <= 0; } +inline bool operator> (const GpuDriverVersion &v1, const GpuDriverVersion &v2) + { return v1.compare(v2) > 0; } +inline bool operator>=(const GpuDriverVersion &v1, const GpuDriverVersion &v2) + { return v1.compare(v2) >= 0; } + +QDebug operator<<(QDebug d, const GpuDriverVersion &gd); + +struct GpuDescription +{ + GpuDescription() : vendorId(0), deviceId(0), revision(0), subSysId(0) {} + + static GpuDescription detect(); + QString toString() const; + QVariant toVariant() const; + + int vendorId; + int deviceId; + int revision; + int subSysId; + GpuDriverVersion driverVersion; + QByteArray driverName; + QByteArray description; +}; + +QDebug operator<<(QDebug d, const GpuDescription &gd); + class QWindowsOpenGLTester { public: @@ -42,3 +96,5 @@ public: }; QT_END_NAMESPACE + +#endif // QWINDOWSOPENGLTESTER_H diff --git a/src/plugins/platforms/windows/windows.pri b/src/plugins/platforms/windows/windows.pri index 8e5f35d293..246598677f 100644 --- a/src/plugins/platforms/windows/windows.pri +++ b/src/plugins/platforms/windows/windows.pri @@ -40,7 +40,8 @@ SOURCES += \ $$PWD/qwindowsservices.cpp \ $$PWD/qwindowsnativeimage.cpp \ $$PWD/qwindowsnativeinterface.cpp \ - $$PWD/qwindowsscaling.cpp + $$PWD/qwindowsscaling.cpp \ + $$PWD/qwindowsopengltester.cpp HEADERS += \ $$PWD/qwindowswindow.h \ @@ -66,9 +67,8 @@ HEADERS += \ $$PWD/qplatformfunctions_wince.h \ $$PWD/qwindowsnativeimage.h \ $$PWD/qwindowsnativeinterface.h \ - $$PWD/qwindowsscaling.h - -!wince: HEADERS += $$PWD/qwindowsopengltester.h + $$PWD/qwindowsscaling.h \ + $$PWD/qwindowsopengltester.h INCLUDEPATH += $$PWD @@ -84,8 +84,7 @@ contains(QT_CONFIG, opengles2) { # Dynamic GL needs both WGL and EGL contains(QT_CONFIG,dynamicgl) { - SOURCES += $$PWD/qwindowseglcontext.cpp \ - $$PWD/qwindowsopengltester.cpp + SOURCES += $$PWD/qwindowseglcontext.cpp HEADERS += $$PWD/qwindowseglcontext.h } -- cgit v1.2.3 From 97a82f62c46c272fe3ef1cd9d5c2214b6a7626af Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 12 Jan 2015 15:59:36 +0100 Subject: Windows: Add infrastructure to be able to a GL renderer based on GPU. Introduce flags for the renderer type and move code to qwindowsopengltester. Introduce QWindowsOpenGLTester::supportedGlesRenderers() where type-dependent checking can be added. Change-Id: I4bbffaf861cb0fdbea0919e081e3626fb5a872de Task-number: QTBUG-43263 Reviewed-by: Laszlo Agocs --- .../platforms/windows/qwindowseglcontext.cpp | 19 +++-- src/plugins/platforms/windows/qwindowseglcontext.h | 3 +- .../platforms/windows/qwindowsintegration.cpp | 76 ++++++++++++-------- .../platforms/windows/qwindowsopenglcontext.h | 3 + .../platforms/windows/qwindowsopengltester.cpp | 82 ++++++++++++++++++++++ .../platforms/windows/qwindowsopengltester.h | 21 ++++++ 6 files changed, 162 insertions(+), 42 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowseglcontext.cpp b/src/plugins/platforms/windows/qwindowseglcontext.cpp index c0d0c1f77c..bde0503ee0 100644 --- a/src/plugins/platforms/windows/qwindowseglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowseglcontext.cpp @@ -340,7 +340,7 @@ QWindowsEGLStaticContext::QWindowsEGLStaticContext(EGLDisplay display, int versi { } -QWindowsEGLStaticContext *QWindowsEGLStaticContext::create() +QWindowsEGLStaticContext *QWindowsEGLStaticContext::create(QWindowsOpenGLTester::Renderers preferredType) { const HDC dc = QWindowsContext::instance()->displayContext(); if (!dc){ @@ -359,27 +359,26 @@ QWindowsEGLStaticContext *QWindowsEGLStaticContext::create() EGLDisplay display = EGL_NO_DISPLAY; #ifdef EGL_ANGLE_platform_angle_opengl - if (libEGL.eglGetPlatformDisplayEXT && qEnvironmentVariableIsSet("QT_ANGLE_PLATFORM")) { + if (libEGL.eglGetPlatformDisplayEXT + && (preferredType & QWindowsOpenGLTester::AngleBackendMask)) { const EGLint anglePlatformAttributes[][5] = { { EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, EGL_NONE }, { EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE, EGL_NONE }, { EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, EGL_PLATFORM_ANGLE_USE_WARP_ANGLE, EGL_TRUE, EGL_NONE } }; const EGLint *attributes = 0; - const QByteArray anglePlatform = qgetenv("QT_ANGLE_PLATFORM"); - if (anglePlatform == "d3d11") + if (preferredType & QWindowsOpenGLTester::AngleRendererD3d11) attributes = anglePlatformAttributes[0]; - else if (anglePlatform == "d3d9") + else if (preferredType & QWindowsOpenGLTester::AngleRendererD3d9) attributes = anglePlatformAttributes[1]; - else if (anglePlatform == "warp") + else if (preferredType & QWindowsOpenGLTester::AngleRendererD3d11Warp) attributes = anglePlatformAttributes[2]; - else - qCWarning(lcQpaGl) << "Invalid value set for QT_ANGLE_PLATFORM:" << anglePlatform; - if (attributes) display = libEGL.eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, dc, attributes); } -#endif // EGL_ANGLE_platform_angle_opengl +#else // EGL_ANGLE_platform_angle_opengl + Q_UNUSED(preferredType) +#endif if (display == EGL_NO_DISPLAY) display = libEGL.eglGetDisplay((EGLNativeDisplayType)dc); if (!display) { diff --git a/src/plugins/platforms/windows/qwindowseglcontext.h b/src/plugins/platforms/windows/qwindowseglcontext.h index 63a7c25a6f..45ccbfb734 100644 --- a/src/plugins/platforms/windows/qwindowseglcontext.h +++ b/src/plugins/platforms/windows/qwindowseglcontext.h @@ -35,6 +35,7 @@ #define QWINDOWSEGLCONTEXT_H #include "qwindowsopenglcontext.h" +#include "qwindowsopengltester.h" #include QT_BEGIN_NAMESPACE @@ -249,7 +250,7 @@ class QWindowsEGLStaticContext : public QWindowsStaticOpenGLContext Q_DISABLE_COPY(QWindowsEGLStaticContext) public: - static QWindowsEGLStaticContext *create(); + static QWindowsEGLStaticContext *create(QWindowsOpenGLTester::Renderers preferredType); ~QWindowsEGLStaticContext(); EGLDisplay display() const { return m_display; } diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 54fb138d85..82686f38ad 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -328,47 +328,61 @@ QPlatformWindow *QWindowsIntegration::createPlatformWindow(QWindow *window) cons } #ifndef QT_NO_OPENGL -static QWindowsStaticOpenGLContext *q_staticOpenGLContext = 0; -QWindowsStaticOpenGLContext *QWindowsStaticOpenGLContext::create() +QWindowsStaticOpenGLContext *QWindowsStaticOpenGLContext::doCreate() { - QWindowsStaticOpenGLContext *ctx = 0; - #if defined(QT_OPENGL_DYNAMIC) - const QByteArray requested = qgetenv("QT_OPENGL"); // angle, desktop, software - const bool angleRequested = QCoreApplication::testAttribute(Qt::AA_UseOpenGLES) || requested == "angle"; - const bool desktopRequested = QCoreApplication::testAttribute(Qt::AA_UseDesktopOpenGL) || requested == "desktop"; - const bool softwareRequested = QCoreApplication::testAttribute(Qt::AA_UseSoftwareOpenGL) || requested == "software"; - + QWindowsOpenGLTester::Renderer requestedRenderer = QWindowsOpenGLTester::requestedRenderer(); + switch (requestedRenderer) { + case QWindowsOpenGLTester::DesktopGl: + if (QWindowsStaticOpenGLContext *glCtx = QOpenGLStaticContext::create()) + return glCtx; + qCWarning(lcQpaGl, "System OpenGL failed. Falling back to Software OpenGL."); + return QOpenGLStaticContext::create(true); // If ANGLE is requested, use it, don't try anything else. - if (angleRequested) { - ctx = QWindowsEGLStaticContext::create(); - } else { - // If opengl32.dll seems to be OpenGL 2.x capable, or desktop OpenGL is requested, use it. - if (!softwareRequested && (desktopRequested || QWindowsOpenGLTester::testDesktopGL())) - ctx = QOpenGLStaticContext::create(); - // If failed and desktop OpenGL is not explicitly requested, try ANGLE. - if (!ctx && !desktopRequested && !softwareRequested) - ctx = QWindowsEGLStaticContext::create(); - // Try software. - if (!ctx) { - ctx = QOpenGLStaticContext::create(true); - // If software was explicitly requested but failed, try the regular one. - if (!ctx && softwareRequested && QWindowsOpenGLTester::testDesktopGL()) { - qCWarning(lcQpaGl, "Software OpenGL failed. Falling back to system OpenGL."); - ctx = QOpenGLStaticContext::create(); - } - } + case QWindowsOpenGLTester::AngleRendererD3d9: + case QWindowsOpenGLTester::AngleRendererD3d11: + case QWindowsOpenGLTester::AngleRendererD3d11Warp: + return QWindowsEGLStaticContext::create(requestedRenderer); + case QWindowsOpenGLTester::Gles: + return QWindowsEGLStaticContext::create(QWindowsOpenGLTester::supportedGlesRenderers()); + case QWindowsOpenGLTester::SoftwareRasterizer: + if (QWindowsStaticOpenGLContext *swCtx = QOpenGLStaticContext::create(true)) + return swCtx; + qCWarning(lcQpaGl, "Software OpenGL failed. Falling back to system OpenGL."); + if (QWindowsOpenGLTester::supportedRenderers() & QWindowsOpenGLTester::DesktopGl) + return QOpenGLStaticContext::create(); + return Q_NULLPTR; + default: + break; } + + const QWindowsOpenGLTester::Renderers supportedRenderers = QWindowsOpenGLTester::supportedRenderers(); + if (supportedRenderers & QWindowsOpenGLTester::DesktopGl) { + if (QWindowsStaticOpenGLContext *glCtx = QOpenGLStaticContext::create()) + return glCtx; + } + if (QWindowsOpenGLTester::Renderers glesRenderers = supportedRenderers & QWindowsOpenGLTester::GlesMask) { + if (QWindowsEGLStaticContext *eglCtx = QWindowsEGLStaticContext::create(glesRenderers)) + return eglCtx; + } + return QOpenGLStaticContext::create(true); #elif defined(QT_OPENGL_ES_2) - ctx = QWindowsEGLStaticContext::create(); + QWindowsOpenGLTester::Renderers glesRenderers = QWindowsOpenGLTester::requestedGlesRenderer(); + if (glesRenderers == QWindowsOpenGLTester::InvalidRenderer) + glesRenderers = QWindowsOpenGLTester::supportedGlesRenderers(); + return QWindowsEGLStaticContext::create(glesRenderers); #elif !defined(QT_NO_OPENGL) - ctx = QOpenGLStaticContext::create(); + return QOpenGLStaticContext::create(); #endif +} - q_staticOpenGLContext = ctx; +static QWindowsStaticOpenGLContext *q_staticOpenGLContext = 0; - return ctx; +QWindowsStaticOpenGLContext *QWindowsStaticOpenGLContext::create() +{ + q_staticOpenGLContext = QWindowsStaticOpenGLContext::doCreate(); + return q_staticOpenGLContext; } bool QWindowsIntegrationPrivate::ensureStaticOpenGLContext() diff --git a/src/plugins/platforms/windows/qwindowsopenglcontext.h b/src/plugins/platforms/windows/qwindowsopenglcontext.h index 2f724f3dd7..550bf00a40 100644 --- a/src/plugins/platforms/windows/qwindowsopenglcontext.h +++ b/src/plugins/platforms/windows/qwindowsopenglcontext.h @@ -58,6 +58,9 @@ public: // reimplement these. virtual void *createWindowSurface(void * /*nativeWindow*/, void * /*nativeConfig*/) { return 0; } virtual void destroyWindowSurface(void * /*nativeSurface*/) { } + +private: + static QWindowsStaticOpenGLContext *doCreate(); }; class QWindowsOpenGLContext : public QPlatformOpenGLContext diff --git a/src/plugins/platforms/windows/qwindowsopengltester.cpp b/src/plugins/platforms/windows/qwindowsopengltester.cpp index 5ef3dc0855..ac886b6bee 100644 --- a/src/plugins/platforms/windows/qwindowsopengltester.cpp +++ b/src/plugins/platforms/windows/qwindowsopengltester.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #ifndef Q_OS_WINCE # include @@ -171,6 +172,87 @@ QVariant GpuDescription::toVariant() const return result; } +QWindowsOpenGLTester::Renderer QWindowsOpenGLTester::requestedGlesRenderer() +{ +#ifndef Q_OS_WINCE + const char platformVar[] = "QT_ANGLE_PLATFORM"; + if (qEnvironmentVariableIsSet(platformVar)) { + const QByteArray anglePlatform = qgetenv(platformVar); + if (anglePlatform == "d3d11") + return QWindowsOpenGLTester::AngleRendererD3d11; + if (anglePlatform == "d3d9") + return QWindowsOpenGLTester::AngleRendererD3d9; + if (anglePlatform == "warp") + return QWindowsOpenGLTester::AngleRendererD3d11Warp; + qCWarning(lcQpaGl) << "Invalid value set for " << platformVar << ": " << anglePlatform; + } +#endif // !Q_OS_WINCE + return QWindowsOpenGLTester::InvalidRenderer; +} + +QWindowsOpenGLTester::Renderer QWindowsOpenGLTester::requestedRenderer() +{ +#ifndef Q_OS_WINCE + const char openGlVar[] = "QT_OPENGL"; + if (QCoreApplication::testAttribute(Qt::AA_UseOpenGLES)) { + const Renderer glesRenderer = QWindowsOpenGLTester::requestedGlesRenderer(); + return glesRenderer != InvalidRenderer ? glesRenderer : Gles; + } + if (QCoreApplication::testAttribute(Qt::AA_UseDesktopOpenGL)) + return QWindowsOpenGLTester::DesktopGl; + if (QCoreApplication::testAttribute(Qt::AA_UseSoftwareOpenGL)) + return QWindowsOpenGLTester::SoftwareRasterizer; + if (qEnvironmentVariableIsSet(openGlVar)) { + const QByteArray requested = qgetenv(openGlVar); + if (requested == "angle") { + const Renderer glesRenderer = QWindowsOpenGLTester::requestedGlesRenderer(); + return glesRenderer != InvalidRenderer ? glesRenderer : Gles; + } + if (requested == "desktop") + return QWindowsOpenGLTester::DesktopGl; + if (requested == "software") + return QWindowsOpenGLTester::SoftwareRasterizer; + qCWarning(lcQpaGl) << "Invalid value set for " << openGlVar << ": " << requested; + } +#endif // !Q_OS_WINCE + return QWindowsOpenGLTester::InvalidRenderer; +} + +static inline QWindowsOpenGLTester::Renderers + detectSupportedRenderers(const GpuDescription &gpu, bool glesOnly) +{ + Q_UNUSED(gpu) +#ifndef Q_OS_WINCE + // Add checks for card types with known issues here. + QWindowsOpenGLTester::Renderers result(QWindowsOpenGLTester::AngleRendererD3d11 + | QWindowsOpenGLTester::AngleRendererD3d9 + | QWindowsOpenGLTester::AngleRendererD3d11Warp + | QWindowsOpenGLTester::SoftwareRasterizer); + + if (!glesOnly && QWindowsOpenGLTester::testDesktopGL()) + result |= QWindowsOpenGLTester::DesktopGl; + return result; +#else // !Q_OS_WINCE + return QWindowsOpenGLTester::Gles; +#endif +} + +QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::supportedGlesRenderers() +{ + const GpuDescription gpu = GpuDescription::detect(); + const QWindowsOpenGLTester::Renderers result = detectSupportedRenderers(gpu, true); + qDebug(lcQpaGl) << __FUNCTION__ << gpu << "renderer: " << result; + return result; +} + +QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::supportedRenderers() +{ + const GpuDescription gpu = GpuDescription::detect(); + const QWindowsOpenGLTester::Renderers result = detectSupportedRenderers(gpu, false); + qDebug(lcQpaGl) << __FUNCTION__ << gpu << "renderer: " << result; + return result; +} + bool QWindowsOpenGLTester::testDesktopGL() { #ifndef Q_OS_WINCE diff --git a/src/plugins/platforms/windows/qwindowsopengltester.h b/src/plugins/platforms/windows/qwindowsopengltester.h index 98b707dcd2..6238eea4b0 100644 --- a/src/plugins/platforms/windows/qwindowsopengltester.h +++ b/src/plugins/platforms/windows/qwindowsopengltester.h @@ -37,6 +37,7 @@ #include #include +#include QT_BEGIN_NAMESPACE @@ -92,9 +93,29 @@ QDebug operator<<(QDebug d, const GpuDescription &gd); class QWindowsOpenGLTester { public: + enum Renderer { + InvalidRenderer = 0x0000, + DesktopGl = 0x0001, + AngleRendererD3d11 = 0x0002, + AngleRendererD3d9 = 0x0004, + AngleRendererD3d11Warp = 0x0008, // "Windows Advanced Rasterization Platform" + AngleBackendMask = AngleRendererD3d11 | AngleRendererD3d9 | AngleRendererD3d11Warp, + Gles = 0x0010, // ANGLE/unspecified or Generic GLES for Windows CE. + GlesMask = Gles | AngleBackendMask, + SoftwareRasterizer = 0x0020 + }; + Q_DECLARE_FLAGS(Renderers, Renderer) + + static Renderer requestedGlesRenderer(); + static Renderer requestedRenderer(); + static Renderers supportedGlesRenderers(); + static Renderers supportedRenderers(); + static bool testDesktopGL(); }; +Q_DECLARE_OPERATORS_FOR_FLAGS(QWindowsOpenGLTester::Renderers) + QT_END_NAMESPACE #endif // QWINDOWSOPENGLTESTER_H -- cgit v1.2.3 From 9b35c2cc27741e335a231afd7bc7842602ddc8a2 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 14 Jan 2015 12:29:24 +0100 Subject: Windows: Fix crash when focus window does not have a native window. Check and warn in that case. Change-Id: Ic513334b5aa48e1c7e44685c30da3e9be52c3c52 Task-number: QTBUG-43833 Reviewed-by: Laszlo Agocs --- src/plugins/platforms/windows/qwindowsinputcontext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowsinputcontext.cpp b/src/plugins/platforms/windows/qwindowsinputcontext.cpp index 94a27d146f..ad63a57d3e 100644 --- a/src/plugins/platforms/windows/qwindowsinputcontext.cpp +++ b/src/plugins/platforms/windows/qwindowsinputcontext.cpp @@ -209,7 +209,7 @@ void QWindowsInputContext::setFocusObject(QObject *object) imeNotifyCancelComposition(m_compositionContext.hwnd); const QWindow *window = QGuiApplication::focusWindow(); - if (object && window) { + if (object && window && window->handle()) { QWindowsWindow *platformWindow = QWindowsWindow::baseWindowOf(window); if (inputMethodAccepted()) { // Re-enable IME by associating default context saved on first disabling. -- cgit v1.2.3 From 5856f6e3057a881747d77e87f8934dd67860bed6 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 13 Jan 2015 12:49:40 +0100 Subject: Fix regression with frameless dialogs on Windows Task-number: QTBUG-41162 Change-Id: I6d4e6d0e8a262fead30d642d632f6b4021cc20ab Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowswindow.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 6279b6f4af..b8ad744d05 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -514,8 +514,12 @@ void WindowCreationData::fromWindow(const QWindow *w, const Qt::WindowFlags flag if (flags & Qt::WindowSystemMenuHint) style |= WS_SYSMENU; else if (dialog) { - style |= WS_SYSMENU | WS_BORDER; // QTBUG-2027, dialogs without system menu. - exStyle |= WS_EX_DLGMODALFRAME; + // QTBUG-2027, dialogs without system menu. + style |= WS_SYSMENU; + if (!(flags & Qt::FramelessWindowHint)) { + style |= WS_BORDER; + exStyle |= WS_EX_DLGMODALFRAME; + } } if (flags & Qt::WindowMinimizeButtonHint) style |= WS_MINIMIZEBOX; -- cgit v1.2.3 From 6839aead0430a9b07b60fa3a1a7d685fe5d2d1ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Klitzing?= Date: Fri, 9 Jan 2015 11:53:17 +0100 Subject: Fix compile error if openssl is built with no-ssl3-method Since openssl 1.0.1k with enabled option no-ssl3-method we need to check for OPENSSL_NO_SSL3_METHOD to use following functions: - SSLv3_method - SSLv3_server_method - SSLv3_client_method Change-Id: Iee83a6f4bacbf5660baa6bdb89eb02ceb9f11614 Reviewed-by: Thiago Macieira --- src/network/ssl/qsslcontext_openssl.cpp | 6 ++++++ src/network/ssl/qsslsocket_openssl_symbols.cpp | 12 ++++++++++++ 2 files changed, 18 insertions(+) (limited to 'src') diff --git a/src/network/ssl/qsslcontext_openssl.cpp b/src/network/ssl/qsslcontext_openssl.cpp index 92e726bc01..18eef2fc60 100644 --- a/src/network/ssl/qsslcontext_openssl.cpp +++ b/src/network/ssl/qsslcontext_openssl.cpp @@ -138,7 +138,13 @@ init_context: #endif break; case QSsl::SslV3: +#ifndef OPENSSL_NO_SSL3_METHOD sslContext->ctx = q_SSL_CTX_new(client ? q_SSLv3_client_method() : q_SSLv3_server_method()); +#else + // SSL 3 not supported by the system, but chosen deliberately -> error + sslContext->ctx = 0; + unsupportedProtocol = true; +#endif break; case QSsl::SecureProtocols: // SSLv2 and SSLv3 will be disabled by SSL options diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index ea6e84adef..c1fea930d0 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -270,7 +270,9 @@ DEFINEFUNC(SSL_SESSION*, SSL_get_session, const SSL *ssl, ssl, return 0, return) #ifndef OPENSSL_NO_SSL2 DEFINEFUNC(const SSL_METHOD *, SSLv2_client_method, DUMMYARG, DUMMYARG, return 0, return) #endif +#ifndef OPENSSL_NO_SSL3_METHOD DEFINEFUNC(const SSL_METHOD *, SSLv3_client_method, DUMMYARG, DUMMYARG, return 0, return) +#endif DEFINEFUNC(const SSL_METHOD *, SSLv23_client_method, DUMMYARG, DUMMYARG, return 0, return) DEFINEFUNC(const SSL_METHOD *, TLSv1_client_method, DUMMYARG, DUMMYARG, return 0, return) #if OPENSSL_VERSION_NUMBER >= 0x10001000L @@ -280,7 +282,9 @@ DEFINEFUNC(const SSL_METHOD *, TLSv1_2_client_method, DUMMYARG, DUMMYARG, return #ifndef OPENSSL_NO_SSL2 DEFINEFUNC(const SSL_METHOD *, SSLv2_server_method, DUMMYARG, DUMMYARG, return 0, return) #endif +#ifndef OPENSSL_NO_SSL3_METHOD DEFINEFUNC(const SSL_METHOD *, SSLv3_server_method, DUMMYARG, DUMMYARG, return 0, return) +#endif DEFINEFUNC(const SSL_METHOD *, SSLv23_server_method, DUMMYARG, DUMMYARG, return 0, return) DEFINEFUNC(const SSL_METHOD *, TLSv1_server_method, DUMMYARG, DUMMYARG, return 0, return) #if OPENSSL_VERSION_NUMBER >= 0x10001000L @@ -289,11 +293,15 @@ DEFINEFUNC(const SSL_METHOD *, TLSv1_2_server_method, DUMMYARG, DUMMYARG, return #endif #else DEFINEFUNC(SSL_METHOD *, SSLv2_client_method, DUMMYARG, DUMMYARG, return 0, return) +#ifndef OPENSSL_NO_SSL3_METHOD DEFINEFUNC(SSL_METHOD *, SSLv3_client_method, DUMMYARG, DUMMYARG, return 0, return) +#endif DEFINEFUNC(SSL_METHOD *, SSLv23_client_method, DUMMYARG, DUMMYARG, return 0, return) DEFINEFUNC(SSL_METHOD *, TLSv1_client_method, DUMMYARG, DUMMYARG, return 0, return) DEFINEFUNC(SSL_METHOD *, SSLv2_server_method, DUMMYARG, DUMMYARG, return 0, return) +#ifndef OPENSSL_NO_SSL3_METHOD DEFINEFUNC(SSL_METHOD *, SSLv3_server_method, DUMMYARG, DUMMYARG, return 0, return) +#endif DEFINEFUNC(SSL_METHOD *, SSLv23_server_method, DUMMYARG, DUMMYARG, return 0, return) DEFINEFUNC(SSL_METHOD *, TLSv1_server_method, DUMMYARG, DUMMYARG, return 0, return) #endif @@ -799,7 +807,9 @@ bool q_resolveOpenSslSymbols() #ifndef OPENSSL_NO_SSL2 RESOLVEFUNC(SSLv2_client_method) #endif +#ifndef OPENSSL_NO_SSL3_METHOD RESOLVEFUNC(SSLv3_client_method) +#endif RESOLVEFUNC(SSLv23_client_method) RESOLVEFUNC(TLSv1_client_method) #if OPENSSL_VERSION_NUMBER >= 0x10001000L @@ -809,7 +819,9 @@ bool q_resolveOpenSslSymbols() #ifndef OPENSSL_NO_SSL2 RESOLVEFUNC(SSLv2_server_method) #endif +#ifndef OPENSSL_NO_SSL3_METHOD RESOLVEFUNC(SSLv3_server_method) +#endif RESOLVEFUNC(SSLv23_server_method) RESOLVEFUNC(TLSv1_server_method) #if OPENSSL_VERSION_NUMBER >= 0x10001000L -- cgit v1.2.3 From 5bb2e84a764f611cf4470f2ddc0bb427c4d110cc Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 16 Jan 2015 10:18:00 +0100 Subject: Fall back to ANGLE on OpenGL 1.x Apparently on some cards, that only provide OpenGL 1.4, the check for OpenGL 2 specific functions is not sufficient (presumably some old extensions provide the functions and so the test passes, even though it really shouldn't) To avoid crashing the apps later on, we should check the context version and activate the fall back to ANGLE if it's below 2.0. Task-number: QTBUG-43870 Change-Id: Id0e3d8ad1f632334ba03bbb1a4802413f28436dc Reviewed-by: Friedemann Kleint --- .../platforms/windows/qwindowsopengltester.cpp | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowsopengltester.cpp b/src/plugins/platforms/windows/qwindowsopengltester.cpp index ac886b6bee..f6caf8b06e 100644 --- a/src/plugins/platforms/windows/qwindowsopengltester.cpp +++ b/src/plugins/platforms/windows/qwindowsopengltester.cpp @@ -43,6 +43,7 @@ # include # include # include +# include #endif QT_BEGIN_NAMESPACE @@ -326,6 +327,37 @@ bool QWindowsOpenGLTester::testDesktopGL() goto cleanup; // Now that there is finally a context current, try doing something useful. + + // Check the version. If we got 1.x then it's all hopeless and we can stop right here. + typedef const GLubyte * (APIENTRY * GetString_t)(GLenum name); + GetString_t GetString = reinterpret_cast(::GetProcAddress(lib, "glGetString")); + if (GetString) { + const char *versionStr = (const char *) GetString(GL_VERSION); + if (versionStr) { + const QByteArray version(versionStr); + const int majorDot = version.indexOf('.'); + if (majorDot != -1) { + int minorDot = version.indexOf('.', majorDot + 1); + if (minorDot == -1) + minorDot = version.size(); + const int major = version.mid(0, majorDot).toInt(); + const int minor = version.mid(majorDot + 1, minorDot - majorDot - 1).toInt(); + qCDebug(lcQpaGl, "Basic wglCreateContext gives version %d.%d", major, minor); + // Try to be as lenient as possible. Missing version, bogus values and + // such are all accepted. The driver may still be functional. Only + // check for known-bad cases, like versions "1.4.0 ...". + if (major == 1) { + result = false; + qCDebug(lcQpaGl, "OpenGL version too low"); + } + } + } + } else { + result = false; + qCDebug(lcQpaGl, "OpenGL 1.x entry points not found"); + } + + // Check for a shader-specific function. if (WGL_GetProcAddress("glCreateShader")) { result = true; qCDebug(lcQpaGl, "OpenGL 2.0 entry points available"); -- cgit v1.2.3 From 3c21c4581dbd957d9f660dd52d0298ecef1001cb Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Wed, 7 Jan 2015 13:51:38 +0100 Subject: Fix drag and drop regression Fix regression introduced by e4becdc3d310a0dd1a6d34d0796a52b21dedeb2d Add QPlatformDrag::ownsDragObject() function, QDragManager can use the return value of this function to decide if it should take care of deleting QDrag object or platform plugin will take care of deleting QDrag. XCB platform plugins uses async dnd data delivery mechanism. It allows user to drop something and then continue working with the assurance that the target will get the data regardless of how slow the network connections are, which means that a source window should preserve QDrag data until dnd has finished. Change-Id: I1fbad7380cddec98b756698993dd397409833150 Task-number: QTBUG-43436 Reviewed-by: Friedemann Kleint --- src/gui/kernel/qdnd.cpp | 3 ++- src/gui/kernel/qplatformdrag.cpp | 12 ++++++++++++ src/gui/kernel/qplatformdrag.h | 2 ++ src/plugins/platforms/xcb/qxcbdrag.cpp | 7 +++++++ src/plugins/platforms/xcb/qxcbdrag.h | 12 ++++++------ 5 files changed, 29 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/gui/kernel/qdnd.cpp b/src/gui/kernel/qdnd.cpp index f515fe18df..2a6cc4fc99 100644 --- a/src/gui/kernel/qdnd.cpp +++ b/src/gui/kernel/qdnd.cpp @@ -134,7 +134,8 @@ Qt::DropAction QDragManager::drag(QDrag *o) QGuiApplicationPrivate::instance()->notifyDragStarted(o); const Qt::DropAction result = m_platformDrag->drag(m_object); m_object = 0; - o->deleteLater(); + if (!m_platformDrag->ownsDragObject()) + o->deleteLater(); return result; } diff --git a/src/gui/kernel/qplatformdrag.cpp b/src/gui/kernel/qplatformdrag.cpp index 8a5c7264d1..326f092ead 100644 --- a/src/gui/kernel/qplatformdrag.cpp +++ b/src/gui/kernel/qplatformdrag.cpp @@ -241,6 +241,18 @@ QPixmap QPlatformDrag::defaultPixmap() return *qt_drag_default_pixmap(); } +/*! + \since 5.4 + \brief Returns bool indicating whether QPlatformDrag takes ownership + and therefore responsibility of deleting the QDrag object passed in + from QPlatformDrag::drag. This can be useful on platforms where QDrag + object has to be kept around. + */ +bool QPlatformDrag::ownsDragObject() const +{ + return false; +} + #endif // QT_NO_DRAGANDDROP QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformdrag.h b/src/gui/kernel/qplatformdrag.h index 34ad11e45f..ce7a9aa1f2 100644 --- a/src/gui/kernel/qplatformdrag.h +++ b/src/gui/kernel/qplatformdrag.h @@ -98,6 +98,8 @@ public: static QPixmap defaultPixmap(); + virtual bool ownsDragObject() const; + private: QPlatformDragPrivate *d_ptr; diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp index 7037e102e2..ec0399ed5f 100644 --- a/src/plugins/platforms/xcb/qxcbdrag.cpp +++ b/src/plugins/platforms/xcb/qxcbdrag.cpp @@ -999,6 +999,8 @@ void QXcbDrag::handleFinished(const xcb_client_message_event_t *event) if (at != -1) { Transaction t = transactions.takeAt(at); + if (t.drag) + t.drag->deleteLater(); // QDragManager *manager = QDragManager::self(); // Window target = current_target; @@ -1186,6 +1188,11 @@ bool QXcbDrag::dndEnable(QXcbWindow *w, bool on) } } +bool QXcbDrag::ownsDragObject() const +{ + return true; +} + QXcbDropData::QXcbDropData(QXcbDrag *d) : QXcbMime(), drag(d) diff --git a/src/plugins/platforms/xcb/qxcbdrag.h b/src/plugins/platforms/xcb/qxcbdrag.h index e273492837..63a344a098 100644 --- a/src/plugins/platforms/xcb/qxcbdrag.h +++ b/src/plugins/platforms/xcb/qxcbdrag.h @@ -70,12 +70,11 @@ public: virtual QMimeData *platformDropData(); - - void startDrag(); - void cancel(); - void move(const QMouseEvent *me); - void drop(const QMouseEvent *me); - void endDrag(); + void startDrag() Q_DECL_OVERRIDE; + void cancel() Q_DECL_OVERRIDE; + void move(const QMouseEvent *me) Q_DECL_OVERRIDE; + void drop(const QMouseEvent *me) Q_DECL_OVERRIDE; + void endDrag() Q_DECL_OVERRIDE; void handleEnter(QWindow *window, const xcb_client_message_event_t *event); void handlePosition(QWindow *w, const xcb_client_message_event_t *event); @@ -87,6 +86,7 @@ public: void handleFinished(const xcb_client_message_event_t *event); bool dndEnable(QXcbWindow *win, bool on); + bool ownsDragObject() const Q_DECL_OVERRIDE; void updatePixmap(); xcb_timestamp_t targetTime() { return target_time; } -- cgit v1.2.3 From 128cab4635c3ea42af5d3b9952f7b7e1d89284e7 Mon Sep 17 00:00:00 2001 From: Michael Marley Date: Mon, 12 Jan 2015 21:59:43 -0500 Subject: Set pendingClose to false on init in QSslSocket Fixes an issue where under certain circumstances, QSslSocket could get stuck in a state where it would disconnect immediately after starting encryption. Since it doesn't make any sense for the socket to be initialized to a state where any connection attempt will fail, the pendingClose value should be set to false. Thanks to Martin Sandsmark for his help debugging this issue. Task-number: QTBUG-43793 Change-Id: I7deebacbac588c21439a8e594db4222095cf3f22 Reviewed-by: Richard J. Moore --- src/network/ssl/qsslsocket.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 31c7b3087e..0f7c376e04 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -1982,6 +1982,7 @@ void QSslSocketPrivate::init() connectionEncrypted = false; ignoreAllSslErrors = false; shutdown = false; + pendingClose = false; // we don't want to clear the ignoreErrorsList, so // that it is possible setting it before connecting -- cgit v1.2.3 From 49fd3511f5bcdd61c92894636fcf0b2be23d1264 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Tue, 13 Jan 2015 10:52:39 +0100 Subject: Fix memory leak in Qurl::toCFURL() Release the temp CFString. Change-Id: I8a5b8f18a42a4a9b2c6671f0f5b32a3f0b14238d Task-number: QTBUG-43710 Reviewed-by: Thiago Macieira --- src/corelib/io/qurl_mac.mm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/io/qurl_mac.mm b/src/corelib/io/qurl_mac.mm index c235365ad8..4468bf0f2b 100644 --- a/src/corelib/io/qurl_mac.mm +++ b/src/corelib/io/qurl_mac.mm @@ -54,7 +54,13 @@ QUrl QUrl::fromCFURL(CFURLRef url) CFURLRef QUrl::toCFURL() const { - return CFURLCreateWithString(0, toString(FullyEncoded).toCFString(), 0); + CFURLRef url = 0; + CFStringRef str = toString(FullyEncoded).toCFString(); + if (str) { + url = CFURLCreateWithString(0, str, 0); + CFRelease(str); + } + return url; } QUrl QUrl::fromNSURL(const NSURL *url) -- cgit v1.2.3 From cd389e4584754554282fbcb1cdc1b174d0f211dc Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Wed, 7 Jan 2015 12:50:14 +0100 Subject: Fix possible divide by zero in QMacStyle [ChangeLog][Widgets][QMacStyle] Fixed a possible divide by zero crash. Task-number: QTBUG-43398 Change-Id: I8b5c6fd87d07eb42ad43e8c2405b7cad19372b86 Reviewed-by: Gabriel de Dietrich --- src/widgets/styles/qmacstyle_mac.mm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index c166b1b26e..38c082baf5 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -1675,13 +1675,14 @@ void QMacStylePrivate::getSliderInfo(QStyle::ComplexControl cc, const QStyleOpti else tdi->max = 10 * slider->rect.height(); - if (usePlainKnob || slider->orientation == Qt::Horizontal) { + int range = slider->maximum - slider->minimum; + if (range == 0) { + tdi->value = 0; + } else if (usePlainKnob || slider->orientation == Qt::Horizontal) { int endsCorrection = usePlainKnob ? 25 : 10; - tdi->value = (tdi->max + 2 * endsCorrection) * (slider->sliderPosition - slider->minimum) - / (slider->maximum - slider->minimum) - endsCorrection; + tdi->value = (tdi->max + 2 * endsCorrection) * (slider->sliderPosition - slider->minimum) / range - endsCorrection; } else { - tdi->value = (tdi->max + 30) * (slider->sliderPosition - slider->minimum) - / (slider->maximum - slider->minimum) - 20; + tdi->value = (tdi->max + 30) * (slider->sliderPosition - slider->minimum) / range - 20; } } tdi->attributes = kThemeTrackShowThumb; -- cgit v1.2.3 From 5ee8ed27e05f17dc7911a5917c012d0a4fa5afcb Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Fri, 16 Jan 2015 18:32:41 +0100 Subject: rcc: fix build failure on Windows XP / MinGW 4.9 The code makes usage of _fileno without including the appropriate header, which is stdio.h according to Microsoft: http://msdn.microsoft.com/en-us/library/zs6wbdhx%28v=vs.120%29.aspx Task-number: QTBUG-43900 Change-Id: Ic9d407c66243d64823353a1c7e79cf0825c735db Reviewed-by: Friedemann Kleint Reviewed-by: Kai Koehne --- src/tools/rcc/main.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/tools/rcc/main.cpp b/src/tools/rcc/main.cpp index 3c556d76a8..c2e9b26fb3 100644 --- a/src/tools/rcc/main.cpp +++ b/src/tools/rcc/main.cpp @@ -47,6 +47,7 @@ #ifdef Q_OS_WIN # include # include +# include #endif // Q_OS_WIN QT_BEGIN_NAMESPACE -- cgit v1.2.3 From a8f37e47751d7d29ab63bef55f5849056f826e8b Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 15 Jan 2015 17:04:29 +0100 Subject: Windows: Delay creation of the static OpenGL context. Delay initialization/GL detection until a surface is requested. Remove member variable from window and access static context from QWindowsIntegration only. Task-number: QTBUG-43832 Change-Id: I4b9a324b58af4399df5c314bfb2b952455b1e080 Reviewed-by: Laszlo Agocs --- .../platforms/windows/qwindowsintegration.cpp | 35 ++++++++-------------- src/plugins/platforms/windows/qwindowswindow.cpp | 10 +++++-- src/plugins/platforms/windows/qwindowswindow.h | 3 -- 3 files changed, 20 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 82686f38ad..58d675876b 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -130,7 +130,6 @@ struct QWindowsIntegrationPrivate { explicit QWindowsIntegrationPrivate(const QStringList ¶mList); ~QWindowsIntegrationPrivate(); - bool ensureStaticOpenGLContext(); unsigned m_options; QWindowsContext m_context; @@ -266,7 +265,9 @@ bool QWindowsIntegration::hasCapability(QPlatformIntegration::Capability cap) co case OpenGL: return true; case ThreadedOpenGL: - return d->ensureStaticOpenGLContext() ? d->m_staticOpenGLContext->supportsThreadedOpenGL() : false; + if (const QWindowsStaticOpenGLContext *glContext = QWindowsIntegration::staticOpenGLContext()) + return glContext->supportsThreadedOpenGL(); + return false; #endif // !QT_NO_OPENGL case WindowMasks: return true; @@ -312,11 +313,6 @@ QWindowsWindowData QWindowsIntegration::createWindowData(QWindow *window) const QWindowSystemInterface::handleGeometryChange(window, QWindowsScaling::mapFromNative(obtained.geometry)); } -#ifndef QT_NO_OPENGL - d->ensureStaticOpenGLContext(); - obtained.staticOpenGLContext = d->m_staticOpenGLContext; -#endif // QT_NO_OPENGL - return obtained; } @@ -377,26 +373,16 @@ QWindowsStaticOpenGLContext *QWindowsStaticOpenGLContext::doCreate() #endif } -static QWindowsStaticOpenGLContext *q_staticOpenGLContext = 0; - QWindowsStaticOpenGLContext *QWindowsStaticOpenGLContext::create() { - q_staticOpenGLContext = QWindowsStaticOpenGLContext::doCreate(); - return q_staticOpenGLContext; -} - -bool QWindowsIntegrationPrivate::ensureStaticOpenGLContext() -{ - if (m_staticOpenGLContext.isNull()) - m_staticOpenGLContext = QSharedPointer(QWindowsStaticOpenGLContext::create()); - return !m_staticOpenGLContext.isNull(); + return QWindowsStaticOpenGLContext::doCreate(); } QPlatformOpenGLContext *QWindowsIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const { qCDebug(lcQpaGl) << __FUNCTION__ << context->format(); - if (d->ensureStaticOpenGLContext()) { - QScopedPointer result(d->m_staticOpenGLContext->createContext(context)); + if (QWindowsStaticOpenGLContext *staticOpenGLContext = QWindowsIntegration::staticOpenGLContext()) { + QScopedPointer result(staticOpenGLContext->createContext(context)); if (result->isValid()) return result.take(); } @@ -410,13 +396,18 @@ QOpenGLContext::OpenGLModuleType QWindowsIntegration::openGLModuleType() #elif !defined(QT_OPENGL_DYNAMIC) return QOpenGLContext::LibGL; #else - return d->ensureStaticOpenGLContext() ? d->m_staticOpenGLContext->moduleType() : QOpenGLContext::LibGL; + if (const QWindowsStaticOpenGLContext *staticOpenGLContext = QWindowsIntegration::staticOpenGLContext()) + return staticOpenGLContext->moduleType(); + return QOpenGLContext::LibGL; #endif } QWindowsStaticOpenGLContext *QWindowsIntegration::staticOpenGLContext() { - return q_staticOpenGLContext; + QWindowsIntegrationPrivate *d = QWindowsIntegration::instance()->d.data(); + if (d->m_staticOpenGLContext.isNull()) + d->m_staticOpenGLContext = QSharedPointer(QWindowsStaticOpenGLContext::create()); + return d->m_staticOpenGLContext.data(); } #endif // !QT_NO_OPENGL diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index b8ad744d05..926e7da67e 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -37,6 +37,7 @@ #include "qwindowsdrag.h" #include "qwindowsscreen.h" #include "qwindowsscaling.h" +#include "qwindowsintegration.h" #ifdef QT_NO_CURSOR # include "qwindowscursor.h" #endif @@ -958,7 +959,8 @@ void QWindowsWindow::destroyWindow() setDropSiteEnabled(false); #ifndef QT_NO_OPENGL if (m_surface) { - m_data.staticOpenGLContext->destroyWindowSurface(m_surface); + if (QWindowsStaticOpenGLContext *staticOpenGLContext = QWindowsIntegration::staticOpenGLContext()) + staticOpenGLContext->destroyWindowSurface(m_surface); m_surface = 0; } #endif @@ -2302,8 +2304,10 @@ void *QWindowsWindow::surface(void *nativeConfig) #ifdef QT_NO_OPENGL return 0; #else - if (!m_surface) - m_surface = m_data.staticOpenGLContext->createWindowSurface(m_data.hwnd, nativeConfig); + if (!m_surface) { + if (QWindowsStaticOpenGLContext *staticOpenGLContext = QWindowsIntegration::staticOpenGLContext()) + m_surface = staticOpenGLContext->createWindowSurface(m_data.hwnd, nativeConfig); + } return m_surface; #endif diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h index 9822ebce45..922d00f230 100644 --- a/src/plugins/platforms/windows/qwindowswindow.h +++ b/src/plugins/platforms/windows/qwindowswindow.h @@ -107,9 +107,6 @@ struct QWindowsWindowData QMargins customMargins; // User-defined, additional frame for NCCALCSIZE HWND hwnd; bool embedded; -#ifndef QT_NO_OPENGL - QSharedPointer staticOpenGLContext; -#endif // QT_NO_OPENGL static QWindowsWindowData create(const QWindow *w, const QWindowsWindowData ¶meters, -- cgit v1.2.3 From 2603873e75e4b3eedef2939ada3069da36231c09 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 19 Jan 2015 12:05:10 +0100 Subject: Make harfbuzz-old fallback available at run-time The old harfbuzz code path is included as a fail safe for any possible use case where the Harfbuzz-NG regresses, but because the variable was checked statically, it was not actually possible to build a releasable executable which employed the work-around. Instead we use the regular global static pattern where the variable is queried the first time it's needed. Task-number: QTBUG-43850 Change-Id: I9ade76bf0825bbfefebdbdc4e6ee5571f1a3deec Reviewed-by: Lars Knoll --- src/gui/text/qfontengine.cpp | 13 +++++++++---- src/gui/text/qtextengine.cpp | 8 ++++---- 2 files changed, 13 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index b2a7a8e91f..b360ed5c85 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -77,7 +77,12 @@ static inline bool qtransform_equals_no_translate(const QTransform &a, const QTr // Harfbuzz helper functions #ifdef QT_ENABLE_HARFBUZZ_NG -bool useHarfbuzzNG = qgetenv("QT_HARFBUZZ") != "old"; +Q_GLOBAL_STATIC_WITH_ARGS(bool, useHarfbuzzNG,(qgetenv("QT_HARFBUZZ") != "old")) + +bool qt_useHarfbuzzNG() +{ + return *useHarfbuzzNG(); +} #endif Q_STATIC_ASSERT(sizeof(HB_Glyph) == sizeof(glyph_t)); @@ -282,7 +287,7 @@ void *QFontEngine::harfbuzzFont() const { Q_ASSERT(type() != QFontEngine::Multi); #ifdef QT_ENABLE_HARFBUZZ_NG - if (useHarfbuzzNG) + if (qt_useHarfbuzzNG()) return hb_qt_font_get_for_engine(const_cast(this)); #endif if (!font_) { @@ -318,7 +323,7 @@ void *QFontEngine::harfbuzzFace() const { Q_ASSERT(type() != QFontEngine::Multi); #ifdef QT_ENABLE_HARFBUZZ_NG - if (useHarfbuzzNG) + if (qt_useHarfbuzzNG()) return hb_qt_face_get_for_engine(const_cast(this)); #endif if (!face_) { @@ -360,7 +365,7 @@ bool QFontEngine::supportsScript(QChar::Script script) const #endif #ifdef QT_ENABLE_HARFBUZZ_NG - if (useHarfbuzzNG) { + if (qt_useHarfbuzzNG()) { bool ret = false; if (hb_face_t *face = hb_qt_face_get_for_engine(const_cast(this))) { hb_tag_t script_tag_1, script_tag_2; diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index d156124b98..13bfa2386d 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -938,7 +938,7 @@ void QTextEngine::shapeLine(const QScriptLine &line) } #ifdef QT_ENABLE_HARFBUZZ_NG -extern bool useHarfbuzzNG; // defined in qfontengine.cpp +extern bool qt_useHarfbuzzNG(); // defined in qfontengine.cpp #endif void QTextEngine::shapeText(int item) const @@ -1051,7 +1051,7 @@ void QTextEngine::shapeText(int item) const } #ifdef QT_ENABLE_HARFBUZZ_NG - if (useHarfbuzzNG) + if (qt_useHarfbuzzNG()) si.num_glyphs = shapeTextWithHarfbuzzNG(si, string, itemLength, fontEngine, itemBoundaries, kerningEnabled); else #endif @@ -1067,7 +1067,7 @@ void QTextEngine::shapeText(int item) const QGlyphLayout glyphs = shapedGlyphs(&si); #ifdef QT_ENABLE_HARFBUZZ_NG - if (useHarfbuzzNG) + if (qt_useHarfbuzzNG()) qt_getJustificationOpportunities(string, itemLength, si, glyphs, logClusters(&si)); #endif @@ -1607,7 +1607,7 @@ void QTextEngine::itemize() const } #ifdef QT_ENABLE_HARFBUZZ_NG analysis = scriptAnalysis.data(); - if (useHarfbuzzNG) { + if (qt_useHarfbuzzNG()) { // ### pretend HB-old behavior for now for (int i = 0; i < length; ++i) { switch (analysis[i].script) { -- cgit v1.2.3 From d7068cbe1b37eb065c1902c8e944f3bc19db0ba4 Mon Sep 17 00:00:00 2001 From: Andy Nichols Date: Tue, 13 Jan 2015 15:22:12 +0100 Subject: Make threaded rendering possible with LinuxFB It was previously not possible to render to a QBackingStore with the linuxfb platform plugin because of both the use of a QTimer created on the main thread and there was no lock on the backing store surface (which would lead to copy content to screen that being rendered in another thread). Change-Id: I0ea3600316ce29eb89f6595997847afe7086116f Reviewed-by: Laszlo Agocs --- .../fbconvenience/qfbbackingstore.cpp | 25 ++++++++++++++++ .../fbconvenience/qfbbackingstore_p.h | 10 ++++++- src/platformsupport/fbconvenience/qfbscreen.cpp | 35 +++++++++++++++++----- src/platformsupport/fbconvenience/qfbscreen_p.h | 3 +- 4 files changed, 63 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/platformsupport/fbconvenience/qfbbackingstore.cpp b/src/platformsupport/fbconvenience/qfbbackingstore.cpp index 0fa23ebe02..733235ff42 100644 --- a/src/platformsupport/fbconvenience/qfbbackingstore.cpp +++ b/src/platformsupport/fbconvenience/qfbbackingstore.cpp @@ -69,5 +69,30 @@ void QFbBackingStore::resize(const QSize &size, const QRegion &staticContents) mImage = QImage(size, window()->screen()->handle()->format()); } +const QImage QFbBackingStore::image() +{ + return mImage; +} + +void QFbBackingStore::lock() +{ + mImageMutex.lock(); +} + +void QFbBackingStore::unlock() +{ + mImageMutex.unlock(); +} + +void QFbBackingStore::beginPaint(const QRegion &) +{ + lock(); +} + +void QFbBackingStore::endPaint() +{ + unlock(); +} + QT_END_NAMESPACE diff --git a/src/platformsupport/fbconvenience/qfbbackingstore_p.h b/src/platformsupport/fbconvenience/qfbbackingstore_p.h index 08a4b37eee..a9917e1450 100644 --- a/src/platformsupport/fbconvenience/qfbbackingstore_p.h +++ b/src/platformsupport/fbconvenience/qfbbackingstore_p.h @@ -46,6 +46,7 @@ // #include +#include QT_BEGIN_NAMESPACE @@ -64,12 +65,19 @@ public: virtual void resize(const QSize &size, const QRegion ®ion); - const QImage image() { return mImage; } + const QImage image(); + + void lock(); + void unlock(); + + void beginPaint(const QRegion &); + void endPaint(); protected: friend class QFbWindow; QImage mImage; + QMutex mImageMutex; }; QT_END_NAMESPACE diff --git a/src/platformsupport/fbconvenience/qfbscreen.cpp b/src/platformsupport/fbconvenience/qfbscreen.cpp index aa35825be0..13341344d8 100644 --- a/src/platformsupport/fbconvenience/qfbscreen.cpp +++ b/src/platformsupport/fbconvenience/qfbscreen.cpp @@ -37,11 +37,15 @@ #include "qfbbackingstore_p.h" #include +#include #include +#include +#include + QT_BEGIN_NAMESPACE -QFbScreen::QFbScreen() : mCursor(0), mGeometry(), mDepth(16), mFormat(QImage::Format_RGB16), mScreenImage(0), mCompositePainter(0), mIsUpToDate(false) +QFbScreen::QFbScreen() : mUpdatePending(false), mCursor(0), mGeometry(), mDepth(16), mFormat(QImage::Format_RGB16), mScreenImage(0), mCompositePainter(0), mIsUpToDate(false) { } @@ -54,10 +58,17 @@ QFbScreen::~QFbScreen() void QFbScreen::initializeCompositor() { mScreenImage = new QImage(mGeometry.size(), mFormat); + scheduleUpdate(); +} - mRedrawTimer.setSingleShot(true); - mRedrawTimer.setInterval(0); - connect(&mRedrawTimer, SIGNAL(timeout()), this, SLOT(doRedraw())); +bool QFbScreen::event(QEvent *event) +{ + if (event->type() == QEvent::UpdateRequest) { + doRedraw(); + mUpdatePending = false; + return true; + } + return QObject::event(event); } void QFbScreen::addWindow(QFbWindow *window) @@ -146,8 +157,10 @@ void QFbScreen::setDirty(const QRect &rect) void QFbScreen::scheduleUpdate() { - if (!mRedrawTimer.isActive()) - mRedrawTimer.start(); + if (!mUpdatePending) { + mUpdatePending = true; + QCoreApplication::postEvent(this, new QEvent(QEvent::UpdateRequest)); + } } void QFbScreen::setPhysicalSize(const QSize &size) @@ -246,12 +259,19 @@ QRegion QFbScreen::doRedraw() continue; // if (mWindowStack[layerIndex]->isMinimized()) // continue; + QRect windowRect = mWindowStack[layerIndex]->geometry().translated(-screenOffset); QRect windowIntersect = rect.translated(-windowRect.left(), -windowRect.top()); + + QFbBackingStore *backingStore = mWindowStack[layerIndex]->backingStore(); - if (backingStore) + + if (backingStore) { + backingStore->lock(); mCompositePainter->drawImage(rect, backingStore->image(), windowIntersect); + backingStore->unlock(); + } if (firstLayer) { firstLayer = false; } @@ -272,7 +292,6 @@ QRegion QFbScreen::doRedraw() // qDebug() << "QFbScreen::doRedraw" << mWindowStack.size() << mScreenImage->size() << touchedRegion; - return touchedRegion; } diff --git a/src/platformsupport/fbconvenience/qfbscreen_p.h b/src/platformsupport/fbconvenience/qfbscreen_p.h index b6e50dc786..55aacab9bc 100644 --- a/src/platformsupport/fbconvenience/qfbscreen_p.h +++ b/src/platformsupport/fbconvenience/qfbscreen_p.h @@ -94,10 +94,11 @@ protected slots: protected: void initializeCompositor(); + bool event(QEvent *event); QList mWindowStack; QRegion mRepaintRegion; - QTimer mRedrawTimer; + bool mUpdatePending; QFbCursor *mCursor; QRect mGeometry; -- cgit v1.2.3 From 447ef9766afbb9cb9bbf1a4f193306fe6d680ab6 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 18 Jan 2015 13:32:33 +0100 Subject: src/testlib/testlib.pro: add missing qbenchmarksmetric.h Change-Id: I9b879bb22f3e3f74e55234730d9cf79221812a36 Reviewed-by: Jason McDonald --- src/testlib/testlib.pro | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/testlib/testlib.pro b/src/testlib/testlib.pro index 17a03781c2..dbcc588d10 100644 --- a/src/testlib/testlib.pro +++ b/src/testlib/testlib.pro @@ -17,6 +17,7 @@ HEADERS = qbenchmark.h \ qbenchmarkvalgrind_p.h \ qbenchmarkevent_p.h \ qbenchmarkperfevents_p.h \ + qbenchmarkmetric.h \ qbenchmarkmetric_p.h \ qsignalspy.h \ qtestaccessible.h \ -- cgit v1.2.3 From 23996a9e4007d12cf3eee8f80cebedaf2bcca2e1 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 15 Jan 2015 18:02:38 +0100 Subject: Windows: make TranslucentBackground functional always QOpenGLWidget and QQuickWidget was not functional when WA_TranslucentBackground was set. This is due to the static "isGL" type of checks that are not suitable since 5.3 due to RasterGLSurface windows which may or may not be OpenGL windows, depending on their content. To handle this, we have to do some check on every makeCurrent and perform the necessary calls (most importantly SetLayeredWindowAttributes). Task-number: QTBUG-43854 Change-Id: If19c79482ec4f0a8b795ee710d52ed7e08b52563 Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowscontext.cpp | 8 +-- src/plugins/platforms/windows/qwindowscontext.h | 2 +- .../platforms/windows/qwindowseglcontext.cpp | 1 + .../platforms/windows/qwindowsglcontext.cpp | 1 + src/plugins/platforms/windows/qwindowswindow.cpp | 64 +++++++++++++++++----- src/plugins/platforms/windows/qwindowswindow.h | 4 +- 6 files changed, 59 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 13a3d044a0..2dab4f699f 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -430,7 +430,7 @@ void QWindowsContext::setKeyGrabber(QWindow *w) // Window class registering code (from qapplication_win.cpp) -QString QWindowsContext::registerWindowClass(const QWindow *w, bool isGL) +QString QWindowsContext::registerWindowClass(const QWindow *w) { Q_ASSERT(w); const Qt::WindowFlags flags = w->flags(); @@ -438,7 +438,9 @@ QString QWindowsContext::registerWindowClass(const QWindow *w, bool isGL) // Determine style and icon. uint style = CS_DBLCLKS; bool icon = true; - if (isGL || (flags & Qt::MSWindowsOwnDC)) + // The following will not set CS_OWNDC for any widget window, even if it contains a + // QOpenGLWidget or QQuickWidget later on. That cannot be detected at this stage. + if (w->surfaceType() == QSurface::OpenGLSurface || (flags & Qt::MSWindowsOwnDC)) style |= CS_OWNDC; if (!(flags & Qt::NoDropShadowWindowHint) && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based) && (type == Qt::Popup || w->property("_q_windowsDropShadow").toBool())) { @@ -471,8 +473,6 @@ QString QWindowsContext::registerWindowClass(const QWindow *w, bool isGL) default: break; } - if (isGL) - cname += QStringLiteral("GL"); if (style & CS_DROPSHADOW) cname += QStringLiteral("DropShadow"); if (style & CS_SAVEBITS) diff --git a/src/plugins/platforms/windows/qwindowscontext.h b/src/plugins/platforms/windows/qwindowscontext.h index 28202219d6..5c2e21192b 100644 --- a/src/plugins/platforms/windows/qwindowscontext.h +++ b/src/plugins/platforms/windows/qwindowscontext.h @@ -161,7 +161,7 @@ public: int defaultDPI() const; - QString registerWindowClass(const QWindow *w, bool isGL); + QString registerWindowClass(const QWindow *w); QString registerWindowClass(QString cname, WNDPROC proc, unsigned style = 0, HBRUSH brush = 0, bool icon = false); diff --git a/src/plugins/platforms/windows/qwindowseglcontext.cpp b/src/plugins/platforms/windows/qwindowseglcontext.cpp index c0d0c1f77c..fbd56e2b02 100644 --- a/src/plugins/platforms/windows/qwindowseglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowseglcontext.cpp @@ -573,6 +573,7 @@ bool QWindowsEGLContext::makeCurrent(QPlatformSurface *surface) QWindowsEGLStaticContext::libEGL.eglBindAPI(m_api); QWindowsWindow *window = static_cast(surface); + window->aboutToMakeCurrent(); EGLSurface eglSurface = static_cast(window->surface(m_eglConfig)); Q_ASSERT(eglSurface); diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp index 0e3e6826ec..3348241d37 100644 --- a/src/plugins/platforms/windows/qwindowsglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp @@ -1267,6 +1267,7 @@ bool QWindowsGLContext::makeCurrent(QPlatformSurface *surface) // Do we already have a DC entry for that window? QWindowsWindow *window = static_cast(surface); + window->aboutToMakeCurrent(); const HWND hwnd = window->handle(); if (const QOpenGLContextData *contextData = findByHWND(m_windowContexts, hwnd)) { // Repeated calls to wglMakeCurrent when vsync is enabled in the driver will diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index e7061dbfde..0b72f6db4d 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -205,6 +205,18 @@ static inline QSize clientSize(HWND hwnd) return qSizeOfRect(rect); } +static inline bool windowIsOpenGL(const QWindow *w) +{ + switch (w->surfaceType()) { + case QSurface::OpenGLSurface: + return true; + case QSurface::RasterGLSurface: + return qt_window_private(const_cast(w))->compositing; + default: + return false; + } +} + static bool applyBlurBehindWindow(HWND hwnd) { #ifdef Q_OS_WINCE @@ -328,6 +340,17 @@ static void setWindowOpacity(HWND hwnd, Qt::WindowFlags flags, bool hasAlpha, bo #endif // !Q_OS_WINCE } +static inline void updateGLWindowSettings(const QWindow *w, HWND hwnd, Qt::WindowFlags flags, qreal opacity) +{ + const bool isGL = windowIsOpenGL(w); + const bool hasAlpha = w->format().hasAlpha(); + + if (isGL && hasAlpha) + applyBlurBehindWindow(hwnd); + + setWindowOpacity(hwnd, flags, hasAlpha, isGL, opacity); +} + /*! \class WindowCreationData \brief Window creation code. @@ -369,14 +392,13 @@ struct WindowCreationData void fromWindow(const QWindow *w, const Qt::WindowFlags flags, unsigned creationFlags = 0); inline WindowData create(const QWindow *w, const WindowData &data, QString title) const; inline void applyWindowFlags(HWND hwnd) const; - void initialize(HWND h, bool frameChange, qreal opacityLevel) const; + void initialize(const QWindow *w, HWND h, bool frameChange, qreal opacityLevel) const; Qt::WindowFlags flags; HWND parentHandle; Qt::WindowType type; unsigned style; unsigned exStyle; - bool isGL; bool topLevel; bool popup; bool dialog; @@ -389,7 +411,7 @@ struct WindowCreationData QDebug operator<<(QDebug debug, const WindowCreationData &d) { debug.nospace() << QWindowsWindow::debugWindowFlags(d.flags) - << " GL=" << d.isGL << " topLevel=" << d.topLevel << " popup=" + << " topLevel=" << d.topLevel << " popup=" << d.popup << " dialog=" << d.dialog << " desktop=" << d.desktop << " embedded=" << d.embedded << " tool=" << d.tool << " style=" << debugWinStyle(d.style) @@ -420,8 +442,6 @@ static inline void fixTopLevelWindowFlags(Qt::WindowFlags &flags) void WindowCreationData::fromWindow(const QWindow *w, const Qt::WindowFlags flagsIn, unsigned creationFlags) { - isGL = w->surfaceType() == QWindow::OpenGLSurface; - hasAlpha = w->format().hasAlpha(); flags = flagsIn; // Sometimes QWindow doesn't have a QWindow parent but does have a native parent window, @@ -494,7 +514,7 @@ void WindowCreationData::fromWindow(const QWindow *w, const Qt::WindowFlags flag // ### Commented out for now as it causes some problems, but // this should be correct anyway, so dig some more into this #ifdef Q_FLATTEN_EXPOSE - if (isGL) + if (windowIsOpenGL(w)) // a bit incorrect since the is-opengl status may change from false to true at any time later on style |= WS_CLIPSIBLINGS | WS_CLIPCHILDREN; // see SetPixelFormat #else style |= WS_CLIPSIBLINGS | WS_CLIPCHILDREN ; @@ -569,7 +589,7 @@ QWindowsWindowData const HINSTANCE appinst = (HINSTANCE)GetModuleHandle(0); - const QString windowClassName = QWindowsContext::instance()->registerWindowClass(w, isGL); + const QString windowClassName = QWindowsContext::instance()->registerWindowClass(w); const QRect geometryDip = QWindowsScaling::mapFromNative(data.geometry); QRect fixedGeometryDip = QPlatformWindow::initialGeometry(w, geometryDip, defaultWindowWidth, defaultWindowHeight); @@ -612,9 +632,6 @@ QWindowsWindowData result.embedded = embedded; result.customMargins = context->customMargins; - if (isGL && hasAlpha) - applyBlurBehindWindow(result.hwnd); - return result; } @@ -637,7 +654,7 @@ void WindowCreationData::applyWindowFlags(HWND hwnd) const << debugWinExStyle(newExStyle); } -void WindowCreationData::initialize(HWND hwnd, bool frameChange, qreal opacityLevel) const +void WindowCreationData::initialize(const QWindow *w, HWND hwnd, bool frameChange, qreal opacityLevel) const { if (desktop || !hwnd) return; @@ -662,8 +679,7 @@ void WindowCreationData::initialize(HWND hwnd, bool frameChange, qreal opacityLe else EnableMenuItem(systemMenu, SC_CLOSE, MF_BYCOMMAND|MF_GRAYED); } - - setWindowOpacity(hwnd, flags, hasAlpha, isGL, opacityLevel); + updateGLWindowSettings(w, hwnd, flags, opacityLevel); } else { // child. SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, swpFlags); } @@ -1045,7 +1061,7 @@ QWindowsWindowData creationData.fromWindow(w, parameters.flags); QWindowsWindowData result = creationData.create(w, parameters, title); // Force WM_NCCALCSIZE (with wParam=1) via SWP_FRAMECHANGED for custom margin. - creationData.initialize(result.hwnd, !parameters.customMargins.isNull(), 1); + creationData.initialize(w, result.hwnd, !parameters.customMargins.isNull(), 1); return result; } @@ -1532,7 +1548,7 @@ QWindowsWindowData QWindowsWindow::setWindowFlags_sys(Qt::WindowFlags wt, WindowCreationData creationData; creationData.fromWindow(window(), wt, flags); creationData.applyWindowFlags(m_data.hwnd); - creationData.initialize(m_data.hwnd, true, m_opacity); + creationData.initialize(window(), m_data.hwnd, true, m_opacity); QWindowsWindowData result = m_data; result.flags = creationData.flags; @@ -2303,4 +2319,22 @@ void *QWindowsWindow::surface(void *nativeConfig) #endif } +void QWindowsWindow::aboutToMakeCurrent() +{ +#ifndef QT_NO_OPENGL + // For RasterGLSurface windows, that become OpenGL windows dynamically, it might be + // time to set up some GL specifics. This is particularly important for layered + // windows (WS_EX_LAYERED due to alpha > 0). + const bool isCompositing = qt_window_private(window())->compositing; + if (isCompositing != testFlag(Compositing)) { + if (isCompositing) + setFlag(Compositing); + else + clearFlag(Compositing); + + updateGLWindowSettings(window(), m_data.hwnd, m_data.flags, m_opacity); + } +#endif +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h index 9822ebce45..33be287f81 100644 --- a/src/plugins/platforms/windows/qwindowswindow.h +++ b/src/plugins/platforms/windows/qwindowswindow.h @@ -140,7 +140,8 @@ public: WithinCreate = 0x20000, WithinMaximize = 0x40000, MaximizeToFullScreen = 0x80000, - InputMethodDisabled =0x100000 + InputMethodDisabled = 0x100000, + Compositing = 0x200000 }; QWindowsWindow(QWindow *window, const QWindowsWindowData &data); @@ -253,6 +254,7 @@ public: void setWindowIcon(const QIcon &icon); void *surface(void *nativeConfig); + void aboutToMakeCurrent(); #ifndef Q_OS_WINCE void setAlertState(bool enabled); -- cgit v1.2.3 From 6a081125a5b1b7d629a2c6e16a696ecc06dbb427 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 19 Jan 2015 11:57:22 +0100 Subject: Make -static -opengl dynamic builds succeed Right now it breaks in qwindowseglcontext due to its ifdefs for static ANGLE-only builds. The checks for QT_STATIC should be extended with QT_OPENGL_DYNAMIC so that it continues to resolve functions dynamically in -opengl dynamic builds even when combined with -static. Task-number: QTBUG-43993 Change-Id: Iac6d0353ef16a32a22ab1db0a833fbb0165f328c Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowseglcontext.cpp | 10 +++++----- src/plugins/platforms/windows/qwindowseglcontext.h | 7 ++++--- 2 files changed, 9 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowseglcontext.cpp b/src/plugins/platforms/windows/qwindowseglcontext.cpp index fbd56e2b02..7fcb1f4ffe 100644 --- a/src/plugins/platforms/windows/qwindowseglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowseglcontext.cpp @@ -64,7 +64,7 @@ QT_BEGIN_NAMESPACE QWindowsLibEGL QWindowsEGLStaticContext::libEGL; QWindowsLibGLESv2 QWindowsEGLStaticContext::libGLESv2; -#ifndef QT_STATIC +#if !defined(QT_STATIC) || defined(QT_OPENGL_DYNAMIC) #ifdef Q_CC_MINGW static void *resolveFunc(HMODULE lib, const char *name) @@ -111,7 +111,7 @@ void *QWindowsLibEGL::resolve(const char *name) #endif // !QT_STATIC -#ifndef QT_STATIC +#if !defined(QT_STATIC) || defined(QT_OPENGL_DYNAMIC) # define RESOLVE(signature, name) signature(resolve( #name )); #else # define RESOLVE(signature, name) signature(&::name); @@ -127,7 +127,7 @@ bool QWindowsLibEGL::init() qCDebug(lcQpaGl) << "Qt: Using EGL from" << dllName; -#ifndef QT_STATIC +#if !defined(QT_STATIC) || defined(QT_OPENGL_DYNAMIC) m_lib = ::LoadLibraryW((const wchar_t *) QString::fromLatin1(dllName).utf16()); if (!m_lib) { qErrnoWarning(::GetLastError(), "Failed to load %s", dllName); @@ -159,7 +159,7 @@ bool QWindowsLibEGL::init() return eglGetError && eglGetDisplay && eglInitialize; } -#ifndef QT_STATIC +#if !defined(QT_STATIC) || defined(QT_OPENGL_DYNAMIC) void *QWindowsLibGLESv2::resolve(const char *name) { void *proc = m_lib ? resolveFunc(m_lib, name) : 0; @@ -179,7 +179,7 @@ bool QWindowsLibGLESv2::init() #endif qCDebug(lcQpaGl) << "Qt: Using OpenGL ES 2.0 from" << dllName; -#ifndef QT_STATIC +#if !defined(QT_STATIC) || defined(QT_OPENGL_DYNAMIC) m_lib = ::LoadLibraryW((const wchar_t *) QString::fromLatin1(dllName).utf16()); if (!m_lib) { qErrnoWarning(::GetLastError(), "Failed to load %s", dllName); diff --git a/src/plugins/platforms/windows/qwindowseglcontext.h b/src/plugins/platforms/windows/qwindowseglcontext.h index 63a7c25a6f..29df3ba882 100644 --- a/src/plugins/platforms/windows/qwindowseglcontext.h +++ b/src/plugins/platforms/windows/qwindowseglcontext.h @@ -74,7 +74,7 @@ struct QWindowsLibEGL __eglMustCastToProperFunctionPointerType (EGLAPIENTRY * eglGetProcAddress)(const char *procname); private: -#ifndef QT_STATIC +#if !defined(QT_STATIC) || defined(QT_OPENGL_DYNAMIC) void *resolve(const char *name); HMODULE m_lib; #endif @@ -83,7 +83,8 @@ private: struct QWindowsLibGLESv2 { bool init(); -#ifndef QT_STATIC + +#if !defined(QT_STATIC) || defined(QT_OPENGL_DYNAMIC) void *moduleHandle() const { return m_lib; } #else void *moduleHandle() const { return Q_NULLPTR; } @@ -238,7 +239,7 @@ struct QWindowsLibGLESv2 void (APIENTRY * glDepthRangef)(GLclampf nearVal, GLclampf farVal); private: -#ifndef QT_STATIC +#if !defined(QT_STATIC) || defined(QT_OPENGL_DYNAMIC) void *resolve(const char *name); HMODULE m_lib; #endif -- cgit v1.2.3 From 91d6aafad4805fb760a51f64565929952a37c5bf Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 19 Jan 2015 13:18:17 +0100 Subject: Windows: avoid generating exposes on plain moves The fake expose generation for shrunk windows is causing side effects with desktop GL: it will generate expose events even when only moving the window. This is bad. So change the condition to look for shrinking and do nothing if the size is same as before. This is reported to cause perf issues with e.g. QOpenGLWindow or similar where an expose does an immediate repaint (potentially with block swap). Task-number: QTBUG-32121 Change-Id: I4687ea8210cee6691d608450c48b1dbef52d6df3 Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowswindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 0b72f6db4d..1d8645f5f4 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -1394,7 +1394,7 @@ void QWindowsWindow::handleGeometryChange() // QTBUG-32121: OpenGL/normal windows (with exception of ANGLE) do not receive // expose events when shrinking, synthesize. if (!testFlag(OpenGL_ES2) && isExposed() - && !(m_data.geometry.width() > previousGeometry.width() || m_data.geometry.height() > previousGeometry.height())) { + && !(m_data.geometry.width() >= previousGeometry.width() || m_data.geometry.height() >= previousGeometry.height())) { fireExpose(QRect(QPoint(0, 0), m_data.geometry.size()), true); } if (previousGeometry.topLeft() != m_data.geometry.topLeft()) { -- cgit v1.2.3 From 027d2fc84663b969bf8b166898bd5efec8fcf465 Mon Sep 17 00:00:00 2001 From: David Faure Date: Sun, 18 Jan 2015 11:25:09 +0100 Subject: Doc: add missing since 5.4 for new sessionProtocol() methods. They were added in 233a2f37bfa6c896612cbf9a7db42e8e0da788f5, which is in 5.4, but the \since information was missing. Change-Id: I346a049cad75647fdcd7b64df80dc169bb4ec70a Reviewed-by: Richard J. Moore --- src/network/ssl/qsslconfiguration.cpp | 1 + src/network/ssl/qsslsocket.cpp | 1 + 2 files changed, 2 insertions(+) (limited to 'src') diff --git a/src/network/ssl/qsslconfiguration.cpp b/src/network/ssl/qsslconfiguration.cpp index 7bb6e02b7e..55c9a281ba 100644 --- a/src/network/ssl/qsslconfiguration.cpp +++ b/src/network/ssl/qsslconfiguration.cpp @@ -512,6 +512,7 @@ QSslCipher QSslConfiguration::sessionCipher() const is set during the handshake phase. \sa protocol(), setProtocol() + \since 5.4 */ QSsl::SslProtocol QSslConfiguration::sessionProtocol() const { diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 31c7b3087e..f735b6bd4f 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -1081,6 +1081,7 @@ QSslCipher QSslSocket::sessionCipher() const is set during the handshake phase. \sa protocol(), setProtocol() + \since 5.4 */ QSsl::SslProtocol QSslSocket::sessionProtocol() const { -- cgit v1.2.3 From 64c6bfd1f45f532ea32de49431b66e03e7593f01 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Mon, 19 Jan 2015 18:18:57 +0400 Subject: Fix crash with multi threaded QFont/QTextEngine usage Since we don't configure HB-NG via its configure script, we have to define all optional switchers we do care about by our own. Some of these switchers were missing in harfbuzz-ng.pro, causing HB-NG to be built with no threading support. Task-number: QTBUG-43850 Change-Id: I0944a68fe0bfae3306a3e6085e25704f0d0d0efc Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro index 79c2a3e2d6..6b51d9679a 100644 --- a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro +++ b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro @@ -7,7 +7,12 @@ CONFIG += \ load(qt_helper_lib) -DEFINES += HAVE_OT HAVE_ATEXIT HB_NO_UNICODE_FUNCS HB_DISABLE_DEPRECATED +DEFINES += HAVE_OT HB_NO_UNICODE_FUNCS HB_DISABLE_DEPRECATED + +# platform/compiler specific definitions +DEFINES += HAVE_ATEXIT +gcc: DEFINES += HAVE_INTEL_ATOMIC_PRIMITIVES +unix: DEFINES += HAVE_PTHREAD HAVE_SCHED_H HAVE_SCHED_YIELD INCLUDEPATH += $$PWD/include -- cgit v1.2.3 From 0b62cd8da7d8ee078b799b95088a63626099caa4 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 19 Jan 2015 15:00:05 +0100 Subject: Windows: Fix coordinate offset when positioning the taskbar on the left. For windows that do not have WS_EX_TOOLWINDOW set, the WINDOWPLACEMENT API uses workspace/available aera coordinates. Introduce a helper function to return the offset and use that. Task-number: QTBUG-43872 Change-Id: I329c640f180524699b45b855b4583f447c4a0987 Reviewed-by: Oliver Wolff --- src/plugins/platforms/windows/qwindowsscreen.cpp | 9 +++++++ src/plugins/platforms/windows/qwindowsscreen.h | 2 ++ src/plugins/platforms/windows/qwindowswindow.cpp | 34 ++++++++++++++++++++---- 3 files changed, 40 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp index fd57d9ee61..ae8020a53e 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.cpp +++ b/src/plugins/platforms/windows/qwindowsscreen.cpp @@ -497,4 +497,13 @@ bool QWindowsScreenManager::handleScreenChanges() return true; } +const QWindowsScreen *QWindowsScreenManager::screenAtDp(const QPoint &p) const +{ + foreach (QWindowsScreen *scr, m_screens) { + if (scr->geometryDp().contains(p)) + return scr; + } + return Q_NULLPTR; +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsscreen.h b/src/plugins/platforms/windows/qwindowsscreen.h index aa1408358b..28256f3000 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.h +++ b/src/plugins/platforms/windows/qwindowsscreen.h @@ -137,6 +137,8 @@ public: bool handleDisplayChange(WPARAM wParam, LPARAM lParam); const WindowsScreenList &screens() const { return m_screens; } + const QWindowsScreen *screenAtDp(const QPoint &p) const; + private: void removeScreen(int index); diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 1d8645f5f4..fbb61a1aff 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -169,6 +169,25 @@ QDebug operator<<(QDebug d, const NCCALCSIZE_PARAMS &p) } #endif // !Q_OS_WINCE +// QTBUG-43872, for windows that do not have WS_EX_TOOLWINDOW set, WINDOWPLACEMENT +// is in workspace/available area coordinates. +static QPoint windowPlacementOffset(HWND hwnd, const QPoint &point) +{ +#ifndef Q_OS_WINCE + if (GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW) + return QPoint(0, 0); + const QWindowsScreenManager &screenManager = QWindowsContext::instance()->screenManager(); + const QWindowsScreen *screen = screenManager.screens().size() == 1 + ? screenManager.screens().first() : screenManager.screenAtDp(point); + if (screen) + return screen->availableGeometryDp().topLeft() - screen->geometryDp().topLeft(); +#else + Q_UNUSED(hwnd) + Q_UNUSED(point) +#endif + return QPoint(0, 0); +} + // Return the frame geometry relative to the parent // if there is one. static inline QRect frameGeometry(HWND hwnd, bool topLevel) @@ -179,8 +198,10 @@ static inline QRect frameGeometry(HWND hwnd, bool topLevel) WINDOWPLACEMENT windowPlacement; windowPlacement.length = sizeof(WINDOWPLACEMENT); GetWindowPlacement(hwnd, &windowPlacement); - if (windowPlacement.showCmd == SW_SHOWMINIMIZED) - return qrectFromRECT(windowPlacement.rcNormalPosition); + if (windowPlacement.showCmd == SW_SHOWMINIMIZED) { + const QRect result = qrectFromRECT(windowPlacement.rcNormalPosition); + return result.translated(windowPlacementOffset(hwnd, result.topLeft())); + } } #endif // !Q_OS_WINCE GetWindowRect(hwnd, &rect); // Screen coordinates. @@ -1297,8 +1318,10 @@ static QRect normalFrameGeometry(HWND hwnd) #ifndef Q_OS_WINCE WINDOWPLACEMENT wp; wp.length = sizeof(WINDOWPLACEMENT); - if (GetWindowPlacement(hwnd, &wp)) - return qrectFromRECT(wp.rcNormalPosition); + if (GetWindowPlacement(hwnd, &wp)) { + const QRect result = qrectFromRECT(wp.rcNormalPosition); + return result.translated(windowPlacementOffset(hwnd, result.topLeft())); + } #else Q_UNUSED(hwnd) #endif @@ -1427,7 +1450,8 @@ void QWindowsWindow::setGeometry_sys(const QRect &rect) const // window, set the normal position of the window. if ((windowPlacement.showCmd == SW_MAXIMIZE && !IsWindowVisible(m_data.hwnd)) || windowPlacement.showCmd == SW_SHOWMINIMIZED) { - windowPlacement.rcNormalPosition = RECTfromQRect(frameGeometry); + windowPlacement.rcNormalPosition = + RECTfromQRect(frameGeometry.translated(-windowPlacementOffset(m_data.hwnd, frameGeometry.topLeft()))); windowPlacement.showCmd = windowPlacement.showCmd == SW_SHOWMINIMIZED ? SW_SHOWMINIMIZED : SW_HIDE; result = SetWindowPlacement(m_data.hwnd, &windowPlacement); } else -- cgit v1.2.3 From 473ad206c40ac99d00732f5862a51affcd746d2d Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 7 Jan 2015 16:00:08 -0800 Subject: Fix QSharedPointer::create and QEnableSharedFromThis We forgot to initialize the tracker if create() was used. Task-number: QTBUG-43696 Change-Id: Ic5d393bfd36e48a193fcffff13b740931ff2204b Reviewed-by: Marc Mutz --- src/corelib/tools/qsharedpointer_impl.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index 061c7a5a2d..a18b2c28a1 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -412,6 +412,7 @@ public: # ifdef QT_SHAREDPOINTER_TRACK_POINTERS internalSafetyCheckAdd(result.d, result.value); # endif + result.enableSharedFromThis(result.data()); return result; } #else @@ -432,6 +433,7 @@ public: internalSafetyCheckAdd(result.d, result.value); # endif result.d->setQObjectShared(result.value, true); + result.enableSharedFromThis(result.data()); return result; } -- cgit v1.2.3 From 97af289954cf2ae1dc4ddf8636c8d72dee6e679f Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Tue, 20 Jan 2015 16:21:05 +0300 Subject: Doc: Improve description of QTextStream::readLine() Don't recommend a common value for maxlen, because we don't really know it. Soften a statement about not applying QString::trimmed() to the result because it may contain surrounding spaces. Change-Id: Ie90db6f033cfcc0dff0ef6796ba115028bcaaa77 Reviewed-by: David Faure Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qtextstream.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp index 089a915a36..571875c508 100644 --- a/src/corelib/io/qtextstream.cpp +++ b/src/corelib/io/qtextstream.cpp @@ -1550,11 +1550,10 @@ QString QTextStream::readAll() the stream contains lines longer than this, then the lines will be split after \a maxlen characters and returned in parts. - If \a maxlen is 0, the lines can be of any length. A common value - for \a maxlen is 75. + If \a maxlen is 0, the lines can be of any length. The returned line has no trailing end-of-line characters ("\\n" - or "\\r\\n"), so calling QString::trimmed() is unnecessary. + or "\\r\\n"), so calling QString::trimmed() can be unnecessary. If the stream has read to the end of the file, \l {QTextStream::readLine()}{readLine()} will return a null QString. For strings, or for devices that support it, -- cgit v1.2.3 From bdbcf6704f4b0e7d9aaa522cc69e730148080cb8 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Wed, 21 Jan 2015 13:28:46 +0100 Subject: Make it possible to generate rcc files from stdin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There's already some code to be able to generate the rcc files from stdin, only problem being that the input sanity check was not allowing the code path to proceed being left unreachable. This patch fixes it by allowing "-" as an acceptable argument and the process proceeds as expected. Change-Id: Icd47c7a65373ff1ea3f98d9528736f8a1b21b707 Reviewed-by: Albert Astals Cid Reviewed-by: Tor Arne Vestbø --- src/tools/rcc/main.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/tools/rcc/main.cpp b/src/tools/rcc/main.cpp index 3c556d76a8..3c88be92bb 100644 --- a/src/tools/rcc/main.cpp +++ b/src/tools/rcc/main.cpp @@ -199,7 +199,9 @@ int runRcc(int argc, char *argv[]) const QStringList filenamesIn = parser.positionalArguments(); foreach (const QString &file, filenamesIn) { - if (!QFile::exists(file)) { + if (file == QLatin1String("-")) + continue; + else if (!QFile::exists(file)) { qWarning("%s: File does not exist '%s'", argv[0], qPrintable(file)); return 1; } -- cgit v1.2.3 From 6338b1421ef5a9928df25dde5ef62c6b11682da6 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Fri, 16 Jan 2015 10:43:21 +0100 Subject: Safeguard QScreen::refreshRate against buggy platform behavior Change-Id: I891bd5272db76e8562f6722b633cc0fdaac5f7a2 Task-number: QTBUG-43853 Reviewed-by: Robin Burchell --- src/gui/kernel/qguiapplication.cpp | 11 ++++++++--- src/gui/kernel/qscreen_p.h | 3 +++ 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index dc5501eaf5..928d0cddc9 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -2578,9 +2578,14 @@ void QGuiApplicationPrivate::reportRefreshRateChange(QWindowSystemInterfacePriva return; QScreen *s = e->screen.data(); - s->d_func()->refreshRate = e->rate; - - emit s->refreshRateChanged(s->refreshRate()); + qreal rate = e->rate; + // safeguard ourselves against buggy platform behavior... + if (rate < 1.0) + rate = 60.0; + if (!qFuzzyCompare(s->d_func()->refreshRate, rate)) { + s->d_func()->refreshRate = rate; + emit s->refreshRateChanged(s->refreshRate()); + } } void QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent *e) diff --git a/src/gui/kernel/qscreen_p.h b/src/gui/kernel/qscreen_p.h index cdb923c429..53d4f3404a 100644 --- a/src/gui/kernel/qscreen_p.h +++ b/src/gui/kernel/qscreen_p.h @@ -64,6 +64,9 @@ public: availableGeometry = platformScreen->availableGeometry(); logicalDpi = platformScreen->logicalDpi(); refreshRate = platformScreen->refreshRate(); + // safeguard ourselves against buggy platform behavior... + if (refreshRate < 1.0) + refreshRate = 60.0; updatePrimaryOrientation(); -- cgit v1.2.3 From 1755038134cfe16d3d52ec2aea543955462e2951 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 18 Jan 2015 21:52:18 +0100 Subject: QFixed: fix undefined behavior Left-shifting of negative values is undefined ([expr.shift]/2). Use multiplication with 64 instead. There are probably more instances in this class, but this patch already gets rid of vast amounts of ubsan errors in tests/auto/gui/text. Found by UBSan. Change-Id: I89b8bb61e4decba605fe4fb3efea68b1f1eacf1a Reviewed-by: Olivier Goffart (Woboq GmbH) Reviewed-by: Thiago Macieira --- src/gui/painting/qfixed_p.h | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/gui/painting/qfixed_p.h b/src/gui/painting/qfixed_p.h index 69a7b06780..a0ac69f02f 100644 --- a/src/gui/painting/qfixed_p.h +++ b/src/gui/painting/qfixed_p.h @@ -56,10 +56,10 @@ private: Q_DECL_CONSTEXPR QFixed(int val, int) : val(val) {} // 2nd int is just a dummy for disambiguation public: Q_DECL_CONSTEXPR QFixed() : val(0) {} - Q_DECL_CONSTEXPR QFixed(int i) : val(i<<6) {} - Q_DECL_CONSTEXPR QFixed(long i) : val(i<<6) {} - QFixed &operator=(int i) { val = (i<<6); return *this; } - QFixed &operator=(long i) { val = (i<<6); return *this; } + Q_DECL_CONSTEXPR QFixed(int i) : val(i * 64) {} + Q_DECL_CONSTEXPR QFixed(long i) : val(i * 64) {} + QFixed &operator=(int i) { val = i * 64; return *this; } + QFixed &operator=(long i) { val = i * 64; return *this; } Q_DECL_CONSTEXPR static QFixed fromReal(qreal r) { return fromFixed((int)(r*qreal(64))); } Q_DECL_CONSTEXPR static QFixed fromFixed(int fixed) { return QFixed(fixed,0); } // uses private ctor @@ -70,21 +70,21 @@ public: Q_DECL_CONSTEXPR inline int toInt() const { return (((val)+32) & -64)>>6; } Q_DECL_CONSTEXPR inline qreal toReal() const { return ((qreal)val)/(qreal)64; } - Q_DECL_CONSTEXPR inline int truncate() const { return val>>6; } + Q_DECL_CONSTEXPR inline int truncate() const { return val / 64; } Q_DECL_CONSTEXPR inline QFixed round() const { return fromFixed(((val)+32) & -64); } Q_DECL_CONSTEXPR inline QFixed floor() const { return fromFixed((val) & -64); } Q_DECL_CONSTEXPR inline QFixed ceil() const { return fromFixed((val+63) & -64); } - Q_DECL_CONSTEXPR inline QFixed operator+(int i) const { return fromFixed((val + (i<<6))); } + Q_DECL_CONSTEXPR inline QFixed operator+(int i) const { return fromFixed(val + i * 64); } Q_DECL_CONSTEXPR inline QFixed operator+(uint i) const { return fromFixed((val + (i<<6))); } Q_DECL_CONSTEXPR inline QFixed operator+(const QFixed &other) const { return fromFixed((val + other.val)); } - inline QFixed &operator+=(int i) { val += (i<<6); return *this; } + inline QFixed &operator+=(int i) { val += i * 64; return *this; } inline QFixed &operator+=(uint i) { val += (i<<6); return *this; } inline QFixed &operator+=(const QFixed &other) { val += other.val; return *this; } - Q_DECL_CONSTEXPR inline QFixed operator-(int i) const { return fromFixed((val - (i<<6))); } + Q_DECL_CONSTEXPR inline QFixed operator-(int i) const { return fromFixed(val - i * 64); } Q_DECL_CONSTEXPR inline QFixed operator-(uint i) const { return fromFixed((val - (i<<6))); } Q_DECL_CONSTEXPR inline QFixed operator-(const QFixed &other) const { return fromFixed((val - other.val)); } - inline QFixed &operator-=(int i) { val -= (i<<6); return *this; } + inline QFixed &operator-=(int i) { val -= i * 64; return *this; } inline QFixed &operator-=(uint i) { val -= (i<<6); return *this; } inline QFixed &operator-=(const QFixed &other) { val -= other.val; return *this; } Q_DECL_CONSTEXPR inline QFixed operator-() const { return fromFixed(-val); } @@ -162,18 +162,18 @@ Q_DECL_CONSTEXPR inline QFixed operator+(uint i, const QFixed &d) { return d+i; Q_DECL_CONSTEXPR inline QFixed operator-(uint i, const QFixed &d) { return -(d-i); } // Q_DECL_CONSTEXPR inline QFixed operator*(qreal d, const QFixed &d2) { return d2*d; } -Q_DECL_CONSTEXPR inline bool operator==(const QFixed &f, int i) { return f.value() == (i<<6); } -Q_DECL_CONSTEXPR inline bool operator==(int i, const QFixed &f) { return f.value() == (i<<6); } -Q_DECL_CONSTEXPR inline bool operator!=(const QFixed &f, int i) { return f.value() != (i<<6); } -Q_DECL_CONSTEXPR inline bool operator!=(int i, const QFixed &f) { return f.value() != (i<<6); } -Q_DECL_CONSTEXPR inline bool operator<=(const QFixed &f, int i) { return f.value() <= (i<<6); } -Q_DECL_CONSTEXPR inline bool operator<=(int i, const QFixed &f) { return (i<<6) <= f.value(); } -Q_DECL_CONSTEXPR inline bool operator>=(const QFixed &f, int i) { return f.value() >= (i<<6); } -Q_DECL_CONSTEXPR inline bool operator>=(int i, const QFixed &f) { return (i<<6) >= f.value(); } -Q_DECL_CONSTEXPR inline bool operator<(const QFixed &f, int i) { return f.value() < (i<<6); } -Q_DECL_CONSTEXPR inline bool operator<(int i, const QFixed &f) { return (i<<6) < f.value(); } -Q_DECL_CONSTEXPR inline bool operator>(const QFixed &f, int i) { return f.value() > (i<<6); } -Q_DECL_CONSTEXPR inline bool operator>(int i, const QFixed &f) { return (i<<6) > f.value(); } +Q_DECL_CONSTEXPR inline bool operator==(const QFixed &f, int i) { return f.value() == i * 64; } +Q_DECL_CONSTEXPR inline bool operator==(int i, const QFixed &f) { return f.value() == i * 64; } +Q_DECL_CONSTEXPR inline bool operator!=(const QFixed &f, int i) { return f.value() != i * 64; } +Q_DECL_CONSTEXPR inline bool operator!=(int i, const QFixed &f) { return f.value() != i * 64; } +Q_DECL_CONSTEXPR inline bool operator<=(const QFixed &f, int i) { return f.value() <= i * 64; } +Q_DECL_CONSTEXPR inline bool operator<=(int i, const QFixed &f) { return i * 64 <= f.value(); } +Q_DECL_CONSTEXPR inline bool operator>=(const QFixed &f, int i) { return f.value() >= i * 64; } +Q_DECL_CONSTEXPR inline bool operator>=(int i, const QFixed &f) { return i * 64 >= f.value(); } +Q_DECL_CONSTEXPR inline bool operator<(const QFixed &f, int i) { return f.value() < i * 64; } +Q_DECL_CONSTEXPR inline bool operator<(int i, const QFixed &f) { return i * 64 < f.value(); } +Q_DECL_CONSTEXPR inline bool operator>(const QFixed &f, int i) { return f.value() > i * 64; } +Q_DECL_CONSTEXPR inline bool operator>(int i, const QFixed &f) { return i * 64 > f.value(); } #ifndef QT_NO_DEBUG_STREAM inline QDebug &operator<<(QDebug &dbg, const QFixed &f) -- cgit v1.2.3 From fad17cf79c761a11163df48c70e81e709e6bb9a2 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 21 Jan 2015 16:15:28 +0100 Subject: QFontDatabase: Make assert about failed delayed font population more verbose. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-43774 Change-Id: Ie55de75e31e1e569f4b4e336900a8f96f7c1b9c0 Reviewed-by: Tor Arne Vestbø --- src/gui/text/qfontdatabase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 99814dba82..fcdb6ecca9 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -382,7 +382,7 @@ void QtFontFamily::ensurePopulated() return; QGuiApplicationPrivate::platformIntegration()->fontDatabase()->populateFamily(name); - Q_ASSERT(populated); + Q_ASSERT_X(populated, Q_FUNC_INFO, qPrintable(name)); } class QFontDatabasePrivate -- cgit v1.2.3 From 0eaa86dd018294d1a961f486bf290f8647293c6d Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Tue, 1 Jul 2014 15:39:32 +0200 Subject: Accessibility: Fix selection change notifications on Linux MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The selection update is not implemented on other platforms (if needed at all). Task-number: QTBUG-39440 Change-Id: I8eb8c4eb1c23ba2d246bc95f1c77dc9da9e22495 Reviewed-by: Jan Arve Sæther --- src/platformsupport/linuxaccessibility/atspiadaptor.cpp | 4 ++-- src/widgets/itemviews/qlistview.cpp | 2 +- src/widgets/itemviews/qtableview.cpp | 2 +- src/widgets/itemviews/qtreeview.cpp | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp index c3573489e9..c5de6ee533 100644 --- a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp +++ b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp @@ -1047,6 +1047,8 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event) } break; } + case QAccessible::SelectionAdd: + case QAccessible::SelectionRemove: case QAccessible::Selection: { QAccessibleInterface * iface = event->accessibleInterface(); if (!iface) { @@ -1104,7 +1106,6 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event) case QAccessible::ParentChanged: case QAccessible::DialogStart: case QAccessible::DialogEnd: - case QAccessible::SelectionRemove: case QAccessible::PopupMenuStart: case QAccessible::PopupMenuEnd: case QAccessible::SoundPlayed: @@ -1146,7 +1147,6 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event) case QAccessible::TextAttributeChanged: case QAccessible::TextColumnChanged: case QAccessible::VisibleDataChanged: - case QAccessible::SelectionAdd: case QAccessible::SelectionWithin: case QAccessible::LocationChanged: case QAccessible::HelpChanged: diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp index e7d18092f1..add60d4d88 100644 --- a/src/widgets/itemviews/qlistview.cpp +++ b/src/widgets/itemviews/qlistview.cpp @@ -3198,7 +3198,7 @@ void QListView::selectionChanged(const QItemSelection &selected, QModelIndex sel = selected.indexes().value(0); if (sel.isValid()) { int entry = visualIndex(sel); - QAccessibleEvent event(this, QAccessible::Selection); + QAccessibleEvent event(this, QAccessible::SelectionAdd); event.setChild(entry); QAccessible::updateAccessibility(&event); } diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp index b5eb509766..be1bfce9ff 100644 --- a/src/widgets/itemviews/qtableview.cpp +++ b/src/widgets/itemviews/qtableview.cpp @@ -3337,7 +3337,7 @@ void QTableView::selectionChanged(const QItemSelection &selected, QModelIndex sel = selected.indexes().value(0); if (sel.isValid()) { int entry = d->accessibleTable2Index(sel); - QAccessibleEvent event(this, QAccessible::Selection); + QAccessibleEvent event(this, QAccessible::SelectionAdd); event.setChild(entry); QAccessible::updateAccessibility(&event); } diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index 2c5f4b7c72..531ef8b8aa 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -3981,7 +3981,7 @@ void QTreeView::selectionChanged(const QItemSelection &selected, if (sel.isValid()) { int entry = d->accessibleTree2Index(sel); Q_ASSERT(entry >= 0); - QAccessibleEvent event(this, QAccessible::Selection); + QAccessibleEvent event(this, QAccessible::SelectionAdd); event.setChild(entry); QAccessible::updateAccessibility(&event); } -- cgit v1.2.3 From 358a9ac9362917e644e4c09c8d5c85d13faf5503 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Sun, 7 Sep 2014 08:48:29 +0200 Subject: Do not include accessibility.pri twice Change-Id: Id4b312a57b098ad893ba08e7a3c7f1a0fb891eef Reviewed-by: Friedemann Kleint --- src/platformsupport/linuxaccessibility/linuxaccessibility.pri | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/platformsupport/linuxaccessibility/linuxaccessibility.pri b/src/platformsupport/linuxaccessibility/linuxaccessibility.pri index 1d51d2876c..1b65fb1cad 100644 --- a/src/platformsupport/linuxaccessibility/linuxaccessibility.pri +++ b/src/platformsupport/linuxaccessibility/linuxaccessibility.pri @@ -2,7 +2,6 @@ contains(QT_CONFIG, accessibility-atspi-bridge) { QT_FOR_PRIVATE += dbus include(../../3rdparty/atspi2/atspi2.pri) - include(../accessibility/accessibility.pri) INCLUDEPATH += $$PWD -- cgit v1.2.3 From a4c837b3a1168ab07415501f141395dfffc3ed18 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 20 Jan 2015 12:30:26 -0800 Subject: Fix QUdpSocket's emission of readyRead() The documentation says that QUdpSocket emits readyRead() only for one datagram and that if you don't read it, the class will not emit again. That should be implemented by disabling of the socket notifier once we have the datagram already read, but was broken. In turn, that breakage caused a live-lock of the event loop: since we didn't disable the notifier nor read the pending datagram, the event loop would fire every time for the same datagram. The re-enabling of the notifier was already working. Task-number: QTBUG-43857 Change-Id: Ic5d393bfd36e48a193fcffff13bb32ad390b5fe8 Reviewed-by: Peter Hartmann Reviewed-by: Richard J. Moore --- src/network/socket/qabstractsocket.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 604214ce8e..5a1ad40b90 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -740,8 +740,15 @@ bool QAbstractSocketPrivate::canReadNotification() return true; } - if ((isBuffered || socketType != QAbstractSocket::TcpSocket) && socketEngine) - socketEngine->setReadNotificationEnabled(readBufferMaxSize == 0 || readBufferMaxSize > q->bytesAvailable()); + if (socketEngine) { + // turn the socket engine off if we've either: + // - got pending datagrams + // - reached the buffer size limit + if (isBuffered) + socketEngine->setReadNotificationEnabled(readBufferMaxSize == 0 || readBufferMaxSize > q->bytesAvailable()); + else if (socketType != QAbstractSocket::TcpSocket) + socketEngine->setReadNotificationEnabled(!socketEngine->hasPendingDatagrams()); + } // reset the read socket notifier state if we reentered inside the // readyRead() connected slot. -- cgit v1.2.3 From 2ecde56f65c21e91c2d7e9fe72ecb9c9d1ff1d33 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Wed, 14 Jan 2015 00:25:26 +0100 Subject: QSortFilterProxyModel: fix a regression bec1854cc023fb705319c582a636d5f484adafcc introduced a regression: when sorting a tree model, children items would not follow the sorted parents any more (they wouldn't be remapped correctly), resulting in crashes. So, the fix needs more reasoning; let's revert the fix, but leave the original test around for any subsequent attempt, and introduce a new test which looks for the right behavior when sorting trees. This commit partially reverts bec1854cc023fb705319c582a636d5f484adafcc. Task-number: QTBUG-43827 Change-Id: Ic83ac53aef639f870f6c36a8b4b2992f5b485b13 Reviewed-by: David Faure Reviewed-by: Volker Krause (cherry-picked from qtbase/e9ad46ed412987e3e46c5a641e5f30408b97ac90) --- src/corelib/itemmodels/qsortfilterproxymodel.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/itemmodels/qsortfilterproxymodel.cpp b/src/corelib/itemmodels/qsortfilterproxymodel.cpp index 0b2b0e4188..b01c9db418 100644 --- a/src/corelib/itemmodels/qsortfilterproxymodel.cpp +++ b/src/corelib/itemmodels/qsortfilterproxymodel.cpp @@ -1196,7 +1196,11 @@ void QSortFilterProxyModelPrivate::_q_sourceDataChanged(const QModelIndex &sourc parents << q->mapFromSource(source_parent); emit q->layoutAboutToBeChanged(parents, QAbstractItemModel::VerticalSortHint); QModelIndexPairList source_indexes = store_persistent_indexes(); - sort_source_rows(m->source_rows, source_parent); + remove_source_items(m->proxy_rows, m->source_rows, source_rows_resort, + source_parent, Qt::Vertical, false); + sort_source_rows(source_rows_resort, source_parent); + insert_source_items(m->proxy_rows, m->source_rows, source_rows_resort, + source_parent, Qt::Vertical, false); update_persistent_indexes(source_indexes); emit q->layoutChanged(parents, QAbstractItemModel::VerticalSortHint); // Make sure we also emit dataChanged for the rows -- cgit v1.2.3 From 9e4ef3539a5770f1b422b73b41dc3218ff4efc81 Mon Sep 17 00:00:00 2001 From: Andreas Holzammer Date: Tue, 20 Jan 2015 12:40:50 +0100 Subject: Fix finding widgets for Windows Embedded Compact ChildWindowFromPoint does not work properly under wince, so lets use the plain old WindowFromPoint. Task-number: QTBUG-44022 Change-Id: I49bae6409f2d11ddc01bea01f4c2f91a02b90892 Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowscontext.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 13a3d044a0..ffa7f82d8e 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -676,7 +676,7 @@ static inline bool findPlatformWindowHelper(const POINT &screenPoint, unsigned c const HWND child = ChildWindowFromPointEx(*hwnd, point, cwexFlags); #else Q_UNUSED(cwexFlags) - const HWND child = ChildWindowFromPoint(*hwnd, point); + const HWND child = WindowFromPoint(point); #endif if (!child || child == *hwnd) return false; -- cgit v1.2.3 From 508b1fa173e135c839f07e0e4cd6009ac63a577c Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 20 Jan 2015 09:34:42 +0100 Subject: QTemporaryDir: Remove directories on failure When creating a temporary directory but failing to set its permissions, we need to remove the directory we created to avoid leaving 256 empty, unused directories in the destination folder. This happens on Android if you try creating a QTemporaryDir in the download path on the sdcard. Task-number: QTBUG-43352 Change-Id: Ic88fb7572f1abd65e5c7d8882b59c95f4b22ed72 Reviewed-by: Oswald Buddenhagen Reviewed-by: Thiago Macieira --- src/corelib/io/qtemporarydir.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/io/qtemporarydir.cpp b/src/corelib/io/qtemporarydir.cpp index 5e0def74ee..5f0c500183 100644 --- a/src/corelib/io/qtemporarydir.cpp +++ b/src/corelib/io/qtemporarydir.cpp @@ -128,8 +128,11 @@ static char *q_mkdtemp(char *templateName) QFile::ReadOwner | QFile::WriteOwner | QFile::ExeOwner, error); - if (error.error() != 0) + if (error.error() != 0) { + if (!QFileSystemEngine::removeDirectory(fileSystemEntry, false)) + qWarning() << "Unable to remove unused directory" << templateNameStr; continue; + } return templateName; } } -- cgit v1.2.3 From 0c4c841ce8cd3a3b8ebc636dd41f7c7a2011991d Mon Sep 17 00:00:00 2001 From: Volker Krause Date: Wed, 21 Jan 2015 22:20:26 +0100 Subject: Fix invalid memory access when a slot deletes the sender. Only happens with active signal spy callbacks. The Connection object can be deleted when returning from the slot here, so accessing it for the method index for the signal end callback will access invalid memory. Change-Id: I44643a171863c35a94e7a5ffa096fcaac5abd509 Reviewed-by: Milian Wolff Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/kernel/qobject.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index a1a04b3ce5..f2ceb7081c 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -3710,13 +3710,14 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i } else if (callFunction && c->method_offset <= receiver->metaObject()->methodOffset()) { //we compare the vtable to make sure we are not in the destructor of the object. locker.unlock(); + const int methodIndex = c->method(); if (qt_signal_spy_callback_set.slot_begin_callback != 0) - qt_signal_spy_callback_set.slot_begin_callback(receiver, c->method(), argv ? argv : empty_argv); + qt_signal_spy_callback_set.slot_begin_callback(receiver, methodIndex, argv ? argv : empty_argv); callFunction(receiver, QMetaObject::InvokeMetaMethod, method_relative, argv ? argv : empty_argv); if (qt_signal_spy_callback_set.slot_end_callback != 0) - qt_signal_spy_callback_set.slot_end_callback(receiver, c->method()); + qt_signal_spy_callback_set.slot_end_callback(receiver, methodIndex); locker.relock(); } else { const int method = method_relative + c->method_offset; -- cgit v1.2.3 From 586fd042345b619acceafb13e84b912863961e56 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Wed, 21 Jan 2015 12:55:42 +0100 Subject: OS X/iOS: Fix stretched font rendering MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Setting the stretch of a QFont did not work correctly on OS X or iOS. Two things are needed to make it work: First of all, we need to properly set the transform when creating the CTFont. In addition, we need to manually scale the advances, as CTRunGetPositions() does not do this for us. On OS X 10.6, however, there was a regression and CTRunGetPositions() would return scaled positions, so we exclude the step to scale the advances on this particular version. This is an adaptation of bc25cfdd65452efa226cbd544c9ae9803eb6748a in Qt 4. [ChangeLog][QtGui][OS X/iOS] Fixed a bug when rendering fonts that were set to be stretched. Task-number: QTBUG-43801 Change-Id: I4902a9f5e29299761e3c2c5c6d6d80ee1dea1a25 Reviewed-by: Tor Arne Vestbø --- src/gui/text/qtextengine.cpp | 9 +++++++++ src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm | 5 ++++- 2 files changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index d156124b98..8f60847250 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1237,6 +1237,15 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, const ushort *st } #ifdef Q_OS_MAC + // CTRunGetPosition has a bug which applies matrix on 10.6, so we disable + // scaling the advances for this particular version + if (actualFontEngine->fontDef.stretch != 100 + && QSysInfo::MacintoshVersion != QSysInfo::MV_10_6) { + QFixed stretch = QFixed(actualFontEngine->fontDef.stretch) / QFixed(100); + for (uint i = 0; i < num_glyphs; ++i) + g.advances[i] *= stretch; + } + if (actualFontEngine->fontDef.styleStrategy & QFont::ForceIntegerMetrics) { for (uint i = 0; i < num_glyphs; ++i) g.advances[i] = g.advances[i].round(); diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm index 5a6c5de0b4..fe408305e0 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm @@ -370,6 +370,8 @@ void QCoreTextFontDatabase::releaseHandle(void *handle) CFRelease(CTFontDescriptorRef(handle)); } +extern CGAffineTransform qt_transform_from_fontdef(const QFontDef &fontDef); + QFontEngine *QCoreTextFontDatabase::fontEngine(const QFontDef &f, void *usrPtr) { qreal scaledPointSize = f.pixelSize; @@ -384,7 +386,8 @@ QFontEngine *QCoreTextFontDatabase::fontEngine(const QFontDef &f, void *usrPtr) scaledPointSize = f.pointSize; CTFontDescriptorRef descriptor = (CTFontDescriptorRef) usrPtr; - CTFontRef font = CTFontCreateWithFontDescriptor(descriptor, scaledPointSize, NULL); + CGAffineTransform matrix = qt_transform_from_fontdef(f); + CTFontRef font = CTFontCreateWithFontDescriptor(descriptor, scaledPointSize, &matrix); if (font) { QFontEngine *engine = new QCoreTextFontEngine(font, f); engine->fontDef = f; -- cgit v1.2.3 From 06602f9c96e9ea07851fa1d8a43b9792a825c4cd Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 22 Jan 2015 10:48:39 +0100 Subject: Android: Don't force-include android-9 headers in qpa plugin When we supported platforms < android-9, we needed to include some headers which were introduced in android-9 to compile the QPA plugin. This is no longer needed, and also creates problems when you pick e.g. android-21 as your platform, since some definitions (specifically fd_set) are different in the two sets of headers, giving us an undefined reference to QEventDispatcherUNIX::select(). Change-Id: Ifd28479b4bf3be0e9e62200a01fc4cf2cc855215 Reviewed-by: BogDan Vatra --- src/plugins/platforms/android/android.pro | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/android/android.pro b/src/plugins/platforms/android/android.pro index 3c3a4b4b2e..e6f4db0e94 100644 --- a/src/plugins/platforms/android/android.pro +++ b/src/plugins/platforms/android/android.pro @@ -8,12 +8,7 @@ DEFINES += QT_STATICPLUGIN load(qt_plugin) -!contains(ANDROID_PLATFORM, android-9) { - INCLUDEPATH += $$NDK_ROOT/platforms/android-9/arch-$$ANDROID_ARCHITECTURE/usr/include - LIBS += -L$$NDK_ROOT/platforms/android-9/arch-$$ANDROID_ARCHITECTURE/usr/lib -ljnigraphics -landroid -} else { - LIBS += -ljnigraphics -landroid -} +LIBS += -ljnigraphics -landroid QT += core-private gui-private platformsupport-private -- cgit v1.2.3 From db853fa75dc6598b30ce512997fc8bad0a37354f Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 22 Jan 2015 10:52:33 +0100 Subject: Android: Fix name of header in .pro file Gets rid of warning that the file is missing, but probably doesn't have any other effect since the file in question does not require moc-ing. Change-Id: I22085a55c212b6285341d61462dfaf548787e11c Reviewed-by: BogDan Vatra --- src/plugins/platforms/android/android.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/android/android.pro b/src/plugins/platforms/android/android.pro index e6f4db0e94..3ba817bf5b 100644 --- a/src/plugins/platforms/android/android.pro +++ b/src/plugins/platforms/android/android.pro @@ -49,7 +49,7 @@ SOURCES += $$PWD/androidplatformplugin.cpp \ $$PWD/qandroideventdispatcher.cpp HEADERS += $$PWD/qandroidplatformintegration.h \ - $$PWD/androidandroiddeadlockprotector.h \ + $$PWD/androiddeadlockprotector.h \ $$PWD/androidjnimain.h \ $$PWD/androidjniaccessibility.h \ $$PWD/androidjniinput.h \ -- cgit v1.2.3 From 2f097d4e239938f2ef752f416066ff5a1f1954a4 Mon Sep 17 00:00:00 2001 From: David Faure Date: Tue, 6 Jan 2015 12:18:00 +0100 Subject: Doc: fix copy/paste error in QTextCharFormat::setFont documentation Change-Id: I2190975762c6283daa004b754da607829d263b0a Reviewed-by: Konstantin Ritt --- src/gui/text/qtextformat.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index ecd87188e7..fa294e44fd 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -1904,7 +1904,7 @@ void QTextCharFormat::setFont(const QFont &font) If \a behavior is QTextCharFormat::FontPropertiesAll, the font property that has not been explicitly set is treated like as it were set with default value; - If \a behavior is QTextCharFormat::FontPropertiesAll, the font property that + If \a behavior is QTextCharFormat::FontPropertiesSpecifiedOnly, the font property that has not been explicitly set is ignored and the respective property value remains unchanged. -- cgit v1.2.3 From 416c09920544b12e24813e53aa6dbe8ed87e111e Mon Sep 17 00:00:00 2001 From: David Faure Date: Thu, 15 Jan 2015 13:20:29 +0100 Subject: Doc: remove wrong note in QTreeWidget::itemWidget. The note is already in setItemWidget where it makes sense. This looks like a copy/paste error; this method doesn't change anything in terms of ownership, it's a getter. Change-Id: Idc963787b81f53fb37bbe59e9bf35f47d3441b34 Reviewed-by: Jarek Kobus --- src/widgets/itemviews/qtreewidget.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp index 0a4e57812a..7378b9979a 100644 --- a/src/widgets/itemviews/qtreewidget.cpp +++ b/src/widgets/itemviews/qtreewidget.cpp @@ -2934,8 +2934,6 @@ void QTreeWidget::closePersistentEditor(QTreeWidgetItem *item, int column) Returns the widget displayed in the cell specified by \a item and the given \a column. - \note The tree takes ownership of the widget. - */ QWidget *QTreeWidget::itemWidget(QTreeWidgetItem *item, int column) const { -- cgit v1.2.3 From 2b5df245d6cdbfb3150ee815debccf655af8f19f Mon Sep 17 00:00:00 2001 From: Andreas Holzammer Date: Tue, 20 Jan 2015 13:17:36 +0100 Subject: Implement Multitouch handling for WinCE Implemented handling of GID_DirectManipulation for WinCE. Derive touch information out of gesture event directmanipulation. Task-number: QTBUG-31216 Change-Id: I74e90f32d2384fc3550b47af0b72edf0292dea8f Reviewed-by: Friedemann Kleint --- .../platforms/windows/qtwindows_additional.h | 4 + src/plugins/platforms/windows/qtwindowsglobal.h | 3 + src/plugins/platforms/windows/qwindowscontext.cpp | 2 + .../platforms/windows/qwindowsmousehandler.cpp | 86 +++++++++++++++++++++- .../platforms/windows/qwindowsmousehandler.h | 4 + src/plugins/platforms/windows/qwindowswindow.cpp | 4 + 6 files changed, 100 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qtwindows_additional.h b/src/plugins/platforms/windows/qtwindows_additional.h index 9451b9ce55..4e77350132 100644 --- a/src/plugins/platforms/windows/qtwindows_additional.h +++ b/src/plugins/platforms/windows/qtwindows_additional.h @@ -166,4 +166,8 @@ typedef TOUCHINPUT const * PCTOUCHINPUT; #endif // if defined(Q_CC_MINGW) || !defined(TOUCHEVENTF_MOVE) +#ifndef WM_GESTURE +# define WM_GESTURE 0x0119 +#endif + #endif // QTWINDOWS_ADDITIONAL_H diff --git a/src/plugins/platforms/windows/qtwindowsglobal.h b/src/plugins/platforms/windows/qtwindowsglobal.h index 90e6d6ab9d..083d82ed8c 100644 --- a/src/plugins/platforms/windows/qtwindowsglobal.h +++ b/src/plugins/platforms/windows/qtwindowsglobal.h @@ -109,6 +109,7 @@ enum WindowsEventType // Simplify event types DisplayChangedEvent = 437, SettingChangedEvent = DisplayChangedEvent + 1, ContextMenu = 123, + GestureEvent = 124, UnknownEvent = 542 }; @@ -247,6 +248,8 @@ inline QtWindows::WindowsEventType windowsEventType(UINT message, WPARAM wParamI case WM_APPCOMMAND: return QtWindows::AppCommandEvent; #endif + case WM_GESTURE: + return QtWindows::GestureEvent; default: break; } diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 2dab4f699f..1cc596ca8d 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -905,6 +905,8 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, return QWindowsInputContext::instance()->endComposition(hwnd); case QtWindows::InputMethodRequest: return QWindowsInputContext::instance()->handleIME_Request(wParam, lParam, result); + case QtWindows::GestureEvent: + return d->m_mouseHandler.translateTouchEvent(platformWindow->window(), hwnd, et, msg, result); case QtWindows::InputMethodOpenCandidateWindowEvent: case QtWindows::InputMethodCloseCandidateWindowEvent: // TODO: Release/regrab mouse if a popup has mouse grab. diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp index acb692579b..0fa34041d6 100644 --- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp +++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp @@ -422,11 +422,12 @@ bool QWindowsMouseHandler::translateMouseWheelEvent(QWindow *window, HWND, } // from bool QApplicationPrivate::translateTouchEvent() -bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND, +bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND hwnd, QtWindows::WindowsEventType, MSG msg, LRESULT *) { #ifndef Q_OS_WINCE + Q_UNUSED(hwnd); typedef QWindowSystemInterface::TouchPoint QTouchPoint; typedef QList QTouchPointList; @@ -495,8 +496,87 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND, m_touchDevice, touchPoints); return true; -#else - return false; +#else //Q_OS_WINCE + GESTUREINFO gi; + memset(&gi, 0, sizeof(GESTUREINFO)); + gi.cbSize = sizeof(GESTUREINFO); + + if (!GetGestureInfo((HGESTUREINFO)msg.lParam, &gi)) + return false; + + const QPoint position = QPoint(gi.ptsLocation.x, gi.ptsLocation.y); + + if (gi.dwID != GID_DIRECTMANIPULATION) + return true; + static QPoint lastTouchPos; + const QRect screenGeometry = window->screen()->geometry(); + QWindowSystemInterface::TouchPoint touchPoint; + static QWindowSystemInterface::TouchPoint touchPoint2; + touchPoint.id = 0;//gi.dwInstanceID; + touchPoint.pressure = 1.0; + + if (gi.dwFlags & GF_BEGIN) + touchPoint.state = Qt::TouchPointPressed; + else if (gi.dwFlags & GF_END) + touchPoint.state = Qt::TouchPointReleased; + else if (gi.dwFlags == 0) + touchPoint.state = Qt::TouchPointMoved; + else + return true; + touchPoint2.pressure = 1.0; + touchPoint2.id = 1; + const QPoint winEventPosition = position; + const int deltaX = GID_DIRECTMANIPULATION_DELTA_X(gi.ullArguments); + const int deltaY = GID_DIRECTMANIPULATION_DELTA_Y(gi.ullArguments); + //Touch points are taken from the whole screen so map the position to the screen + const QPoint globalPosition = QWindowsGeometryHint::mapToGlobal(hwnd, winEventPosition); + const QPoint globalPosition2 = QWindowsGeometryHint::mapToGlobal(hwnd, QPoint(position.x() + deltaX, position.y() + deltaY)); + + touchPoint.normalPosition = + QPointF( (qreal)globalPosition.x() / screenGeometry.width(), (qreal)globalPosition.y() / screenGeometry.height() ); + + touchPoint.area.moveCenter(globalPosition); + + QList pointList; + pointList.append(touchPoint); + if (deltaX != 0 && deltaY != 0) { + touchPoint2.state = m_had2ndTouchPoint ? Qt::TouchPointMoved : Qt::TouchPointPressed; + m_had2ndTouchPoint = true; + touchPoint2.normalPosition = + QPointF( (qreal)globalPosition2.x() / screenGeometry.width(), (qreal)globalPosition2.y() / screenGeometry.height() ); + + touchPoint2.area.moveCenter(globalPosition2); + lastTouchPos = globalPosition2; + pointList.append(touchPoint2); + } else if (m_had2ndTouchPoint) { + touchPoint2.normalPosition = + QPointF( (qreal)lastTouchPos.x() / screenGeometry.width(), (qreal)lastTouchPos.y() / screenGeometry.height() ); + + touchPoint2.area.moveCenter(lastTouchPos); + touchPoint2.state = Qt::TouchPointReleased; + pointList.append(touchPoint2); + m_had2ndTouchPoint = false; + } + + if (!m_touchDevice) { + m_touchDevice = new QTouchDevice; + // TODO: Device used to be hardcoded to screen in previous code. + m_touchDevice->setType(QTouchDevice::TouchScreen); + m_touchDevice->setCapabilities(QTouchDevice::Position | QTouchDevice::Area | QTouchDevice::NormalizedPosition); + QWindowSystemInterface::registerTouchDevice(m_touchDevice); + } + + QWindowSystemInterface::handleTouchEvent(window, m_touchDevice, pointList); + // handle window focusing in/out + if (window != m_windowUnderMouse) { + if (m_windowUnderMouse) + QWindowSystemInterface::handleLeaveEvent(m_windowUnderMouse); + if (window) + QWindowSystemInterface::handleEnterEvent(window); + m_windowUnderMouse = window; + } + + return true; #endif } diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.h b/src/plugins/platforms/windows/qwindowsmousehandler.h index 6491de93b5..60fe26b2b9 100644 --- a/src/plugins/platforms/windows/qwindowsmousehandler.h +++ b/src/plugins/platforms/windows/qwindowsmousehandler.h @@ -79,6 +79,10 @@ private: QTouchDevice *m_touchDevice; bool m_leftButtonDown; QWindow *m_previousCaptureWindow; +#ifdef Q_OS_WINCE +//This is required to send a touch up if we don't get a second touch position any more + bool m_had2ndTouchPoint; +#endif }; Qt::MouseButtons QWindowsMouseHandler::keyStateToMouseButtons(int wParam) diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index fbb61a1aff..2e5308f157 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -639,6 +639,10 @@ QWindowsWindowData context->frameX, context->frameY, context->frameWidth, context->frameHeight, parentHandle, NULL, appinst, NULL); +#ifdef Q_OS_WINCE + if (DisableGestures(result.hwnd, TGF_GID_ALL, TGF_SCOPE_WINDOW)) + EnableGestures(result.hwnd, TGF_GID_DIRECTMANIPULATION, TGF_SCOPE_WINDOW); +#endif qCDebug(lcQpaWindows).nospace() << "CreateWindowEx: returns " << w << ' ' << result.hwnd << " obtained geometry: " << context->obtainedGeometry << context->margins; -- cgit v1.2.3 From 03dc2b2e82750d1c531cf00a406368cde4a8928b Mon Sep 17 00:00:00 2001 From: Dmitry Shachnev Date: Sun, 11 Jan 2015 12:05:55 +0300 Subject: QSystemTrayIcon: handle submenus correctly This fixes a bug when submenus are shown as simple actions when a platform system tray icon is used. To correctly handle submenus, we need to set platform menus on all submenus, and only then on a parent menu. Change-Id: If2bfcc703b938dbb14ba4b9aa810039ced07e946 Reviewed-by: Friedemann Kleint Reviewed-by: Dimitrios Glentadakis Reviewed-by: Shawn Rutledge --- src/widgets/util/qsystemtrayicon.cpp | 28 +++++++++++++++++++++++----- src/widgets/util/qsystemtrayicon_p.h | 1 + 2 files changed, 24 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp index 7d04cab05e..d151e57d04 100644 --- a/src/widgets/util/qsystemtrayicon.cpp +++ b/src/widgets/util/qsystemtrayicon.cpp @@ -37,6 +37,7 @@ #ifndef QT_NO_SYSTEMTRAYICON #include "qmenu.h" +#include "qlist.h" #include "qevent.h" #include "qpoint.h" #include "qlabel.h" @@ -704,11 +705,7 @@ void QSystemTrayIconPrivate::updateIcon_sys_qpa() void QSystemTrayIconPrivate::updateMenu_sys_qpa() { if (menu) { - if (!menu->platformMenu()) { - QPlatformMenu *platformMenu = qpa_sys->createMenu(); - if (platformMenu) - menu->setPlatformMenu(platformMenu); - } + addPlatformMenu(menu); qpa_sys->updateMenu(menu->platformMenu()); } } @@ -741,6 +738,27 @@ void QSystemTrayIconPrivate::showMessage_sys_qpa(const QString &message, static_cast(icon), msecs); } +void QSystemTrayIconPrivate::addPlatformMenu(QMenu *menu) const +{ + if (menu->platformMenu()) + return; // The platform menu already exists. + + // The recursion depth is the same as menu depth, so should not + // be higher than 3 levels. + QListIterator it(menu->actions()); + while (it.hasNext()) { + QAction *action = it.next(); + if (action->menu()) + addPlatformMenu(action->menu()); + } + + // This menu should be processed *after* its children, otherwise + // setMenu() is not called on respective QPlatformMenuItems. + QPlatformMenu *platformMenu = qpa_sys->createMenu(); + if (platformMenu) + menu->setPlatformMenu(platformMenu); +} + QT_END_NAMESPACE #endif // QT_NO_SYSTEMTRAYICON diff --git a/src/widgets/util/qsystemtrayicon_p.h b/src/widgets/util/qsystemtrayicon_p.h index 0dda689c51..f05bf9e3f9 100644 --- a/src/widgets/util/qsystemtrayicon_p.h +++ b/src/widgets/util/qsystemtrayicon_p.h @@ -99,6 +99,7 @@ private: void updateMenu_sys_qpa(); QRect geometry_sys_qpa() const; void showMessage_sys_qpa(const QString &msg, const QString &title, QSystemTrayIcon::MessageIcon icon, int secs); + void addPlatformMenu(QMenu *menu) const; }; class QBalloonTip : public QWidget -- cgit v1.2.3 From 5b1da97b6b4a011f9ce5582869a7a957f6f1369c Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 21 Jan 2015 13:23:41 +0100 Subject: Revert "Fix font enumeration, with the same family name, on Windows." This reverts commit 8456adf0eeb9df8dd5f0547d4ad5a81888295f03. The change introduces a massive slowdown of the application startup caused by the inner enumeration. Task-number: QTBUG-43774 Task-number: QTBUG-40828 Change-Id: I694938eab93ea409d97537b55e8a025bb7a0e393 Reviewed-by: Konstantin Ritt --- .../platforms/windows/qwindowsfontdatabase.cpp | 36 ++-------------------- .../platforms/windows/qwindowsfontdatabase_ft.cpp | 36 ++-------------------- 2 files changed, 4 insertions(+), 68 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index f15783490e..246032dc94 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -964,31 +964,6 @@ static int QT_WIN_CALLBACK storeFont(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *textmetr return 1; } -static int QT_WIN_CALLBACK storeFontSub(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *textmetric, - int type, LPARAM namesSetIn) -{ - Q_UNUSED(textmetric) - Q_UNUSED(type) - - HDC dummy = GetDC(0); - LOGFONT lf; - lf.lfCharSet = DEFAULT_CHARSET; - if (wcslen(f->elfLogFont.lfFaceName) >= LF_FACESIZE) { - qWarning("%s: Unable to enumerate family '%s'.", - __FUNCTION__, qPrintable(QString::fromWCharArray(f->elfLogFont.lfFaceName))); - return 1; - } - wmemcpy(lf.lfFaceName, f->elfLogFont.lfFaceName, - wcslen(f->elfLogFont.lfFaceName) + 1); - lf.lfPitchAndFamily = 0; - EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFont, - (LPARAM)namesSetIn, 0); - ReleaseDC(0, dummy); - - // keep on enumerating - return 1; -} - void QWindowsFontDatabase::populateFontDatabase() { m_families.clear(); @@ -1024,15 +999,8 @@ void QWindowsFontDatabase::populate(const QString &family) wmemcpy(lf.lfFaceName, reinterpret_cast(family.utf16()), family.size() + 1); lf.lfPitchAndFamily = 0; - - if (family.isEmpty()) { - EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFontSub, - (LPARAM)&m_families, 0); - } else { - EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFont, - (LPARAM)&m_families, 0); - } - + EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFont, + (LPARAM)&m_families, 0); ReleaseDC(0, dummy); } diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp index 42e5a8c6ad..0fc5e0dc0c 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp @@ -375,31 +375,6 @@ static int QT_WIN_CALLBACK storeFont(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *textmetr return 1; } -static int QT_WIN_CALLBACK storeFontSub(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *textmetric, - int type, LPARAM namesSetIn) -{ - Q_UNUSED(textmetric) - Q_UNUSED(type) - - HDC dummy = GetDC(0); - LOGFONT lf; - lf.lfCharSet = DEFAULT_CHARSET; - if (wcslen(f->elfLogFont.lfFaceName) >= LF_FACESIZE) { - qWarning("%s: Unable to enumerate family '%s'.", - __FUNCTION__, qPrintable(QString::fromWCharArray(f->elfLogFont.lfFaceName))); - return 1; - } - wmemcpy(lf.lfFaceName, f->elfLogFont.lfFaceName, - wcslen(f->elfLogFont.lfFaceName) + 1); - lf.lfPitchAndFamily = 0; - EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFont, - (LPARAM)namesSetIn, 0); - ReleaseDC(0, dummy); - - // keep on enumerating - return 1; -} - void QWindowsFontDatabaseFT::populateFontDatabase() { m_families.clear(); @@ -434,15 +409,8 @@ void QWindowsFontDatabaseFT::populate(const QString &family) wmemcpy(lf.lfFaceName, reinterpret_cast(family.utf16()), family.size() + 1); lf.lfPitchAndFamily = 0; - - if (family.isEmpty()) { - EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFontSub, - (LPARAM)&m_families, 0); - } else { - EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFont, - (LPARAM)&m_families, 0); - } - + EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFont, + (LPARAM)&m_families, 0); ReleaseDC(0, dummy); } -- cgit v1.2.3 From 906577c8b0045724b9b961926085e933c8e0d339 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Tue, 9 Dec 2014 15:10:09 +0100 Subject: Enter/Return should cause an edit inside an itemview on OS X This was available before but was protected with the wrong define for OS X, so this is changed to the right define. Task-number: QTBUG-23696 QTBUG-23703 Change-Id: I669a6cf2ff7c01020693adff9f04a4b8b9404d02 Reviewed-by: David Faure --- src/widgets/itemviews/qabstractitemview.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index 0f346a9682..9b8c19df6d 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -2388,7 +2388,7 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) } #endif break; -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC case Qt::Key_Enter: case Qt::Key_Return: // Propagate the enter if you couldn't edit the item and there are no @@ -2418,7 +2418,7 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) selectAll(); break; } -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC if (event->key() == Qt::Key_O && event->modifiers() & Qt::ControlModifier && currentIndex().isValid()) { emit activated(currentIndex()); break; -- cgit v1.2.3 From ff59d73ac6e964212b5e3ff16a30e88e828f01b2 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Mon, 19 Jan 2015 19:02:38 +0400 Subject: Fix typo in the docs QEvent::ChildRemoved appeared twice. Change-Id: Ibd992f18d073a3ba47ab515368d2050d29e8c0e6 Reviewed-by: Oswald Buddenhagen --- src/corelib/kernel/qcoreevent.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp index 191ceaa37b..85b7f51bd6 100644 --- a/src/corelib/kernel/qcoreevent.cpp +++ b/src/corelib/kernel/qcoreevent.cpp @@ -538,7 +538,7 @@ QTimerEvent::~QTimerEvent() \a child. \a type can be QEvent::ChildAdded, QEvent::ChildRemoved, - QEvent::ChildPolished, or QEvent::ChildRemoved. + or QEvent::ChildPolished. \sa child() */ -- cgit v1.2.3 From 83097588797c5d0d549d70621b6f5158dfd3fac7 Mon Sep 17 00:00:00 2001 From: Maks Naumov Date: Mon, 19 Jan 2015 18:18:30 +0200 Subject: QTextCharFormat: fix word spacing setup Properly check QFont::WordSpacingResolved when use setFont() with QTextCharFormat::FontPropertiesSpecifiedOnly Change-Id: I72f1641ef7587cbaf8fcf5fef2f3c44393b0ebfc Reviewed-by: Konstantin Ritt --- src/gui/text/qtextformat.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index fa294e44fd..0bffbcc802 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -1942,7 +1942,7 @@ void QTextCharFormat::setFont(const QFont &font, FontPropertiesInheritanceBehavi setFontFixedPitch(font.fixedPitch()); if (mask & QFont::CapitalizationResolved) setFontCapitalization(font.capitalization()); - if (mask & QFont::LetterSpacingResolved) + if (mask & QFont::WordSpacingResolved) setFontWordSpacing(font.wordSpacing()); if (mask & QFont::LetterSpacingResolved) { setFontLetterSpacingType(font.letterSpacingType()); -- cgit v1.2.3 From 3527fd62c2705a0292458dd751d9d7f8d4be357f Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 18 Jan 2015 21:47:40 +0100 Subject: src/gui/painting/painting.pri: add missing qfixed_p.h Change-Id: Iba176345ec9448c936cd89b06ea24272df94fc1f Reviewed-by: Olivier Goffart (Woboq GmbH) Reviewed-by: Thiago Macieira --- src/gui/painting/painting.pri | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index a5a395cce2..579c0bc2a9 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -13,6 +13,7 @@ HEADERS += \ painting/qdrawhelper_x86_p.h \ painting/qdrawingprimitive_sse2_p.h \ painting/qemulationpaintengine_p.h \ + painting/qfixed_p.h \ painting/qgrayraster_p.h \ painting/qmatrix.h \ painting/qmemrotate_p.h \ -- cgit v1.2.3 From 817800ad39df10ca78e2c965a61d4d2025df622b Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Mon, 22 Dec 2014 21:19:27 -0200 Subject: Fix QXmlStreamReader parsing of files containing NULs Due to a flaw in the internal API, QXmlStreamReader's internal buffering would mistake a NUL byte in the input stream for EOF during parsing, but wouldn't set atEnd == true because it hadn't yet processed all bytes. This resulted in an infinite loop in QXmlStreamReaderPrivate::parse. So, instead of returning zero (false) to indicate EOF, return -1 (but in unsigned form, ~0, to avoid ICC warnings of change of sign). In turn, this required enlarging a few variables to avoid ~0U becoming 0xffff, which is a valid QChar (could happen if the input is a QString, not a QIODevice). Task-number: QTBUG-43513 Change-Id: If5badcfd3e4176b79517da1fd108e0abb93a3fd1 Reviewed-by: Lars Knoll Reviewed-by: Oswald Buddenhagen --- src/corelib/xml/qxmlstream.cpp | 41 ++++++++++++++++++++++------------------- src/corelib/xml/qxmlstream_p.h | 12 ++++++------ 2 files changed, 28 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp index 94f6a8bcde..d1698b812f 100644 --- a/src/corelib/xml/qxmlstream.cpp +++ b/src/corelib/xml/qxmlstream.cpp @@ -64,6 +64,8 @@ QT_BEGIN_NAMESPACE #include "qxmlstream_p.h" +enum { StreamEOF = ~0U }; + /*! \enum QXmlStreamReader::TokenType @@ -903,7 +905,7 @@ inline uint QXmlStreamReaderPrivate::filterCarriageReturn() ++readBufferPos; return peekc; } - if (peekc == 0) { + if (peekc == StreamEOF) { putChar('\r'); return 0; } @@ -912,13 +914,13 @@ inline uint QXmlStreamReaderPrivate::filterCarriageReturn() /*! \internal - If the end of the file is encountered, 0 is returned. + If the end of the file is encountered, ~0 is returned. */ inline uint QXmlStreamReaderPrivate::getChar() { uint c; if (putStack.size()) { - c = atEnd ? 0 : putStack.pop(); + c = atEnd ? StreamEOF : putStack.pop(); } else { if (readBufferPos < readBuffer.size()) c = readBuffer.at(readBufferPos++).unicode(); @@ -937,7 +939,7 @@ inline uint QXmlStreamReaderPrivate::peekChar() } else if (readBufferPos < readBuffer.size()) { c = readBuffer.at(readBufferPos).unicode(); } else { - if ((c = getChar_helper())) + if ((c = getChar_helper()) != StreamEOF) --readBufferPos; } @@ -961,7 +963,8 @@ bool QXmlStreamReaderPrivate::scanUntil(const char *str, short tokenToInject) int pos = textBuffer.size(); int oldLineNumber = lineNumber; - while (uint c = getChar()) { + uint c; + while ((c = getChar()) != StreamEOF) { /* First, we do the validation & normalization. */ switch (c) { case '\r': @@ -1007,9 +1010,9 @@ bool QXmlStreamReaderPrivate::scanString(const char *str, short tokenToInject, b { int n = 0; while (str[n]) { - ushort c = getChar(); + uint c = getChar(); if (c != ushort(str[n])) { - if (c) + if (c != StreamEOF) putChar(c); while (n--) { putChar(ushort(str[n])); @@ -1137,7 +1140,7 @@ inline int QXmlStreamReaderPrivate::fastScanLiteralContent() { int n = 0; uint c; - while ((c = getChar())) { + while ((c = getChar()) != StreamEOF) { switch (ushort(c)) { case 0xfffe: case 0xffff: @@ -1182,8 +1185,8 @@ inline int QXmlStreamReaderPrivate::fastScanLiteralContent() inline int QXmlStreamReaderPrivate::fastScanSpace() { int n = 0; - ushort c; - while ((c = getChar())) { + uint c; + while ((c = getChar()) != StreamEOF) { switch (c) { case '\r': if ((c = filterCarriageReturn()) == 0) @@ -1216,7 +1219,7 @@ inline int QXmlStreamReaderPrivate::fastScanContentCharList() { int n = 0; uint c; - while ((c = getChar())) { + while ((c = getChar()) != StreamEOF) { switch (ushort(c)) { case 0xfffe: case 0xffff: @@ -1279,8 +1282,8 @@ inline int QXmlStreamReaderPrivate::fastScanContentCharList() inline int QXmlStreamReaderPrivate::fastScanName(int *prefix) { int n = 0; - ushort c; - while ((c = getChar())) { + uint c; + while ((c = getChar()) != StreamEOF) { switch (c) { case '\n': case ' ': @@ -1396,7 +1399,7 @@ inline int QXmlStreamReaderPrivate::fastScanNMTOKEN() { int n = 0; uint c; - while ((c = getChar())) { + while ((c = getChar()) != StreamEOF) { if (fastDetermineNameChar(c) == NotName) { putChar(c); return n; @@ -1452,7 +1455,7 @@ void QXmlStreamReaderPrivate::putReplacementInAttributeValue(const QString &s) } } -ushort QXmlStreamReaderPrivate::getChar_helper() +uint QXmlStreamReaderPrivate::getChar_helper() { const int BUFFER_SIZE = 8192; characterOffset += readBufferPos; @@ -1476,7 +1479,7 @@ ushort QXmlStreamReaderPrivate::getChar_helper() } if (!nbytesread) { atEnd = true; - return 0; + return StreamEOF; } #ifndef QT_NO_TEXTCODEC @@ -1484,7 +1487,7 @@ ushort QXmlStreamReaderPrivate::getChar_helper() if (nbytesread < 4) { // the 4 is to cover 0xef 0xbb 0xbf plus // one extra for the utf8 codec atEnd = true; - return 0; + return StreamEOF; } int mib = 106; // UTF-8 @@ -1517,7 +1520,7 @@ ushort QXmlStreamReaderPrivate::getChar_helper() if(lockEncoding && decoder->hasFailure()) { raiseWellFormedError(QXmlStream::tr("Encountered incorrectly encoded content.")); readBuffer.clear(); - return 0; + return StreamEOF; } #else readBuffer = QString::fromLatin1(rawReadBuffer.data(), nbytesread); @@ -1531,7 +1534,7 @@ ushort QXmlStreamReaderPrivate::getChar_helper() } atEnd = true; - return 0; + return StreamEOF; } QStringRef QXmlStreamReaderPrivate::namespaceForPrefix(const QStringRef &prefix) diff --git a/src/corelib/xml/qxmlstream_p.h b/src/corelib/xml/qxmlstream_p.h index 7ff65e1718..087d64fce8 100644 --- a/src/corelib/xml/qxmlstream_p.h +++ b/src/corelib/xml/qxmlstream_p.h @@ -944,7 +944,7 @@ public: short token; - ushort token_char; + uint token_char; uint filterCarriageReturn(); inline uint getChar(); @@ -955,7 +955,7 @@ public: void putStringLiteral(const QString &s); void putReplacement(const QString &s); void putReplacementInAttributeValue(const QString &s); - ushort getChar_helper(); + uint getChar_helper(); bool scanUntil(const char *str, short tokenToInject = -1); bool scanString(const char *str, short tokenToInject, bool requireSpace = true); @@ -1068,7 +1068,7 @@ bool QXmlStreamReaderPrivate::parse() documentVersion.clear(); documentEncoding.clear(); #ifndef QT_NO_TEXTCODEC - if (decoder->hasFailure()) { + if (decoder && decoder->hasFailure()) { raiseWellFormedError(QXmlStream::tr("Encountered incorrectly encoded content.")); readBuffer.clear(); return false; @@ -1099,8 +1099,8 @@ bool QXmlStreamReaderPrivate::parse() if (token == -1 && - TERMINAL_COUNT != action_index[act]) { uint cu = getChar(); token = NOTOKEN; - token_char = cu; - if (cu & 0xff0000) { + token_char = cu == ~0U ? cu : ushort(cu); + if ((cu != ~0U) && (cu & 0xff0000)) { token = cu >> 16; } else switch (token_char) { case 0xfffe: @@ -1119,7 +1119,7 @@ bool QXmlStreamReaderPrivate::parse() break; } // fall through - case '\0': { + case ~0U: { token = EOF_SYMBOL; if (!tagsDone && !inParseEntity) { int a = t_action(act, token); -- cgit v1.2.3 From 44ab91aaa131c5a2c398cf30a97046578150db38 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 26 Jan 2015 19:40:35 +0100 Subject: Windows/ANGLE: Fix initialization of contexts. Immediately try to initialize a context obtained by eglGetPlatformDisplayEXT() and clear display in case it fails, falling back to eglGetDisplay(). Change-Id: Ia6c1c6da4daff6651153c854eda4fb8749bdc526 Reviewed-by: Laszlo Agocs --- src/plugins/platforms/windows/qwindowseglcontext.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowseglcontext.cpp b/src/plugins/platforms/windows/qwindowseglcontext.cpp index bde0503ee0..7f0421ad90 100644 --- a/src/plugins/platforms/windows/qwindowseglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowseglcontext.cpp @@ -358,6 +358,8 @@ QWindowsEGLStaticContext *QWindowsEGLStaticContext::create(QWindowsOpenGLTester: } EGLDisplay display = EGL_NO_DISPLAY; + EGLint major = 0; + EGLint minor = 0; #ifdef EGL_ANGLE_platform_angle_opengl if (libEGL.eglGetPlatformDisplayEXT && (preferredType & QWindowsOpenGLTester::AngleBackendMask)) { @@ -373,8 +375,13 @@ QWindowsEGLStaticContext *QWindowsEGLStaticContext::create(QWindowsOpenGLTester: attributes = anglePlatformAttributes[1]; else if (preferredType & QWindowsOpenGLTester::AngleRendererD3d11Warp) attributes = anglePlatformAttributes[2]; - if (attributes) + if (attributes) { display = libEGL.eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, dc, attributes); + if (!libEGL.eglInitialize(display, &major, &minor)) { + display = EGL_NO_DISPLAY; + major = minor = 0; + } + } } #else // EGL_ANGLE_platform_angle_opengl Q_UNUSED(preferredType) @@ -386,9 +393,7 @@ QWindowsEGLStaticContext *QWindowsEGLStaticContext::create(QWindowsOpenGLTester: return 0; } - EGLint major; - EGLint minor; - if (!libEGL.eglInitialize(display, &major, &minor)) { + if (!major && !libEGL.eglInitialize(display, &major, &minor)) { int err = libEGL.eglGetError(); qWarning("%s: Could not initialize EGL display: error 0x%x\n", Q_FUNC_INFO, err); if (err == 0x3001) -- cgit v1.2.3 From 2e2df81537429e78ff65be33a328e7ee7f480a88 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Wed, 21 Jan 2015 14:36:02 +0100 Subject: Only use Xft font settings as defaults, and let fontconfig override On a GNOME or UNITY desktop, Qt will currently read font-settings from Xft and use those ignoring any fontconfig instructions. This patch changes the behavior so the Xft settings are only used as default, but any explicit overrides by fontconfig will take precedence. Task-number: QTBUG-43660 Change-Id: Ie10d5828cbfdd95fe5364c63a625d455d9213936 Reviewed-by: Konstantin Ritt Reviewed-by: Eskil Abrahamsen Blomfeldt --- .../fontconfig/qfontconfigdatabase.cpp | 76 +++++++++++----------- 1 file changed, 38 insertions(+), 38 deletions(-) (limited to 'src') diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp index 27ff33be86..e7b03e9651 100644 --- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp +++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp @@ -526,6 +526,23 @@ QFontEngine::HintStyle defaultHintStyleFromMatch(QFont::HintingPreference hintin return QFontEngine::HintNone; } + int hint_style = 0; + if (FcPatternGetInteger (match, FC_HINT_STYLE, 0, &hint_style) == FcResultMatch) { + switch (hint_style) { + case FC_HINT_NONE: + return QFontEngine::HintNone; + case FC_HINT_SLIGHT: + return QFontEngine::HintLight; + case FC_HINT_MEDIUM: + return QFontEngine::HintMedium; + case FC_HINT_FULL: + return QFontEngine::HintFull; + default: + Q_UNREACHABLE(); + break; + } + } + if (useXftConf) { void *hintStyleResource = QGuiApplication::platformNativeInterface()->nativeResourceForScreen("hintstyle", @@ -535,27 +552,31 @@ QFontEngine::HintStyle defaultHintStyleFromMatch(QFont::HintingPreference hintin return QFontEngine::HintStyle(hintStyle - 1); } - int hint_style = 0; - if (FcPatternGetInteger (match, FC_HINT_STYLE, 0, &hint_style) == FcResultNoMatch) - hint_style = FC_HINT_FULL; - switch (hint_style) { - case FC_HINT_NONE: - return QFontEngine::HintNone; - case FC_HINT_SLIGHT: - return QFontEngine::HintLight; - case FC_HINT_MEDIUM: - return QFontEngine::HintMedium; - case FC_HINT_FULL: - return QFontEngine::HintFull; - default: - Q_UNREACHABLE(); - break; - } return QFontEngine::HintFull; } QFontEngine::SubpixelAntialiasingType subpixelTypeFromMatch(FcPattern *match, bool useXftConf) { + int subpixel = FC_RGBA_UNKNOWN; + if (FcPatternGetInteger(match, FC_RGBA, 0, &subpixel) == FcResultMatch) { + switch (subpixel) { + case FC_RGBA_UNKNOWN: + case FC_RGBA_NONE: + return QFontEngine::Subpixel_None; + case FC_RGBA_RGB: + return QFontEngine::Subpixel_RGB; + case FC_RGBA_BGR: + return QFontEngine::Subpixel_BGR; + case FC_RGBA_VRGB: + return QFontEngine::Subpixel_VRGB; + case FC_RGBA_VBGR: + return QFontEngine::Subpixel_VBGR; + default: + Q_UNREACHABLE(); + break; + } + } + if (useXftConf) { void *subpixelTypeResource = QGuiApplication::platformNativeInterface()->nativeResourceForScreen("subpixeltype", @@ -565,25 +586,6 @@ QFontEngine::SubpixelAntialiasingType subpixelTypeFromMatch(FcPattern *match, bo return QFontEngine::SubpixelAntialiasingType(subpixelType - 1); } - int subpixel = FC_RGBA_UNKNOWN; - FcPatternGetInteger(match, FC_RGBA, 0, &subpixel); - - switch (subpixel) { - case FC_RGBA_UNKNOWN: - case FC_RGBA_NONE: - return QFontEngine::Subpixel_None; - case FC_RGBA_RGB: - return QFontEngine::Subpixel_RGB; - case FC_RGBA_BGR: - return QFontEngine::Subpixel_BGR; - case FC_RGBA_VRGB: - return QFontEngine::Subpixel_VRGB; - case FC_RGBA_VBGR: - return QFontEngine::Subpixel_VBGR; - default: - Q_UNREACHABLE(); - break; - } return QFontEngine::Subpixel_None; } } // namespace @@ -823,10 +825,8 @@ void QFontconfigDatabase::setupFontEngine(QFontEngineFT *engine, const QFontDef QGuiApplication::platformNativeInterface()->nativeResourceForScreen("antialiasingEnabled", QGuiApplication::primaryScreen()); int antialiasingEnabled = int(reinterpret_cast(antialiasResource)); - if (antialiasingEnabled > 0) { + if (antialiasingEnabled > 0) antialias = antialiasingEnabled - 1; - forcedAntialiasSetting = true; - } } QFontEngine::GlyphFormat format; -- cgit v1.2.3 From f8c8c79029867a087c9a753269d82b808c16f047 Mon Sep 17 00:00:00 2001 From: Stephan Binner Date: Mon, 2 Feb 2015 13:10:50 +0100 Subject: Fix build of egl integration Add missing includes and reorder includes to avoid X defines breakage Change-Id: Iaf95ae2488df3d3301436262ed79f7091b4be0a9 Reviewed-by: Laszlo Agocs --- .../eglconvenience/qeglplatformcontext_p.h | 1 + .../eglconvenience/qeglplatformintegration_p.h | 2 +- src/plugins/platforms/eglfs/qeglfscontext.cpp | 13 +++++++------ src/plugins/platforms/eglfs/qeglfshooks_stub.cpp | 2 +- src/plugins/platforms/eglfs/qeglfsintegration.cpp | 20 ++++++++++---------- src/plugins/platforms/eglfs/qeglfsscreen.cpp | 4 +++- src/plugins/platforms/eglfs/qeglfswindow.cpp | 6 ++++-- .../platforms/minimalegl/qminimaleglwindow.cpp | 4 ++-- 8 files changed, 29 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/platformsupport/eglconvenience/qeglplatformcontext_p.h b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h index 7825c7b3d7..0c10710304 100644 --- a/src/platformsupport/eglconvenience/qeglplatformcontext_p.h +++ b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h @@ -45,6 +45,7 @@ // We mean it. // +#include #include #include #include diff --git a/src/platformsupport/eglconvenience/qeglplatformintegration_p.h b/src/platformsupport/eglconvenience/qeglplatformintegration_p.h index 4d7adce309..2b5d5f50fb 100644 --- a/src/platformsupport/eglconvenience/qeglplatformintegration_p.h +++ b/src/platformsupport/eglconvenience/qeglplatformintegration_p.h @@ -45,9 +45,9 @@ // We mean it. // +#include #include #include -#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/eglfs/qeglfscontext.cpp b/src/plugins/platforms/eglfs/qeglfscontext.cpp index 6216fa8575..6470280e2c 100644 --- a/src/plugins/platforms/eglfs/qeglfscontext.cpp +++ b/src/plugins/platforms/eglfs/qeglfscontext.cpp @@ -31,15 +31,16 @@ ** ****************************************************************************/ -#include "qeglfscontext.h" -#include "qeglfswindow.h" -#include "qeglfshooks.h" +#include +#include +#include #include #include -#include -#include -#include + +#include "qeglfswindow.h" +#include "qeglfshooks.h" +#include "qeglfscontext.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp index 26d77a2abb..120c603125 100644 --- a/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp +++ b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp @@ -31,10 +31,10 @@ ** ****************************************************************************/ -#include "qeglfshooks.h" #include #include #include +#include "qeglfshooks.h" #if defined(Q_OS_LINUX) #include diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp index 2a4eae3fe2..fbdd1d4c4d 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp @@ -31,26 +31,26 @@ ** ****************************************************************************/ -#include "qeglfsintegration.h" +#include +#include + +#include +#include +#include +#include +#include +#include +#include "qeglfsintegration.h" #include "qeglfswindow.h" #include "qeglfshooks.h" #include "qeglfscontext.h" -#include - #include #include #include #include -#include -#include -#include -#include -#include -#include - #include static void initResources() diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/qeglfsscreen.cpp index cd68540581..bc93fe28e7 100644 --- a/src/plugins/platforms/eglfs/qeglfsscreen.cpp +++ b/src/plugins/platforms/eglfs/qeglfsscreen.cpp @@ -31,10 +31,12 @@ ** ****************************************************************************/ +#include +#include + #include "qeglfsscreen.h" #include "qeglfswindow.h" #include "qeglfshooks.h" -#include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/eglfs/qeglfswindow.cpp b/src/plugins/platforms/eglfs/qeglfswindow.cpp index f5839e086d..39a3ef94e9 100644 --- a/src/plugins/platforms/eglfs/qeglfswindow.cpp +++ b/src/plugins/platforms/eglfs/qeglfswindow.cpp @@ -31,8 +31,7 @@ ** ****************************************************************************/ -#include "qeglfswindow.h" -#include "qeglfshooks.h" +#include #include #include #include @@ -40,6 +39,9 @@ #include #include +#include "qeglfswindow.h" +#include "qeglfshooks.h" + #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/minimalegl/qminimaleglwindow.cpp b/src/plugins/platforms/minimalegl/qminimaleglwindow.cpp index 906a1308da..d4bee2c9e4 100644 --- a/src/plugins/platforms/minimalegl/qminimaleglwindow.cpp +++ b/src/plugins/platforms/minimalegl/qminimaleglwindow.cpp @@ -31,10 +31,10 @@ ** ****************************************************************************/ -#include "qminimaleglwindow.h" - #include +#include "qminimaleglwindow.h" + QT_BEGIN_NAMESPACE QMinimalEglWindow::QMinimalEglWindow(QWindow *w) -- cgit v1.2.3 From 8cb611be7b9266c98a9ccb2175c90dc62d81194b Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Wed, 28 Jan 2015 10:05:45 +0100 Subject: Add some punctuation to QTextCursor's detailed description. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I3b3eab74888f283a9890321fadcae67c09c24b61 Reviewed-by: Topi Reiniö --- src/gui/text/qtextcursor.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp index 2e289e2bd8..b1205a8c85 100644 --- a/src/gui/text/qtextcursor.cpp +++ b/src/gui/text/qtextcursor.cpp @@ -910,8 +910,8 @@ QTextLayout *QTextCursorPrivate::blockLayout(QTextBlock &block) const{ select text. For selections see selectionStart(), selectionEnd(), hasSelection(), clearSelection(), and removeSelectedText(). - If the position() is at the start of a block atBlockStart() - returns \c true; and if it is at the end of a block atBlockEnd() returns + If the position() is at the start of a block, atBlockStart() + returns \c true; and if it is at the end of a block, atBlockEnd() returns true. The format of the current character is returned by charFormat(), and the format of the current block is returned by blockFormat(). @@ -921,9 +921,9 @@ QTextLayout *QTextCursorPrivate::blockLayout(QTextBlock &block) const{ mergeBlockFormat() functions. The 'set' functions will replace the cursor's current character or block format, while the 'merge' functions add the given format properties to the cursor's current - format. If the cursor has a selection the given format is applied - to the current selection. Note that when only parts of a block is - selected the block format is applied to the entire block. The text + format. If the cursor has a selection, the given format is applied + to the current selection. Note that when only a part of a block is + selected, the block format is applied to the entire block. The text at the current character position can be turned into a list using createList(). -- cgit v1.2.3 From ee973083cf52882b68ab0e4c067f637cef1dda3e Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 9 Oct 2014 01:28:20 +0200 Subject: uic: update sources from current generate_ui Change-Id: I3b64fa94bd5904feeed753d34e80f4fc0611725e Reviewed-by: Friedemann Kleint --- src/tools/uic/ui4.cpp | 127 ++++++++++++++++++++++++++------------------------ src/tools/uic/ui4.h | 2 +- 2 files changed, 66 insertions(+), 63 deletions(-) (limited to 'src') diff --git a/src/tools/uic/ui4.cpp b/src/tools/uic/ui4.cpp index 01b4437db7..d7b741b74b 100644 --- a/src/tools/uic/ui4.cpp +++ b/src/tools/uic/ui4.cpp @@ -30,6 +30,9 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + +// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT! + #include "ui4.h" @@ -380,7 +383,7 @@ void DomUI::setElementClass(const QString& a) m_class = a; } -DomWidget* DomUI::takeElementWidget() +DomWidget* DomUI::takeElementWidget() { DomWidget* a = m_widget; m_widget = 0; @@ -395,7 +398,7 @@ void DomUI::setElementWidget(DomWidget* a) m_widget = a; } -DomLayoutDefault* DomUI::takeElementLayoutDefault() +DomLayoutDefault* DomUI::takeElementLayoutDefault() { DomLayoutDefault* a = m_layoutDefault; m_layoutDefault = 0; @@ -410,7 +413,7 @@ void DomUI::setElementLayoutDefault(DomLayoutDefault* a) m_layoutDefault = a; } -DomLayoutFunction* DomUI::takeElementLayoutFunction() +DomLayoutFunction* DomUI::takeElementLayoutFunction() { DomLayoutFunction* a = m_layoutFunction; m_layoutFunction = 0; @@ -431,7 +434,7 @@ void DomUI::setElementPixmapFunction(const QString& a) m_pixmapFunction = a; } -DomCustomWidgets* DomUI::takeElementCustomWidgets() +DomCustomWidgets* DomUI::takeElementCustomWidgets() { DomCustomWidgets* a = m_customWidgets; m_customWidgets = 0; @@ -446,7 +449,7 @@ void DomUI::setElementCustomWidgets(DomCustomWidgets* a) m_customWidgets = a; } -DomTabStops* DomUI::takeElementTabStops() +DomTabStops* DomUI::takeElementTabStops() { DomTabStops* a = m_tabStops; m_tabStops = 0; @@ -461,7 +464,7 @@ void DomUI::setElementTabStops(DomTabStops* a) m_tabStops = a; } -DomImages* DomUI::takeElementImages() +DomImages* DomUI::takeElementImages() { DomImages* a = m_images; m_images = 0; @@ -476,7 +479,7 @@ void DomUI::setElementImages(DomImages* a) m_images = a; } -DomIncludes* DomUI::takeElementIncludes() +DomIncludes* DomUI::takeElementIncludes() { DomIncludes* a = m_includes; m_includes = 0; @@ -491,7 +494,7 @@ void DomUI::setElementIncludes(DomIncludes* a) m_includes = a; } -DomResources* DomUI::takeElementResources() +DomResources* DomUI::takeElementResources() { DomResources* a = m_resources; m_resources = 0; @@ -506,7 +509,7 @@ void DomUI::setElementResources(DomResources* a) m_resources = a; } -DomConnections* DomUI::takeElementConnections() +DomConnections* DomUI::takeElementConnections() { DomConnections* a = m_connections; m_connections = 0; @@ -521,7 +524,7 @@ void DomUI::setElementConnections(DomConnections* a) m_connections = a; } -DomDesignerData* DomUI::takeElementDesignerdata() +DomDesignerData* DomUI::takeElementDesignerdata() { DomDesignerData* a = m_designerdata; m_designerdata = 0; @@ -536,7 +539,7 @@ void DomUI::setElementDesignerdata(DomDesignerData* a) m_designerdata = a; } -DomSlots* DomUI::takeElementSlots() +DomSlots* DomUI::takeElementSlots() { DomSlots* a = m_slots; m_slots = 0; @@ -551,7 +554,7 @@ void DomUI::setElementSlots(DomSlots* a) m_slots = a; } -DomButtonGroups* DomUI::takeElementButtonGroups() +DomButtonGroups* DomUI::takeElementButtonGroups() { DomButtonGroups* a = m_buttonGroups; m_buttonGroups = 0; @@ -1632,7 +1635,7 @@ void DomImage::write(QXmlStreamWriter &writer, const QString &tagName) const writer.writeEndElement(); } -DomImageData* DomImage::takeElementData() +DomImageData* DomImage::takeElementData() { DomImageData* a = m_data; m_data = 0; @@ -2075,7 +2078,7 @@ void DomCustomWidget::setElementExtends(const QString& a) m_extends = a; } -DomHeader* DomCustomWidget::takeElementHeader() +DomHeader* DomCustomWidget::takeElementHeader() { DomHeader* a = m_header; m_header = 0; @@ -2090,7 +2093,7 @@ void DomCustomWidget::setElementHeader(DomHeader* a) m_header = a; } -DomSize* DomCustomWidget::takeElementSizeHint() +DomSize* DomCustomWidget::takeElementSizeHint() { DomSize* a = m_sizeHint; m_sizeHint = 0; @@ -2117,7 +2120,7 @@ void DomCustomWidget::setElementContainer(int a) m_container = a; } -DomSizePolicyData* DomCustomWidget::takeElementSizePolicy() +DomSizePolicyData* DomCustomWidget::takeElementSizePolicy() { DomSizePolicyData* a = m_sizePolicy; m_sizePolicy = 0; @@ -2138,7 +2141,7 @@ void DomCustomWidget::setElementPixmap(const QString& a) m_pixmap = a; } -DomScript* DomCustomWidget::takeElementScript() +DomScript* DomCustomWidget::takeElementScript() { DomScript* a = m_script; m_script = 0; @@ -2153,7 +2156,7 @@ void DomCustomWidget::setElementScript(DomScript* a) m_script = a; } -DomProperties* DomCustomWidget::takeElementProperties() +DomProperties* DomCustomWidget::takeElementProperties() { DomProperties* a = m_properties; m_properties = 0; @@ -2168,7 +2171,7 @@ void DomCustomWidget::setElementProperties(DomProperties* a) m_properties = a; } -DomSlots* DomCustomWidget::takeElementSlots() +DomSlots* DomCustomWidget::takeElementSlots() { DomSlots* a = m_slots; m_slots = 0; @@ -2183,7 +2186,7 @@ void DomCustomWidget::setElementSlots(DomSlots* a) m_slots = a; } -DomPropertySpecifications* DomCustomWidget::takeElementPropertyspecifications() +DomPropertySpecifications* DomCustomWidget::takeElementPropertyspecifications() { DomPropertySpecifications* a = m_propertyspecifications; m_propertyspecifications = 0; @@ -3073,7 +3076,7 @@ void DomLayoutItem::write(QXmlStreamWriter &writer, const QString &tagName) cons writer.writeEndElement(); } -DomWidget* DomLayoutItem::takeElementWidget() +DomWidget* DomLayoutItem::takeElementWidget() { DomWidget* a = m_widget; m_widget = 0; @@ -3087,7 +3090,7 @@ void DomLayoutItem::setElementWidget(DomWidget* a) m_widget = a; } -DomLayout* DomLayoutItem::takeElementLayout() +DomLayout* DomLayoutItem::takeElementLayout() { DomLayout* a = m_layout; m_layout = 0; @@ -3101,7 +3104,7 @@ void DomLayoutItem::setElementLayout(DomLayout* a) m_layout = a; } -DomSpacer* DomLayoutItem::takeElementSpacer() +DomSpacer* DomLayoutItem::takeElementSpacer() { DomSpacer* a = m_spacer; m_spacer = 0; @@ -4035,7 +4038,7 @@ void DomGradientStop::write(QXmlStreamWriter &writer, const QString &tagName) co writer.writeEndElement(); } -DomColor* DomGradientStop::takeElementColor() +DomColor* DomGradientStop::takeElementColor() { DomColor* a = m_color; m_color = 0; @@ -4394,7 +4397,7 @@ void DomBrush::write(QXmlStreamWriter &writer, const QString &tagName) const writer.writeEndElement(); } -DomColor* DomBrush::takeElementColor() +DomColor* DomBrush::takeElementColor() { DomColor* a = m_color; m_color = 0; @@ -4408,7 +4411,7 @@ void DomBrush::setElementColor(DomColor* a) m_color = a; } -DomProperty* DomBrush::takeElementTexture() +DomProperty* DomBrush::takeElementTexture() { DomProperty* a = m_texture; m_texture = 0; @@ -4422,7 +4425,7 @@ void DomBrush::setElementTexture(DomProperty* a) m_texture = a; } -DomGradient* DomBrush::takeElementGradient() +DomGradient* DomBrush::takeElementGradient() { DomGradient* a = m_gradient; m_gradient = 0; @@ -4516,7 +4519,7 @@ void DomColorRole::write(QXmlStreamWriter &writer, const QString &tagName) const writer.writeEndElement(); } -DomBrush* DomColorRole::takeElementBrush() +DomBrush* DomColorRole::takeElementBrush() { DomBrush* a = m_brush; m_brush = 0; @@ -4724,7 +4727,7 @@ void DomPalette::write(QXmlStreamWriter &writer, const QString &tagName) const writer.writeEndElement(); } -DomColorGroup* DomPalette::takeElementActive() +DomColorGroup* DomPalette::takeElementActive() { DomColorGroup* a = m_active; m_active = 0; @@ -4739,7 +4742,7 @@ void DomPalette::setElementActive(DomColorGroup* a) m_active = a; } -DomColorGroup* DomPalette::takeElementInactive() +DomColorGroup* DomPalette::takeElementInactive() { DomColorGroup* a = m_inactive; m_inactive = 0; @@ -4754,7 +4757,7 @@ void DomPalette::setElementInactive(DomColorGroup* a) m_inactive = a; } -DomColorGroup* DomPalette::takeElementDisabled() +DomColorGroup* DomPalette::takeElementDisabled() { DomColorGroup* a = m_disabled; m_disabled = 0; @@ -6378,7 +6381,7 @@ void DomResourceIcon::write(QXmlStreamWriter &writer, const QString &tagName) co writer.writeEndElement(); } -DomResourcePixmap* DomResourceIcon::takeElementNormalOff() +DomResourcePixmap* DomResourceIcon::takeElementNormalOff() { DomResourcePixmap* a = m_normalOff; m_normalOff = 0; @@ -6393,7 +6396,7 @@ void DomResourceIcon::setElementNormalOff(DomResourcePixmap* a) m_normalOff = a; } -DomResourcePixmap* DomResourceIcon::takeElementNormalOn() +DomResourcePixmap* DomResourceIcon::takeElementNormalOn() { DomResourcePixmap* a = m_normalOn; m_normalOn = 0; @@ -6408,7 +6411,7 @@ void DomResourceIcon::setElementNormalOn(DomResourcePixmap* a) m_normalOn = a; } -DomResourcePixmap* DomResourceIcon::takeElementDisabledOff() +DomResourcePixmap* DomResourceIcon::takeElementDisabledOff() { DomResourcePixmap* a = m_disabledOff; m_disabledOff = 0; @@ -6423,7 +6426,7 @@ void DomResourceIcon::setElementDisabledOff(DomResourcePixmap* a) m_disabledOff = a; } -DomResourcePixmap* DomResourceIcon::takeElementDisabledOn() +DomResourcePixmap* DomResourceIcon::takeElementDisabledOn() { DomResourcePixmap* a = m_disabledOn; m_disabledOn = 0; @@ -6438,7 +6441,7 @@ void DomResourceIcon::setElementDisabledOn(DomResourcePixmap* a) m_disabledOn = a; } -DomResourcePixmap* DomResourceIcon::takeElementActiveOff() +DomResourcePixmap* DomResourceIcon::takeElementActiveOff() { DomResourcePixmap* a = m_activeOff; m_activeOff = 0; @@ -6453,7 +6456,7 @@ void DomResourceIcon::setElementActiveOff(DomResourcePixmap* a) m_activeOff = a; } -DomResourcePixmap* DomResourceIcon::takeElementActiveOn() +DomResourcePixmap* DomResourceIcon::takeElementActiveOn() { DomResourcePixmap* a = m_activeOn; m_activeOn = 0; @@ -6468,7 +6471,7 @@ void DomResourceIcon::setElementActiveOn(DomResourcePixmap* a) m_activeOn = a; } -DomResourcePixmap* DomResourceIcon::takeElementSelectedOff() +DomResourcePixmap* DomResourceIcon::takeElementSelectedOff() { DomResourcePixmap* a = m_selectedOff; m_selectedOff = 0; @@ -6483,7 +6486,7 @@ void DomResourceIcon::setElementSelectedOff(DomResourcePixmap* a) m_selectedOff = a; } -DomResourcePixmap* DomResourceIcon::takeElementSelectedOn() +DomResourcePixmap* DomResourceIcon::takeElementSelectedOn() { DomResourcePixmap* a = m_selectedOn; m_selectedOn = 0; @@ -7102,7 +7105,7 @@ void DomUrl::write(QXmlStreamWriter &writer, const QString &tagName) const writer.writeEndElement(); } -DomString* DomUrl::takeElementString() +DomString* DomUrl::takeElementString() { DomString* a = m_string; m_string = 0; @@ -7681,7 +7684,7 @@ void DomProperty::setElementBool(const QString& a) m_bool = a; } -DomColor* DomProperty::takeElementColor() +DomColor* DomProperty::takeElementColor() { DomColor* a = m_color; m_color = 0; @@ -7723,7 +7726,7 @@ void DomProperty::setElementEnum(const QString& a) m_enum = a; } -DomFont* DomProperty::takeElementFont() +DomFont* DomProperty::takeElementFont() { DomFont* a = m_font; m_font = 0; @@ -7737,7 +7740,7 @@ void DomProperty::setElementFont(DomFont* a) m_font = a; } -DomResourceIcon* DomProperty::takeElementIconSet() +DomResourceIcon* DomProperty::takeElementIconSet() { DomResourceIcon* a = m_iconSet; m_iconSet = 0; @@ -7751,7 +7754,7 @@ void DomProperty::setElementIconSet(DomResourceIcon* a) m_iconSet = a; } -DomResourcePixmap* DomProperty::takeElementPixmap() +DomResourcePixmap* DomProperty::takeElementPixmap() { DomResourcePixmap* a = m_pixmap; m_pixmap = 0; @@ -7765,7 +7768,7 @@ void DomProperty::setElementPixmap(DomResourcePixmap* a) m_pixmap = a; } -DomPalette* DomProperty::takeElementPalette() +DomPalette* DomProperty::takeElementPalette() { DomPalette* a = m_palette; m_palette = 0; @@ -7779,7 +7782,7 @@ void DomProperty::setElementPalette(DomPalette* a) m_palette = a; } -DomPoint* DomProperty::takeElementPoint() +DomPoint* DomProperty::takeElementPoint() { DomPoint* a = m_point; m_point = 0; @@ -7793,7 +7796,7 @@ void DomProperty::setElementPoint(DomPoint* a) m_point = a; } -DomRect* DomProperty::takeElementRect() +DomRect* DomProperty::takeElementRect() { DomRect* a = m_rect; m_rect = 0; @@ -7814,7 +7817,7 @@ void DomProperty::setElementSet(const QString& a) m_set = a; } -DomLocale* DomProperty::takeElementLocale() +DomLocale* DomProperty::takeElementLocale() { DomLocale* a = m_locale; m_locale = 0; @@ -7828,7 +7831,7 @@ void DomProperty::setElementLocale(DomLocale* a) m_locale = a; } -DomSizePolicy* DomProperty::takeElementSizePolicy() +DomSizePolicy* DomProperty::takeElementSizePolicy() { DomSizePolicy* a = m_sizePolicy; m_sizePolicy = 0; @@ -7842,7 +7845,7 @@ void DomProperty::setElementSizePolicy(DomSizePolicy* a) m_sizePolicy = a; } -DomSize* DomProperty::takeElementSize() +DomSize* DomProperty::takeElementSize() { DomSize* a = m_size; m_size = 0; @@ -7856,7 +7859,7 @@ void DomProperty::setElementSize(DomSize* a) m_size = a; } -DomString* DomProperty::takeElementString() +DomString* DomProperty::takeElementString() { DomString* a = m_string; m_string = 0; @@ -7870,7 +7873,7 @@ void DomProperty::setElementString(DomString* a) m_string = a; } -DomStringList* DomProperty::takeElementStringList() +DomStringList* DomProperty::takeElementStringList() { DomStringList* a = m_stringList; m_stringList = 0; @@ -7905,7 +7908,7 @@ void DomProperty::setElementDouble(double a) m_double = a; } -DomDate* DomProperty::takeElementDate() +DomDate* DomProperty::takeElementDate() { DomDate* a = m_date; m_date = 0; @@ -7919,7 +7922,7 @@ void DomProperty::setElementDate(DomDate* a) m_date = a; } -DomTime* DomProperty::takeElementTime() +DomTime* DomProperty::takeElementTime() { DomTime* a = m_time; m_time = 0; @@ -7933,7 +7936,7 @@ void DomProperty::setElementTime(DomTime* a) m_time = a; } -DomDateTime* DomProperty::takeElementDateTime() +DomDateTime* DomProperty::takeElementDateTime() { DomDateTime* a = m_dateTime; m_dateTime = 0; @@ -7947,7 +7950,7 @@ void DomProperty::setElementDateTime(DomDateTime* a) m_dateTime = a; } -DomPointF* DomProperty::takeElementPointF() +DomPointF* DomProperty::takeElementPointF() { DomPointF* a = m_pointF; m_pointF = 0; @@ -7961,7 +7964,7 @@ void DomProperty::setElementPointF(DomPointF* a) m_pointF = a; } -DomRectF* DomProperty::takeElementRectF() +DomRectF* DomProperty::takeElementRectF() { DomRectF* a = m_rectF; m_rectF = 0; @@ -7975,7 +7978,7 @@ void DomProperty::setElementRectF(DomRectF* a) m_rectF = a; } -DomSizeF* DomProperty::takeElementSizeF() +DomSizeF* DomProperty::takeElementSizeF() { DomSizeF* a = m_sizeF; m_sizeF = 0; @@ -7996,7 +7999,7 @@ void DomProperty::setElementLongLong(qlonglong a) m_longLong = a; } -DomChar* DomProperty::takeElementChar() +DomChar* DomProperty::takeElementChar() { DomChar* a = m_char; m_char = 0; @@ -8010,7 +8013,7 @@ void DomProperty::setElementChar(DomChar* a) m_char = a; } -DomUrl* DomProperty::takeElementUrl() +DomUrl* DomProperty::takeElementUrl() { DomUrl* a = m_url; m_url = 0; @@ -8038,7 +8041,7 @@ void DomProperty::setElementULongLong(qulonglong a) m_uLongLong = a; } -DomBrush* DomProperty::takeElementBrush() +DomBrush* DomProperty::takeElementBrush() { DomBrush* a = m_brush; m_brush = 0; @@ -8246,7 +8249,7 @@ void DomConnection::setElementSlot(const QString& a) m_slot = a; } -DomConnectionHints* DomConnection::takeElementHints() +DomConnectionHints* DomConnection::takeElementHints() { DomConnectionHints* a = m_hints; m_hints = 0; diff --git a/src/tools/uic/ui4.h b/src/tools/uic/ui4.h index d50a70c468..51a70749ce 100644 --- a/src/tools/uic/ui4.h +++ b/src/tools/uic/ui4.h @@ -42,7 +42,7 @@ // We mean it. // -// THIS FILE IS AUTOMATICALLY GENERATED +// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT! #ifndef UI4_H #define UI4_H -- cgit v1.2.3 From a776e4cf78d55ccd2d05911b2b466148edeb8015 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 8 Oct 2014 11:36:56 +0200 Subject: uic: don't use QStringLiteral in comparisons (this is committing the new output of generate_ui from qttools) For QLatin1String, operator== is overloaded, even for QStringRef, so comparing to a latin-1 (C) string literal is efficient, since strlen() is comparatively fast. OTOH, QStringLiteral, when not using RVO, litters the code with QString dtor calls, which are not inline. Worse, absent lambdas, it even allocates memory. So, just compare using QLatin1String instead. Change-Id: I5035d259085c21689ab0f62fd49819ab5223ffe8 Reviewed-by: Thiago Macieira --- src/tools/uic/ui4.cpp | 546 +++++++++++++++++++++++++------------------------- 1 file changed, 273 insertions(+), 273 deletions(-) (limited to 'src') diff --git a/src/tools/uic/ui4.cpp b/src/tools/uic/ui4.cpp index d7b741b74b..7563d1d64b 100644 --- a/src/tools/uic/ui4.cpp +++ b/src/tools/uic/ui4.cpp @@ -131,23 +131,23 @@ void DomUI::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QStringLiteral("version")) { + if (name == QLatin1String("version")) { setAttributeVersion(attribute.value().toString()); continue; } - if (name == QStringLiteral("language")) { + if (name == QLatin1String("language")) { setAttributeLanguage(attribute.value().toString()); continue; } - if (name == QStringLiteral("displayname")) { + if (name == QLatin1String("displayname")) { setAttributeDisplayname(attribute.value().toString()); continue; } - if (name == QStringLiteral("stdsetdef")) { + if (name == QLatin1String("stdsetdef")) { setAttributeStdsetdef(attribute.value().toString().toInt()); continue; } - if (name == QStringLiteral("stdSetDef")) { + if (name == QLatin1String("stdSetDef")) { setAttributeStdSetDef(attribute.value().toString().toInt()); continue; } @@ -158,93 +158,93 @@ void DomUI::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("author")) { + if (tag == QLatin1String("author")) { setElementAuthor(reader.readElementText()); continue; } - if (tag == QStringLiteral("comment")) { + if (tag == QLatin1String("comment")) { setElementComment(reader.readElementText()); continue; } - if (tag == QStringLiteral("exportmacro")) { + if (tag == QLatin1String("exportmacro")) { setElementExportMacro(reader.readElementText()); continue; } - if (tag == QStringLiteral("class")) { + if (tag == QLatin1String("class")) { setElementClass(reader.readElementText()); continue; } - if (tag == QStringLiteral("widget")) { + if (tag == QLatin1String("widget")) { DomWidget *v = new DomWidget(); v->read(reader); setElementWidget(v); continue; } - if (tag == QStringLiteral("layoutdefault")) { + if (tag == QLatin1String("layoutdefault")) { DomLayoutDefault *v = new DomLayoutDefault(); v->read(reader); setElementLayoutDefault(v); continue; } - if (tag == QStringLiteral("layoutfunction")) { + if (tag == QLatin1String("layoutfunction")) { DomLayoutFunction *v = new DomLayoutFunction(); v->read(reader); setElementLayoutFunction(v); continue; } - if (tag == QStringLiteral("pixmapfunction")) { + if (tag == QLatin1String("pixmapfunction")) { setElementPixmapFunction(reader.readElementText()); continue; } - if (tag == QStringLiteral("customwidgets")) { + if (tag == QLatin1String("customwidgets")) { DomCustomWidgets *v = new DomCustomWidgets(); v->read(reader); setElementCustomWidgets(v); continue; } - if (tag == QStringLiteral("tabstops")) { + if (tag == QLatin1String("tabstops")) { DomTabStops *v = new DomTabStops(); v->read(reader); setElementTabStops(v); continue; } - if (tag == QStringLiteral("images")) { + if (tag == QLatin1String("images")) { DomImages *v = new DomImages(); v->read(reader); setElementImages(v); continue; } - if (tag == QStringLiteral("includes")) { + if (tag == QLatin1String("includes")) { DomIncludes *v = new DomIncludes(); v->read(reader); setElementIncludes(v); continue; } - if (tag == QStringLiteral("resources")) { + if (tag == QLatin1String("resources")) { DomResources *v = new DomResources(); v->read(reader); setElementResources(v); continue; } - if (tag == QStringLiteral("connections")) { + if (tag == QLatin1String("connections")) { DomConnections *v = new DomConnections(); v->read(reader); setElementConnections(v); continue; } - if (tag == QStringLiteral("designerdata")) { + if (tag == QLatin1String("designerdata")) { DomDesignerData *v = new DomDesignerData(); v->read(reader); setElementDesignerdata(v); continue; } - if (tag == QStringLiteral("slots")) { + if (tag == QLatin1String("slots")) { DomSlots *v = new DomSlots(); v->read(reader); setElementSlots(v); continue; } - if (tag == QStringLiteral("buttongroups")) { + if (tag == QLatin1String("buttongroups")) { DomButtonGroups *v = new DomButtonGroups(); v->read(reader); setElementButtonGroups(v); @@ -708,7 +708,7 @@ void DomIncludes::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("include")) { + if (tag == QLatin1String("include")) { DomInclude *v = new DomInclude(); v->read(reader); m_include.append(v); @@ -779,11 +779,11 @@ void DomInclude::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QStringLiteral("location")) { + if (name == QLatin1String("location")) { setAttributeLocation(attribute.value().toString()); continue; } - if (name == QStringLiteral("impldecl")) { + if (name == QLatin1String("impldecl")) { setAttributeImpldecl(attribute.value().toString()); continue; } @@ -856,7 +856,7 @@ void DomResources::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QStringLiteral("name")) { + if (name == QLatin1String("name")) { setAttributeName(attribute.value().toString()); continue; } @@ -867,7 +867,7 @@ void DomResources::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("include")) { + if (tag == QLatin1String("include")) { DomResource *v = new DomResource(); v->read(reader); m_include.append(v); @@ -938,7 +938,7 @@ void DomResource::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QStringLiteral("location")) { + if (name == QLatin1String("location")) { setAttributeLocation(attribute.value().toString()); continue; } @@ -1020,7 +1020,7 @@ void DomActionGroup::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QStringLiteral("name")) { + if (name == QLatin1String("name")) { setAttributeName(attribute.value().toString()); continue; } @@ -1031,25 +1031,25 @@ void DomActionGroup::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("action")) { + if (tag == QLatin1String("action")) { DomAction *v = new DomAction(); v->read(reader); m_action.append(v); continue; } - if (tag == QStringLiteral("actiongroup")) { + if (tag == QLatin1String("actiongroup")) { DomActionGroup *v = new DomActionGroup(); v->read(reader); m_actionGroup.append(v); continue; } - if (tag == QStringLiteral("property")) { + if (tag == QLatin1String("property")) { DomProperty *v = new DomProperty(); v->read(reader); m_property.append(v); continue; } - if (tag == QStringLiteral("attribute")) { + if (tag == QLatin1String("attribute")) { DomProperty *v = new DomProperty(); v->read(reader); m_attribute.append(v); @@ -1160,11 +1160,11 @@ void DomAction::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QStringLiteral("name")) { + if (name == QLatin1String("name")) { setAttributeName(attribute.value().toString()); continue; } - if (name == QStringLiteral("menu")) { + if (name == QLatin1String("menu")) { setAttributeMenu(attribute.value().toString()); continue; } @@ -1175,13 +1175,13 @@ void DomAction::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("property")) { + if (tag == QLatin1String("property")) { DomProperty *v = new DomProperty(); v->read(reader); m_property.append(v); continue; } - if (tag == QStringLiteral("attribute")) { + if (tag == QLatin1String("attribute")) { DomProperty *v = new DomProperty(); v->read(reader); m_attribute.append(v); @@ -1265,7 +1265,7 @@ void DomActionRef::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QStringLiteral("name")) { + if (name == QLatin1String("name")) { setAttributeName(attribute.value().toString()); continue; } @@ -1339,7 +1339,7 @@ void DomButtonGroup::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QStringLiteral("name")) { + if (name == QLatin1String("name")) { setAttributeName(attribute.value().toString()); continue; } @@ -1350,13 +1350,13 @@ void DomButtonGroup::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("property")) { + if (tag == QLatin1String("property")) { DomProperty *v = new DomProperty(); v->read(reader); m_property.append(v); continue; } - if (tag == QStringLiteral("attribute")) { + if (tag == QLatin1String("attribute")) { DomProperty *v = new DomProperty(); v->read(reader); m_attribute.append(v); @@ -1441,7 +1441,7 @@ void DomButtonGroups::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("buttongroup")) { + if (tag == QLatin1String("buttongroup")) { DomButtonGroup *v = new DomButtonGroup(); v->read(reader); m_buttonGroup.append(v); @@ -1513,7 +1513,7 @@ void DomImages::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("image")) { + if (tag == QLatin1String("image")) { DomImage *v = new DomImage(); v->read(reader); m_image.append(v); @@ -1585,7 +1585,7 @@ void DomImage::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QStringLiteral("name")) { + if (name == QLatin1String("name")) { setAttributeName(attribute.value().toString()); continue; } @@ -1596,7 +1596,7 @@ void DomImage::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("data")) { + if (tag == QLatin1String("data")) { DomImageData *v = new DomImageData(); v->read(reader); setElementData(v); @@ -1688,11 +1688,11 @@ void DomImageData::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QStringLiteral("format")) { + if (name == QLatin1String("format")) { setAttributeFormat(attribute.value().toString()); continue; } - if (name == QStringLiteral("length")) { + if (name == QLatin1String("length")) { setAttributeLength(attribute.value().toString().toInt()); continue; } @@ -1765,7 +1765,7 @@ void DomCustomWidgets::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("customwidget")) { + if (tag == QLatin1String("customwidget")) { DomCustomWidget *v = new DomCustomWidget(); v->read(reader); m_customWidget.append(v); @@ -1834,7 +1834,7 @@ void DomHeader::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QStringLiteral("location")) { + if (name == QLatin1String("location")) { setAttributeLocation(attribute.value().toString()); continue; } @@ -1930,63 +1930,63 @@ void DomCustomWidget::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("class")) { + if (tag == QLatin1String("class")) { setElementClass(reader.readElementText()); continue; } - if (tag == QStringLiteral("extends")) { + if (tag == QLatin1String("extends")) { setElementExtends(reader.readElementText()); continue; } - if (tag == QStringLiteral("header")) { + if (tag == QLatin1String("header")) { DomHeader *v = new DomHeader(); v->read(reader); setElementHeader(v); continue; } - if (tag == QStringLiteral("sizehint")) { + if (tag == QLatin1String("sizehint")) { DomSize *v = new DomSize(); v->read(reader); setElementSizeHint(v); continue; } - if (tag == QStringLiteral("addpagemethod")) { + if (tag == QLatin1String("addpagemethod")) { setElementAddPageMethod(reader.readElementText()); continue; } - if (tag == QStringLiteral("container")) { + if (tag == QLatin1String("container")) { setElementContainer(reader.readElementText().toInt()); continue; } - if (tag == QStringLiteral("sizepolicy")) { + if (tag == QLatin1String("sizepolicy")) { DomSizePolicyData *v = new DomSizePolicyData(); v->read(reader); setElementSizePolicy(v); continue; } - if (tag == QStringLiteral("pixmap")) { + if (tag == QLatin1String("pixmap")) { setElementPixmap(reader.readElementText()); continue; } - if (tag == QStringLiteral("script")) { + if (tag == QLatin1String("script")) { DomScript *v = new DomScript(); v->read(reader); setElementScript(v); continue; } - if (tag == QStringLiteral("properties")) { + if (tag == QLatin1String("properties")) { DomProperties *v = new DomProperties(); v->read(reader); setElementProperties(v); continue; } - if (tag == QStringLiteral("slots")) { + if (tag == QLatin1String("slots")) { DomSlots *v = new DomSlots(); v->read(reader); setElementSlots(v); continue; } - if (tag == QStringLiteral("propertyspecifications")) { + if (tag == QLatin1String("propertyspecifications")) { DomPropertySpecifications *v = new DomPropertySpecifications(); v->read(reader); setElementPropertyspecifications(v); @@ -2305,7 +2305,7 @@ void DomProperties::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("property")) { + if (tag == QLatin1String("property")) { DomPropertyData *v = new DomPropertyData(); v->read(reader); m_property.append(v); @@ -2373,7 +2373,7 @@ void DomPropertyData::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QStringLiteral("type")) { + if (name == QLatin1String("type")) { setAttributeType(attribute.value().toString()); continue; } @@ -2443,11 +2443,11 @@ void DomSizePolicyData::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("hordata")) { + if (tag == QLatin1String("hordata")) { setElementHorData(reader.readElementText().toInt()); continue; } - if (tag == QStringLiteral("verdata")) { + if (tag == QLatin1String("verdata")) { setElementVerData(reader.readElementText().toInt()); continue; } @@ -2539,11 +2539,11 @@ void DomLayoutDefault::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QStringLiteral("spacing")) { + if (name == QLatin1String("spacing")) { setAttributeSpacing(attribute.value().toString().toInt()); continue; } - if (name == QStringLiteral("margin")) { + if (name == QLatin1String("margin")) { setAttributeMargin(attribute.value().toString().toInt()); continue; } @@ -2614,11 +2614,11 @@ void DomLayoutFunction::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QStringLiteral("spacing")) { + if (name == QLatin1String("spacing")) { setAttributeSpacing(attribute.value().toString()); continue; } - if (name == QStringLiteral("margin")) { + if (name == QLatin1String("margin")) { setAttributeMargin(attribute.value().toString()); continue; } @@ -2689,7 +2689,7 @@ void DomTabStops::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("tabstop")) { + if (tag == QLatin1String("tabstop")) { m_tabStop.append(reader.readElementText()); continue; } @@ -2779,31 +2779,31 @@ void DomLayout::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QStringLiteral("class")) { + if (name == QLatin1String("class")) { setAttributeClass(attribute.value().toString()); continue; } - if (name == QStringLiteral("name")) { + if (name == QLatin1String("name")) { setAttributeName(attribute.value().toString()); continue; } - if (name == QStringLiteral("stretch")) { + if (name == QLatin1String("stretch")) { setAttributeStretch(attribute.value().toString()); continue; } - if (name == QStringLiteral("rowstretch")) { + if (name == QLatin1String("rowstretch")) { setAttributeRowStretch(attribute.value().toString()); continue; } - if (name == QStringLiteral("columnstretch")) { + if (name == QLatin1String("columnstretch")) { setAttributeColumnStretch(attribute.value().toString()); continue; } - if (name == QStringLiteral("rowminimumheight")) { + if (name == QLatin1String("rowminimumheight")) { setAttributeRowMinimumHeight(attribute.value().toString()); continue; } - if (name == QStringLiteral("columnminimumwidth")) { + if (name == QLatin1String("columnminimumwidth")) { setAttributeColumnMinimumWidth(attribute.value().toString()); continue; } @@ -2814,19 +2814,19 @@ void DomLayout::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("property")) { + if (tag == QLatin1String("property")) { DomProperty *v = new DomProperty(); v->read(reader); m_property.append(v); continue; } - if (tag == QStringLiteral("attribute")) { + if (tag == QLatin1String("attribute")) { DomProperty *v = new DomProperty(); v->read(reader); m_attribute.append(v); continue; } - if (tag == QStringLiteral("item")) { + if (tag == QLatin1String("item")) { DomLayoutItem *v = new DomLayoutItem(); v->read(reader); m_item.append(v); @@ -2965,23 +2965,23 @@ void DomLayoutItem::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QStringLiteral("row")) { + if (name == QLatin1String("row")) { setAttributeRow(attribute.value().toString().toInt()); continue; } - if (name == QStringLiteral("column")) { + if (name == QLatin1String("column")) { setAttributeColumn(attribute.value().toString().toInt()); continue; } - if (name == QStringLiteral("rowspan")) { + if (name == QLatin1String("rowspan")) { setAttributeRowSpan(attribute.value().toString().toInt()); continue; } - if (name == QStringLiteral("colspan")) { + if (name == QLatin1String("colspan")) { setAttributeColSpan(attribute.value().toString().toInt()); continue; } - if (name == QStringLiteral("alignment")) { + if (name == QLatin1String("alignment")) { setAttributeAlignment(attribute.value().toString()); continue; } @@ -2992,19 +2992,19 @@ void DomLayoutItem::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("widget")) { + if (tag == QLatin1String("widget")) { DomWidget *v = new DomWidget(); v->read(reader); setElementWidget(v); continue; } - if (tag == QStringLiteral("layout")) { + if (tag == QLatin1String("layout")) { DomLayout *v = new DomLayout(); v->read(reader); setElementLayout(v); continue; } - if (tag == QStringLiteral("spacer")) { + if (tag == QLatin1String("spacer")) { DomSpacer *v = new DomSpacer(); v->read(reader); setElementSpacer(v); @@ -3148,7 +3148,7 @@ void DomRow::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("property")) { + if (tag == QLatin1String("property")) { DomProperty *v = new DomProperty(); v->read(reader); m_property.append(v); @@ -3220,7 +3220,7 @@ void DomColumn::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("property")) { + if (tag == QLatin1String("property")) { DomProperty *v = new DomProperty(); v->read(reader); m_property.append(v); @@ -3302,11 +3302,11 @@ void DomItem::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QStringLiteral("row")) { + if (name == QLatin1String("row")) { setAttributeRow(attribute.value().toString().toInt()); continue; } - if (name == QStringLiteral("column")) { + if (name == QLatin1String("column")) { setAttributeColumn(attribute.value().toString().toInt()); continue; } @@ -3317,13 +3317,13 @@ void DomItem::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("property")) { + if (tag == QLatin1String("property")) { DomProperty *v = new DomProperty(); v->read(reader); m_property.append(v); continue; } - if (tag == QStringLiteral("item")) { + if (tag == QLatin1String("item")) { DomItem *v = new DomItem(); v->read(reader); m_item.append(v); @@ -3465,16 +3465,16 @@ void DomWidget::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QStringLiteral("class")) { + if (name == QLatin1String("class")) { setAttributeClass(attribute.value().toString()); continue; } - if (name == QStringLiteral("name")) { + if (name == QLatin1String("name")) { setAttributeName(attribute.value().toString()); continue; } - if (name == QStringLiteral("native")) { - setAttributeNative(attribute.value().toString() == QStringLiteral("true")); + if (name == QLatin1String("native")) { + setAttributeNative(attribute.value().toString() == QLatin1String("true")); continue; } reader.raiseError(QStringLiteral("Unexpected attribute ") + name.toString()); @@ -3484,83 +3484,83 @@ void DomWidget::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("class")) { + if (tag == QLatin1String("class")) { m_class.append(reader.readElementText()); continue; } - if (tag == QStringLiteral("property")) { + if (tag == QLatin1String("property")) { DomProperty *v = new DomProperty(); v->read(reader); m_property.append(v); continue; } - if (tag == QStringLiteral("script")) { + if (tag == QLatin1String("script")) { DomScript *v = new DomScript(); v->read(reader); m_script.append(v); continue; } - if (tag == QStringLiteral("widgetdata")) { + if (tag == QLatin1String("widgetdata")) { DomWidgetData *v = new DomWidgetData(); v->read(reader); m_widgetData.append(v); continue; } - if (tag == QStringLiteral("attribute")) { + if (tag == QLatin1String("attribute")) { DomProperty *v = new DomProperty(); v->read(reader); m_attribute.append(v); continue; } - if (tag == QStringLiteral("row")) { + if (tag == QLatin1String("row")) { DomRow *v = new DomRow(); v->read(reader); m_row.append(v); continue; } - if (tag == QStringLiteral("column")) { + if (tag == QLatin1String("column")) { DomColumn *v = new DomColumn(); v->read(reader); m_column.append(v); continue; } - if (tag == QStringLiteral("item")) { + if (tag == QLatin1String("item")) { DomItem *v = new DomItem(); v->read(reader); m_item.append(v); continue; } - if (tag == QStringLiteral("layout")) { + if (tag == QLatin1String("layout")) { DomLayout *v = new DomLayout(); v->read(reader); m_layout.append(v); continue; } - if (tag == QStringLiteral("widget")) { + if (tag == QLatin1String("widget")) { DomWidget *v = new DomWidget(); v->read(reader); m_widget.append(v); continue; } - if (tag == QStringLiteral("action")) { + if (tag == QLatin1String("action")) { DomAction *v = new DomAction(); v->read(reader); m_action.append(v); continue; } - if (tag == QStringLiteral("actiongroup")) { + if (tag == QLatin1String("actiongroup")) { DomActionGroup *v = new DomActionGroup(); v->read(reader); m_actionGroup.append(v); continue; } - if (tag == QStringLiteral("addaction")) { + if (tag == QLatin1String("addaction")) { DomActionRef *v = new DomActionRef(); v->read(reader); m_addAction.append(v); continue; } - if (tag == QStringLiteral("zorder")) { + if (tag == QLatin1String("zorder")) { m_zOrder.append(reader.readElementText()); continue; } @@ -3769,7 +3769,7 @@ void DomSpacer::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QStringLiteral("name")) { + if (name == QLatin1String("name")) { setAttributeName(attribute.value().toString()); continue; } @@ -3780,7 +3780,7 @@ void DomSpacer::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("property")) { + if (tag == QLatin1String("property")) { DomProperty *v = new DomProperty(); v->read(reader); m_property.append(v); @@ -3859,7 +3859,7 @@ void DomColor::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QStringLiteral("alpha")) { + if (name == QLatin1String("alpha")) { setAttributeAlpha(attribute.value().toString().toInt()); continue; } @@ -3870,15 +3870,15 @@ void DomColor::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("red")) { + if (tag == QLatin1String("red")) { setElementRed(reader.readElementText().toInt()); continue; } - if (tag == QStringLiteral("green")) { + if (tag == QLatin1String("green")) { setElementGreen(reader.readElementText().toInt()); continue; } - if (tag == QStringLiteral("blue")) { + if (tag == QLatin1String("blue")) { setElementBlue(reader.readElementText().toInt()); continue; } @@ -3988,7 +3988,7 @@ void DomGradientStop::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QStringLiteral("position")) { + if (name == QLatin1String("position")) { setAttributePosition(attribute.value().toString().toDouble()); continue; } @@ -3999,7 +3999,7 @@ void DomGradientStop::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("color")) { + if (tag == QLatin1String("color")) { DomColor *v = new DomColor(); v->read(reader); setElementColor(v); @@ -4134,55 +4134,55 @@ void DomGradient::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QStringLiteral("startx")) { + if (name == QLatin1String("startx")) { setAttributeStartX(attribute.value().toString().toDouble()); continue; } - if (name == QStringLiteral("starty")) { + if (name == QLatin1String("starty")) { setAttributeStartY(attribute.value().toString().toDouble()); continue; } - if (name == QStringLiteral("endx")) { + if (name == QLatin1String("endx")) { setAttributeEndX(attribute.value().toString().toDouble()); continue; } - if (name == QStringLiteral("endy")) { + if (name == QLatin1String("endy")) { setAttributeEndY(attribute.value().toString().toDouble()); continue; } - if (name == QStringLiteral("centralx")) { + if (name == QLatin1String("centralx")) { setAttributeCentralX(attribute.value().toString().toDouble()); continue; } - if (name == QStringLiteral("centraly")) { + if (name == QLatin1String("centraly")) { setAttributeCentralY(attribute.value().toString().toDouble()); continue; } - if (name == QStringLiteral("focalx")) { + if (name == QLatin1String("focalx")) { setAttributeFocalX(attribute.value().toString().toDouble()); continue; } - if (name == QStringLiteral("focaly")) { + if (name == QLatin1String("focaly")) { setAttributeFocalY(attribute.value().toString().toDouble()); continue; } - if (name == QStringLiteral("radius")) { + if (name == QLatin1String("radius")) { setAttributeRadius(attribute.value().toString().toDouble()); continue; } - if (name == QStringLiteral("angle")) { + if (name == QLatin1String("angle")) { setAttributeAngle(attribute.value().toString().toDouble()); continue; } - if (name == QStringLiteral("type")) { + if (name == QLatin1String("type")) { setAttributeType(attribute.value().toString()); continue; } - if (name == QStringLiteral("spread")) { + if (name == QLatin1String("spread")) { setAttributeSpread(attribute.value().toString()); continue; } - if (name == QStringLiteral("coordinatemode")) { + if (name == QLatin1String("coordinatemode")) { setAttributeCoordinateMode(attribute.value().toString()); continue; } @@ -4193,7 +4193,7 @@ void DomGradient::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("gradientstop")) { + if (tag == QLatin1String("gradientstop")) { DomGradientStop *v = new DomGradientStop(); v->read(reader); m_gradientStop.append(v); @@ -4314,7 +4314,7 @@ void DomBrush::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QStringLiteral("brushstyle")) { + if (name == QLatin1String("brushstyle")) { setAttributeBrushStyle(attribute.value().toString()); continue; } @@ -4325,19 +4325,19 @@ void DomBrush::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("color")) { + if (tag == QLatin1String("color")) { DomColor *v = new DomColor(); v->read(reader); setElementColor(v); continue; } - if (tag == QStringLiteral("texture")) { + if (tag == QLatin1String("texture")) { DomProperty *v = new DomProperty(); v->read(reader); setElementTexture(v); continue; } - if (tag == QStringLiteral("gradient")) { + if (tag == QLatin1String("gradient")) { DomGradient *v = new DomGradient(); v->read(reader); setElementGradient(v); @@ -4469,7 +4469,7 @@ void DomColorRole::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QStringLiteral("role")) { + if (name == QLatin1String("role")) { setAttributeRole(attribute.value().toString()); continue; } @@ -4480,7 +4480,7 @@ void DomColorRole::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("brush")) { + if (tag == QLatin1String("brush")) { DomBrush *v = new DomBrush(); v->read(reader); setElementBrush(v); @@ -4575,13 +4575,13 @@ void DomColorGroup::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("colorrole")) { + if (tag == QLatin1String("colorrole")) { DomColorRole *v = new DomColorRole(); v->read(reader); m_colorRole.append(v); continue; } - if (tag == QStringLiteral("color")) { + if (tag == QLatin1String("color")) { DomColor *v = new DomColor(); v->read(reader); m_color.append(v); @@ -4671,19 +4671,19 @@ void DomPalette::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("active")) { + if (tag == QLatin1String("active")) { DomColorGroup *v = new DomColorGroup(); v->read(reader); setElementActive(v); continue; } - if (tag == QStringLiteral("inactive")) { + if (tag == QLatin1String("inactive")) { DomColorGroup *v = new DomColorGroup(); v->read(reader); setElementInactive(v); continue; } - if (tag == QStringLiteral("disabled")) { + if (tag == QLatin1String("disabled")) { DomColorGroup *v = new DomColorGroup(); v->read(reader); setElementDisabled(v); @@ -4835,44 +4835,44 @@ void DomFont::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("family")) { + if (tag == QLatin1String("family")) { setElementFamily(reader.readElementText()); continue; } - if (tag == QStringLiteral("pointsize")) { + if (tag == QLatin1String("pointsize")) { setElementPointSize(reader.readElementText().toInt()); continue; } - if (tag == QStringLiteral("weight")) { + if (tag == QLatin1String("weight")) { setElementWeight(reader.readElementText().toInt()); continue; } - if (tag == QStringLiteral("italic")) { - setElementItalic(reader.readElementText() == QStringLiteral("true")); + if (tag == QLatin1String("italic")) { + setElementItalic(reader.readElementText() == QLatin1String("true")); continue; } - if (tag == QStringLiteral("bold")) { - setElementBold(reader.readElementText() == QStringLiteral("true")); + if (tag == QLatin1String("bold")) { + setElementBold(reader.readElementText() == QLatin1String("true")); continue; } - if (tag == QStringLiteral("underline")) { - setElementUnderline(reader.readElementText() == QStringLiteral("true")); + if (tag == QLatin1String("underline")) { + setElementUnderline(reader.readElementText() == QLatin1String("true")); continue; } - if (tag == QStringLiteral("strikeout")) { - setElementStrikeOut(reader.readElementText() == QStringLiteral("true")); + if (tag == QLatin1String("strikeout")) { + setElementStrikeOut(reader.readElementText() == QLatin1String("true")); continue; } - if (tag == QStringLiteral("antialiasing")) { - setElementAntialiasing(reader.readElementText() == QStringLiteral("true")); + if (tag == QLatin1String("antialiasing")) { + setElementAntialiasing(reader.readElementText() == QLatin1String("true")); continue; } - if (tag == QStringLiteral("stylestrategy")) { + if (tag == QLatin1String("stylestrategy")) { setElementStyleStrategy(reader.readElementText()); continue; } - if (tag == QStringLiteral("kerning")) { - setElementKerning(reader.readElementText() == QStringLiteral("true")); + if (tag == QLatin1String("kerning")) { + setElementKerning(reader.readElementText() == QLatin1String("true")); continue; } reader.raiseError(QStringLiteral("Unexpected element ") + tag); @@ -5081,11 +5081,11 @@ void DomPoint::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QString(QLatin1Char('x'))) { + if (tag == QLatin1String("x")) { setElementX(reader.readElementText().toInt()); continue; } - if (tag == QString(QLatin1Char('y'))) { + if (tag == QLatin1String("y")) { setElementY(reader.readElementText().toInt()); continue; } @@ -5179,19 +5179,19 @@ void DomRect::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QString(QLatin1Char('x'))) { + if (tag == QLatin1String("x")) { setElementX(reader.readElementText().toInt()); continue; } - if (tag == QString(QLatin1Char('y'))) { + if (tag == QLatin1String("y")) { setElementY(reader.readElementText().toInt()); continue; } - if (tag == QStringLiteral("width")) { + if (tag == QLatin1String("width")) { setElementWidth(reader.readElementText().toInt()); continue; } - if (tag == QStringLiteral("height")) { + if (tag == QLatin1String("height")) { setElementHeight(reader.readElementText().toInt()); continue; } @@ -5309,11 +5309,11 @@ void DomLocale::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QStringLiteral("language")) { + if (name == QLatin1String("language")) { setAttributeLanguage(attribute.value().toString()); continue; } - if (name == QStringLiteral("country")) { + if (name == QLatin1String("country")) { setAttributeCountry(attribute.value().toString()); continue; } @@ -5392,11 +5392,11 @@ void DomSizePolicy::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QStringLiteral("hsizetype")) { + if (name == QLatin1String("hsizetype")) { setAttributeHSizeType(attribute.value().toString()); continue; } - if (name == QStringLiteral("vsizetype")) { + if (name == QLatin1String("vsizetype")) { setAttributeVSizeType(attribute.value().toString()); continue; } @@ -5407,19 +5407,19 @@ void DomSizePolicy::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("hsizetype")) { + if (tag == QLatin1String("hsizetype")) { setElementHSizeType(reader.readElementText().toInt()); continue; } - if (tag == QStringLiteral("vsizetype")) { + if (tag == QLatin1String("vsizetype")) { setElementVSizeType(reader.readElementText().toInt()); continue; } - if (tag == QStringLiteral("horstretch")) { + if (tag == QLatin1String("horstretch")) { setElementHorStretch(reader.readElementText().toInt()); continue; } - if (tag == QStringLiteral("verstretch")) { + if (tag == QLatin1String("verstretch")) { setElementVerStretch(reader.readElementText().toInt()); continue; } @@ -5545,11 +5545,11 @@ void DomSize::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("width")) { + if (tag == QLatin1String("width")) { setElementWidth(reader.readElementText().toInt()); continue; } - if (tag == QStringLiteral("height")) { + if (tag == QLatin1String("height")) { setElementHeight(reader.readElementText().toInt()); continue; } @@ -5641,15 +5641,15 @@ void DomDate::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("year")) { + if (tag == QLatin1String("year")) { setElementYear(reader.readElementText().toInt()); continue; } - if (tag == QStringLiteral("month")) { + if (tag == QLatin1String("month")) { setElementMonth(reader.readElementText().toInt()); continue; } - if (tag == QStringLiteral("day")) { + if (tag == QLatin1String("day")) { setElementDay(reader.readElementText().toInt()); continue; } @@ -5756,15 +5756,15 @@ void DomTime::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("hour")) { + if (tag == QLatin1String("hour")) { setElementHour(reader.readElementText().toInt()); continue; } - if (tag == QStringLiteral("minute")) { + if (tag == QLatin1String("minute")) { setElementMinute(reader.readElementText().toInt()); continue; } - if (tag == QStringLiteral("second")) { + if (tag == QLatin1String("second")) { setElementSecond(reader.readElementText().toInt()); continue; } @@ -5877,27 +5877,27 @@ void DomDateTime::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("hour")) { + if (tag == QLatin1String("hour")) { setElementHour(reader.readElementText().toInt()); continue; } - if (tag == QStringLiteral("minute")) { + if (tag == QLatin1String("minute")) { setElementMinute(reader.readElementText().toInt()); continue; } - if (tag == QStringLiteral("second")) { + if (tag == QLatin1String("second")) { setElementSecond(reader.readElementText().toInt()); continue; } - if (tag == QStringLiteral("year")) { + if (tag == QLatin1String("year")) { setElementYear(reader.readElementText().toInt()); continue; } - if (tag == QStringLiteral("month")) { + if (tag == QLatin1String("month")) { setElementMonth(reader.readElementText().toInt()); continue; } - if (tag == QStringLiteral("day")) { + if (tag == QLatin1String("day")) { setElementDay(reader.readElementText().toInt()); continue; } @@ -6049,15 +6049,15 @@ void DomStringList::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QStringLiteral("notr")) { + if (name == QLatin1String("notr")) { setAttributeNotr(attribute.value().toString()); continue; } - if (name == QStringLiteral("comment")) { + if (name == QLatin1String("comment")) { setAttributeComment(attribute.value().toString()); continue; } - if (name == QStringLiteral("extracomment")) { + if (name == QLatin1String("extracomment")) { setAttributeExtraComment(attribute.value().toString()); continue; } @@ -6068,7 +6068,7 @@ void DomStringList::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("string")) { + if (tag == QLatin1String("string")) { m_string.append(reader.readElementText()); continue; } @@ -6146,11 +6146,11 @@ void DomResourcePixmap::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QStringLiteral("resource")) { + if (name == QLatin1String("resource")) { setAttributeResource(attribute.value().toString()); continue; } - if (name == QStringLiteral("alias")) { + if (name == QLatin1String("alias")) { setAttributeAlias(attribute.value().toString()); continue; } @@ -6254,11 +6254,11 @@ void DomResourceIcon::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QStringLiteral("theme")) { + if (name == QLatin1String("theme")) { setAttributeTheme(attribute.value().toString()); continue; } - if (name == QStringLiteral("resource")) { + if (name == QLatin1String("resource")) { setAttributeResource(attribute.value().toString()); continue; } @@ -6269,49 +6269,49 @@ void DomResourceIcon::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("normaloff")) { + if (tag == QLatin1String("normaloff")) { DomResourcePixmap *v = new DomResourcePixmap(); v->read(reader); setElementNormalOff(v); continue; } - if (tag == QStringLiteral("normalon")) { + if (tag == QLatin1String("normalon")) { DomResourcePixmap *v = new DomResourcePixmap(); v->read(reader); setElementNormalOn(v); continue; } - if (tag == QStringLiteral("disabledoff")) { + if (tag == QLatin1String("disabledoff")) { DomResourcePixmap *v = new DomResourcePixmap(); v->read(reader); setElementDisabledOff(v); continue; } - if (tag == QStringLiteral("disabledon")) { + if (tag == QLatin1String("disabledon")) { DomResourcePixmap *v = new DomResourcePixmap(); v->read(reader); setElementDisabledOn(v); continue; } - if (tag == QStringLiteral("activeoff")) { + if (tag == QLatin1String("activeoff")) { DomResourcePixmap *v = new DomResourcePixmap(); v->read(reader); setElementActiveOff(v); continue; } - if (tag == QStringLiteral("activeon")) { + if (tag == QLatin1String("activeon")) { DomResourcePixmap *v = new DomResourcePixmap(); v->read(reader); setElementActiveOn(v); continue; } - if (tag == QStringLiteral("selectedoff")) { + if (tag == QLatin1String("selectedoff")) { DomResourcePixmap *v = new DomResourcePixmap(); v->read(reader); setElementSelectedOff(v); continue; } - if (tag == QStringLiteral("selectedon")) { + if (tag == QLatin1String("selectedon")) { DomResourcePixmap *v = new DomResourcePixmap(); v->read(reader); setElementSelectedOn(v); @@ -6588,15 +6588,15 @@ void DomString::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QStringLiteral("notr")) { + if (name == QLatin1String("notr")) { setAttributeNotr(attribute.value().toString()); continue; } - if (name == QStringLiteral("comment")) { + if (name == QLatin1String("comment")) { setAttributeComment(attribute.value().toString()); continue; } - if (name == QStringLiteral("extracomment")) { + if (name == QLatin1String("extracomment")) { setAttributeExtraComment(attribute.value().toString()); continue; } @@ -6672,11 +6672,11 @@ void DomPointF::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QString(QLatin1Char('x'))) { + if (tag == QLatin1String("x")) { setElementX(reader.readElementText().toDouble()); continue; } - if (tag == QString(QLatin1Char('y'))) { + if (tag == QLatin1String("y")) { setElementY(reader.readElementText().toDouble()); continue; } @@ -6770,19 +6770,19 @@ void DomRectF::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QString(QLatin1Char('x'))) { + if (tag == QLatin1String("x")) { setElementX(reader.readElementText().toDouble()); continue; } - if (tag == QString(QLatin1Char('y'))) { + if (tag == QLatin1String("y")) { setElementY(reader.readElementText().toDouble()); continue; } - if (tag == QStringLiteral("width")) { + if (tag == QLatin1String("width")) { setElementWidth(reader.readElementText().toDouble()); continue; } - if (tag == QStringLiteral("height")) { + if (tag == QLatin1String("height")) { setElementHeight(reader.readElementText().toDouble()); continue; } @@ -6902,11 +6902,11 @@ void DomSizeF::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("width")) { + if (tag == QLatin1String("width")) { setElementWidth(reader.readElementText().toDouble()); continue; } - if (tag == QStringLiteral("height")) { + if (tag == QLatin1String("height")) { setElementHeight(reader.readElementText().toDouble()); continue; } @@ -6994,7 +6994,7 @@ void DomChar::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("unicode")) { + if (tag == QLatin1String("unicode")) { setElementUnicode(reader.readElementText().toInt()); continue; } @@ -7069,7 +7069,7 @@ void DomUrl::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("string")) { + if (tag == QLatin1String("string")) { DomString *v = new DomString(); v->read(reader); setElementString(v); @@ -7257,11 +7257,11 @@ void DomProperty::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QStringLiteral("name")) { + if (name == QLatin1String("name")) { setAttributeName(attribute.value().toString()); continue; } - if (name == QStringLiteral("stdset")) { + if (name == QLatin1String("stdset")) { setAttributeStdset(attribute.value().toString().toInt()); continue; } @@ -7272,175 +7272,175 @@ void DomProperty::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("bool")) { + if (tag == QLatin1String("bool")) { setElementBool(reader.readElementText()); continue; } - if (tag == QStringLiteral("color")) { + if (tag == QLatin1String("color")) { DomColor *v = new DomColor(); v->read(reader); setElementColor(v); continue; } - if (tag == QStringLiteral("cstring")) { + if (tag == QLatin1String("cstring")) { setElementCstring(reader.readElementText()); continue; } - if (tag == QStringLiteral("cursor")) { + if (tag == QLatin1String("cursor")) { setElementCursor(reader.readElementText().toInt()); continue; } - if (tag == QStringLiteral("cursorshape")) { + if (tag == QLatin1String("cursorshape")) { setElementCursorShape(reader.readElementText()); continue; } - if (tag == QStringLiteral("enum")) { + if (tag == QLatin1String("enum")) { setElementEnum(reader.readElementText()); continue; } - if (tag == QStringLiteral("font")) { + if (tag == QLatin1String("font")) { DomFont *v = new DomFont(); v->read(reader); setElementFont(v); continue; } - if (tag == QStringLiteral("iconset")) { + if (tag == QLatin1String("iconset")) { DomResourceIcon *v = new DomResourceIcon(); v->read(reader); setElementIconSet(v); continue; } - if (tag == QStringLiteral("pixmap")) { + if (tag == QLatin1String("pixmap")) { DomResourcePixmap *v = new DomResourcePixmap(); v->read(reader); setElementPixmap(v); continue; } - if (tag == QStringLiteral("palette")) { + if (tag == QLatin1String("palette")) { DomPalette *v = new DomPalette(); v->read(reader); setElementPalette(v); continue; } - if (tag == QStringLiteral("point")) { + if (tag == QLatin1String("point")) { DomPoint *v = new DomPoint(); v->read(reader); setElementPoint(v); continue; } - if (tag == QStringLiteral("rect")) { + if (tag == QLatin1String("rect")) { DomRect *v = new DomRect(); v->read(reader); setElementRect(v); continue; } - if (tag == QStringLiteral("set")) { + if (tag == QLatin1String("set")) { setElementSet(reader.readElementText()); continue; } - if (tag == QStringLiteral("locale")) { + if (tag == QLatin1String("locale")) { DomLocale *v = new DomLocale(); v->read(reader); setElementLocale(v); continue; } - if (tag == QStringLiteral("sizepolicy")) { + if (tag == QLatin1String("sizepolicy")) { DomSizePolicy *v = new DomSizePolicy(); v->read(reader); setElementSizePolicy(v); continue; } - if (tag == QStringLiteral("size")) { + if (tag == QLatin1String("size")) { DomSize *v = new DomSize(); v->read(reader); setElementSize(v); continue; } - if (tag == QStringLiteral("string")) { + if (tag == QLatin1String("string")) { DomString *v = new DomString(); v->read(reader); setElementString(v); continue; } - if (tag == QStringLiteral("stringlist")) { + if (tag == QLatin1String("stringlist")) { DomStringList *v = new DomStringList(); v->read(reader); setElementStringList(v); continue; } - if (tag == QStringLiteral("number")) { + if (tag == QLatin1String("number")) { setElementNumber(reader.readElementText().toInt()); continue; } - if (tag == QStringLiteral("float")) { + if (tag == QLatin1String("float")) { setElementFloat(reader.readElementText().toFloat()); continue; } - if (tag == QStringLiteral("double")) { + if (tag == QLatin1String("double")) { setElementDouble(reader.readElementText().toDouble()); continue; } - if (tag == QStringLiteral("date")) { + if (tag == QLatin1String("date")) { DomDate *v = new DomDate(); v->read(reader); setElementDate(v); continue; } - if (tag == QStringLiteral("time")) { + if (tag == QLatin1String("time")) { DomTime *v = new DomTime(); v->read(reader); setElementTime(v); continue; } - if (tag == QStringLiteral("datetime")) { + if (tag == QLatin1String("datetime")) { DomDateTime *v = new DomDateTime(); v->read(reader); setElementDateTime(v); continue; } - if (tag == QStringLiteral("pointf")) { + if (tag == QLatin1String("pointf")) { DomPointF *v = new DomPointF(); v->read(reader); setElementPointF(v); continue; } - if (tag == QStringLiteral("rectf")) { + if (tag == QLatin1String("rectf")) { DomRectF *v = new DomRectF(); v->read(reader); setElementRectF(v); continue; } - if (tag == QStringLiteral("sizef")) { + if (tag == QLatin1String("sizef")) { DomSizeF *v = new DomSizeF(); v->read(reader); setElementSizeF(v); continue; } - if (tag == QStringLiteral("longlong")) { + if (tag == QLatin1String("longlong")) { setElementLongLong(reader.readElementText().toLongLong()); continue; } - if (tag == QStringLiteral("char")) { + if (tag == QLatin1String("char")) { DomChar *v = new DomChar(); v->read(reader); setElementChar(v); continue; } - if (tag == QStringLiteral("url")) { + if (tag == QLatin1String("url")) { DomUrl *v = new DomUrl(); v->read(reader); setElementUrl(v); continue; } - if (tag == QStringLiteral("uint")) { + if (tag == QLatin1String("uint")) { setElementUInt(reader.readElementText().toUInt()); continue; } - if (tag == QStringLiteral("ulonglong")) { + if (tag == QLatin1String("ulonglong")) { setElementULongLong(reader.readElementText().toULongLong()); continue; } - if (tag == QStringLiteral("brush")) { + if (tag == QLatin1String("brush")) { DomBrush *v = new DomBrush(); v->read(reader); setElementBrush(v); @@ -8085,7 +8085,7 @@ void DomConnections::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("connection")) { + if (tag == QLatin1String("connection")) { DomConnection *v = new DomConnection(); v->read(reader); m_connection.append(v); @@ -8157,23 +8157,23 @@ void DomConnection::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("sender")) { + if (tag == QLatin1String("sender")) { setElementSender(reader.readElementText()); continue; } - if (tag == QStringLiteral("signal")) { + if (tag == QLatin1String("signal")) { setElementSignal(reader.readElementText()); continue; } - if (tag == QStringLiteral("receiver")) { + if (tag == QLatin1String("receiver")) { setElementReceiver(reader.readElementText()); continue; } - if (tag == QStringLiteral("slot")) { + if (tag == QLatin1String("slot")) { setElementSlot(reader.readElementText()); continue; } - if (tag == QStringLiteral("hints")) { + if (tag == QLatin1String("hints")) { DomConnectionHints *v = new DomConnectionHints(); v->read(reader); setElementHints(v); @@ -8321,7 +8321,7 @@ void DomConnectionHints::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("hint")) { + if (tag == QLatin1String("hint")) { DomConnectionHint *v = new DomConnectionHint(); v->read(reader); m_hint.append(v); @@ -8393,7 +8393,7 @@ void DomConnectionHint::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QStringLiteral("type")) { + if (name == QLatin1String("type")) { setAttributeType(attribute.value().toString()); continue; } @@ -8404,11 +8404,11 @@ void DomConnectionHint::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QString(QLatin1Char('x'))) { + if (tag == QLatin1String("x")) { setElementX(reader.readElementText().toInt()); continue; } - if (tag == QString(QLatin1Char('y'))) { + if (tag == QLatin1String("y")) { setElementY(reader.readElementText().toInt()); continue; } @@ -8499,11 +8499,11 @@ void DomScript::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QStringLiteral("source")) { + if (name == QLatin1String("source")) { setAttributeSource(attribute.value().toString()); continue; } - if (name == QStringLiteral("language")) { + if (name == QLatin1String("language")) { setAttributeLanguage(attribute.value().toString()); continue; } @@ -8576,7 +8576,7 @@ void DomWidgetData::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("property")) { + if (tag == QLatin1String("property")) { DomProperty *v = new DomProperty(); v->read(reader); m_property.append(v); @@ -8648,7 +8648,7 @@ void DomDesignerData::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("property")) { + if (tag == QLatin1String("property")) { DomProperty *v = new DomProperty(); v->read(reader); m_property.append(v); @@ -8720,11 +8720,11 @@ void DomSlots::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("signal")) { + if (tag == QLatin1String("signal")) { m_signal.append(reader.readElementText()); continue; } - if (tag == QStringLiteral("slot")) { + if (tag == QLatin1String("slot")) { m_slot.append(reader.readElementText()); continue; } @@ -8804,7 +8804,7 @@ void DomPropertySpecifications::read(QXmlStreamReader &reader) switch (reader.readNext()) { case QXmlStreamReader::StartElement : { const QString tag = reader.name().toString().toLower(); - if (tag == QStringLiteral("stringpropertyspecification")) { + if (tag == QLatin1String("stringpropertyspecification")) { DomStringPropertySpecification *v = new DomStringPropertySpecification(); v->read(reader); m_stringpropertyspecification.append(v); @@ -8876,15 +8876,15 @@ void DomStringPropertySpecification::read(QXmlStreamReader &reader) foreach (const QXmlStreamAttribute &attribute, reader.attributes()) { QStringRef name = attribute.name(); - if (name == QStringLiteral("name")) { + if (name == QLatin1String("name")) { setAttributeName(attribute.value().toString()); continue; } - if (name == QStringLiteral("type")) { + if (name == QLatin1String("type")) { setAttributeType(attribute.value().toString()); continue; } - if (name == QStringLiteral("notr")) { + if (name == QLatin1String("notr")) { setAttributeNotr(attribute.value().toString()); continue; } -- cgit v1.2.3 From 46d3c25980cac2592c4ad07a927f1f9a4a9e0f53 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 28 Jan 2015 09:51:18 +0100 Subject: Partially revert "QFixed: fix undefined behavior" This partially reverts commit 1755038134cfe16d3d52ec2aea543955462e2951, which did not only fix undefined (signed left-shift), but also implementation-defined (signed right-shift) behavior. It turned out that code depends on a particular implementation behavior (logical instead of arithmetic right-shift), and needs to be fixed first. Change-Id: I9ba32d06f127d17d05e0c6f6eac3d26268587bca Reviewed-by: Olivier Goffart (Woboq GmbH) Reviewed-by: Eike Ziller --- src/gui/painting/qfixed_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/painting/qfixed_p.h b/src/gui/painting/qfixed_p.h index a0ac69f02f..68314d0434 100644 --- a/src/gui/painting/qfixed_p.h +++ b/src/gui/painting/qfixed_p.h @@ -70,7 +70,7 @@ public: Q_DECL_CONSTEXPR inline int toInt() const { return (((val)+32) & -64)>>6; } Q_DECL_CONSTEXPR inline qreal toReal() const { return ((qreal)val)/(qreal)64; } - Q_DECL_CONSTEXPR inline int truncate() const { return val / 64; } + Q_DECL_CONSTEXPR inline int truncate() const { return val>>6; } Q_DECL_CONSTEXPR inline QFixed round() const { return fromFixed(((val)+32) & -64); } Q_DECL_CONSTEXPR inline QFixed floor() const { return fromFixed((val) & -64); } Q_DECL_CONSTEXPR inline QFixed ceil() const { return fromFixed((val+63) & -64); } -- cgit v1.2.3 From 2b9949169273efa0c918a168c340aa0d837911fb Mon Sep 17 00:00:00 2001 From: Dyami Caliri Date: Fri, 10 Oct 2014 09:56:13 -0700 Subject: Fix leaks in OS X bundle detection There were several leaked CFStringRefs in the new OS X bundle detection code that is part of QFileSystemEngine. Change-Id: Id0817e9692da411c7eb8287b9bf71b99ae28f960 Reviewed-by: Thiago Macieira Reviewed-by: Samuel Gaist Reviewed-by: Jake Petroules --- src/corelib/io/qfilesystemengine_unix.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index cd42aff35c..bfa4483ca7 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -83,13 +83,13 @@ static bool isPackage(const QFileSystemMetaData &data, const QFileSystemEntry &e if (suffix.length() > 0) { // First step: is the extension known ? - CFStringRef extensionRef = QCFString::toCFStringRef(suffix); - CFStringRef uniformTypeIdentifier = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, extensionRef, NULL); + QCFType extensionRef = QCFString::toCFStringRef(suffix); + QCFType uniformTypeIdentifier = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, extensionRef, NULL); if (UTTypeConformsTo(uniformTypeIdentifier, kUTTypeBundle)) return true; // Second step: check if an application knows the package type - CFStringRef path = QCFString::toCFStringRef(entry.filePath()); + QCFType path = QCFString::toCFStringRef(entry.filePath()); QCFType url = CFURLCreateWithFileSystemPath(0, path, kCFURLPOSIXPathStyle, true); UInt32 type, creator; -- cgit v1.2.3 From 2a27fc41a418cc3fda26334fdbaf1e31c9eecce5 Mon Sep 17 00:00:00 2001 From: Dyami Caliri Date: Mon, 26 Jan 2015 14:45:09 -0800 Subject: Fix QGraphicsWidget window frame section logic CppCat detected duplicate sub-expressions in the code that checked for BottomLeftSection and BottomRightSection. It was fairly obvious to see what the values should be. Change-Id: Id45ca5bbd26c92b800c60867fef5170578216eee Reviewed-by: Andreas Aardal Hanssen --- src/widgets/graphicsview/qgraphicswidget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/widgets/graphicsview/qgraphicswidget.cpp b/src/widgets/graphicsview/qgraphicswidget.cpp index 5bd563e535..98e011ff05 100644 --- a/src/widgets/graphicsview/qgraphicswidget.cpp +++ b/src/widgets/graphicsview/qgraphicswidget.cpp @@ -1311,7 +1311,7 @@ Qt::WindowFrameSection QGraphicsWidget::windowFrameSectionAt(const QPointF &pos) if (x <= left + cornerMargin) { if (y <= top + windowFrameWidth || (x <= left + windowFrameWidth && y <= top + cornerMargin)) { s = Qt::TopLeftSection; - } else if (y >= bottom - windowFrameWidth || (x <= left + windowFrameWidth && y >= bottom - windowFrameWidth)) { + } else if (y >= bottom - windowFrameWidth || (x <= left + windowFrameWidth && y >= bottom - cornerMargin)) { s = Qt::BottomLeftSection; } else if (x <= left + windowFrameWidth) { s = Qt::LeftSection; @@ -1319,7 +1319,7 @@ Qt::WindowFrameSection QGraphicsWidget::windowFrameSectionAt(const QPointF &pos) } else if (x >= right - cornerMargin) { if (y <= top + windowFrameWidth || (x >= right - windowFrameWidth && y <= top + cornerMargin)) { s = Qt::TopRightSection; - } else if (y >= bottom - windowFrameWidth || (x >= right - windowFrameWidth && y >= bottom - windowFrameWidth)) { + } else if (y >= bottom - windowFrameWidth || (x >= right - windowFrameWidth && y >= bottom - cornerMargin)) { s = Qt::BottomRightSection; } else if (x >= right - windowFrameWidth) { s = Qt::RightSection; -- cgit v1.2.3 From 392d8b5a75b4ac70b3dc4e856793771d86c50d82 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 26 Jan 2015 15:20:07 +0100 Subject: Windows: Fix screen changed emission for programmatic moves. Assign geometry in setGeometryDp() only when minimized as otherwise the variable will be set by the handling of the resize event triggered by setGeometry_sys()handleGeometryChange(). As it is, it suppresses the emission of screen change signals for programmatic move operations since the move is not detected. Change-Id: I5cd32bb16fd41dd720c16ddf84b88df642677af7 Task-number: QTBUG-44070 Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowswindow.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 65bc9742e4..c268954314 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -1356,7 +1356,8 @@ void QWindowsWindow::setGeometryDp(const QRect &rectIn) const QMargins margins = frameMarginsDp(); rect.moveTopLeft(rect.topLeft() + QPoint(margins.left(), margins.top())); } - m_data.geometry = rect; + if (m_windowState == Qt::WindowMinimized) + m_data.geometry = rect; // Otherwise set by handleGeometryChange() triggered by event. if (m_data.hwnd) { // A ResizeEvent with resulting geometry will be sent. If we cannot // achieve that size (for example, window title minimal constraint), -- cgit v1.2.3 From c96b5d2b062e2757772a81927936e2a81be41c8e Mon Sep 17 00:00:00 2001 From: Daiwei Li Date: Thu, 22 Jan 2015 02:32:27 -0800 Subject: Cocoa: Keep menu invisible when adding it to a menubar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In MenuBar.qml, it's possible for __isNative to be set after visible on a child QQuickMenu. In that case, the qcocoamenu.mm will have set submenu to nil, only to be overridden in insertNativeMenu when __isNative is set. Change-Id: Id3c6bca03f937528d05b166cbd6a6d1011db43e8 Task-number: QTBUG-44168 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoamenubar.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qcocoamenubar.mm b/src/plugins/platforms/cocoa/qcocoamenubar.mm index aceb9b619b..0b46508782 100644 --- a/src/plugins/platforms/cocoa/qcocoamenubar.mm +++ b/src/plugins/platforms/cocoa/qcocoamenubar.mm @@ -100,7 +100,9 @@ void QCocoaMenuBar::insertNativeMenu(QCocoaMenu *menu, QCocoaMenu *beforeMenu) menu->setMenuBar(this); syncMenu(static_cast(menu)); - [m_nativeMenu setSubmenu: menu->nsMenu() forItem: menu->nsMenuItem()]; + if (menu->isVisible()) { + [m_nativeMenu setSubmenu: menu->nsMenu() forItem: menu->nsMenuItem()]; + } } void QCocoaMenuBar::insertMenu(QPlatformMenu *platformMenu, QPlatformMenu *before) -- cgit v1.2.3 From 10c62c894c25aa1224bc3441fd564430cf7c8103 Mon Sep 17 00:00:00 2001 From: Dyami Caliri Date: Fri, 24 Oct 2014 12:57:09 -0700 Subject: CoreWLan: properly wait for scan thread to finish MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Terminating the scan thread is leading to crashes. So was the previous solution to use wait(5000), since the scan thread may take longer than that. Task-number: QTBUG-36000 Change-Id: I5c37ba5ba3f5c156fca30f3dacaa998c15f76be8 Reviewed-by: Morten Johan Sørvig --- src/plugins/bearer/corewlan/qcorewlanengine.mm | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index 55847a04a4..2b38409723 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -430,7 +430,6 @@ QCoreWlanEngine::QCoreWlanEngine(QObject *parent) QCoreWlanEngine::~QCoreWlanEngine() { - scanThread->terminate(); scanThread->wait(); while (!foundConfigurations.isEmpty()) -- cgit v1.2.3 From c88e354993f8db3da741b1492f7578e9e0fdb07f Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 21 Jan 2015 16:18:00 +0100 Subject: Windows: Rewrite font database to use delayed population. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-43774 Change-Id: I3b0b0ead0953b3b88a6d0092c694a2a00f70acf7 Reviewed-by: Eskil Abrahamsen Blomfeldt Reviewed-by: Konstantin Ritt Reviewed-by: Tor Arne Vestbø --- .../platforms/windows/qwindowsfontdatabase.cpp | 83 +++++++++++++--------- .../platforms/windows/qwindowsfontdatabase.h | 3 +- 2 files changed, 51 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index 246032dc94..9c26a227b8 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -946,9 +946,8 @@ static bool addFontToDatabase(const QString &familyName, uchar charSet, } static int QT_WIN_CALLBACK storeFont(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *textmetric, - int type, LPARAM namesSetIn) + int type, LPARAM) { - typedef QSet StringSet; const QString familyName = QString::fromWCharArray(f->elfLogFont.lfFaceName); const uchar charSet = f->elfLogFont.lfCharSet; @@ -957,51 +956,69 @@ static int QT_WIN_CALLBACK storeFont(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *textmetr // NEWTEXTMETRICEX is a NEWTEXTMETRIC, which according to the documentation is // identical to a TEXTMETRIC except for the last four members, which we don't use // anyway - if (addFontToDatabase(familyName, charSet, (TEXTMETRIC *)textmetric, &signature, type)) - reinterpret_cast(namesSetIn)->insert(familyName); + addFontToDatabase(familyName, charSet, (TEXTMETRIC *)textmetric, &signature, type); // keep on enumerating return 1; } -void QWindowsFontDatabase::populateFontDatabase() +void QWindowsFontDatabase::populateFamily(const QString &familyName) { - m_families.clear(); - removeApplicationFonts(); - populate(); // Called multiple times. - // Work around EnumFontFamiliesEx() not listing the system font, see below. - const QString sysFontFamily = QGuiApplication::font().family(); - if (!m_families.contains(sysFontFamily)) - populate(sysFontFamily); + qCDebug(lcQpaFonts) << familyName; + if (familyName.size() >= LF_FACESIZE) { + qCWarning(lcQpaFonts) << "Unable to enumerate family '" << familyName << '\''; + return; + } + HDC dummy = GetDC(0); + LOGFONT lf; + lf.lfCharSet = DEFAULT_CHARSET; + familyName.toWCharArray(lf.lfFaceName); + lf.lfFaceName[familyName.size()] = 0; + lf.lfPitchAndFamily = 0; + EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFont, 0, 0); + ReleaseDC(0, dummy); } -/*! - \brief Populate font database using EnumFontFamiliesEx(). - - Normally, leaving the name empty should enumerate - all fonts, however, system fonts like "MS Shell Dlg 2" - are only found when specifying the name explicitly. -*/ +namespace { +// Context for enumerating system fonts, records whether the default font has been encountered, +// which is normally not enumerated by EnumFontFamiliesEx(). +struct PopulateFamiliesContext +{ + PopulateFamiliesContext(const QString &f) : systemDefaultFont(f), seenSystemDefaultFont(false) {} -void QWindowsFontDatabase::populate(const QString &family) - { + QString systemDefaultFont; + bool seenSystemDefaultFont; +}; +} // namespace - qCDebug(lcQpaFonts) << __FUNCTION__ << m_families.size() << family; +static int QT_WIN_CALLBACK populateFontFamilies(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *, int, LPARAM lparam) +{ + // the "@family" fonts are just the same as "family". Ignore them. + const wchar_t *faceNameW = f->elfLogFont.lfFaceName; + if (faceNameW[0] && faceNameW[0] != L'@' && wcsncmp(faceNameW, L"WST_", 4)) { + const QString faceName = QString::fromWCharArray(faceNameW); + QPlatformFontDatabase::registerFontFamily(faceName); + PopulateFamiliesContext *context = reinterpret_cast(lparam); + if (!context->seenSystemDefaultFont && faceName == context->systemDefaultFont) + context->seenSystemDefaultFont = true; + } + return 1; // continue +} +void QWindowsFontDatabase::populateFontDatabase() +{ + removeApplicationFonts(); HDC dummy = GetDC(0); LOGFONT lf; lf.lfCharSet = DEFAULT_CHARSET; - if (family.size() >= LF_FACESIZE) { - qWarning("%s: Unable to enumerate family '%s'.", - __FUNCTION__, qPrintable(family)); - return; - } - wmemcpy(lf.lfFaceName, reinterpret_cast(family.utf16()), - family.size() + 1); + lf.lfFaceName[0] = 0; lf.lfPitchAndFamily = 0; - EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFont, - (LPARAM)&m_families, 0); + PopulateFamiliesContext context(QWindowsFontDatabase::systemDefaultFont().family()); + EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)populateFontFamilies, reinterpret_cast(&context), 0); ReleaseDC(0, dummy); + // Work around EnumFontFamiliesEx() not listing the system font. + if (!context.seenSystemDefaultFont) + QPlatformFontDatabase::registerFontFamily(context.systemDefaultFont); } typedef QSharedPointer QWindowsFontEngineDataPtr; @@ -1365,7 +1382,7 @@ QStringList QWindowsFontDatabase::addApplicationFont(const QByteArray &fontData, // Fonts based on files are added via populate, as they will show up in font enumeration. for (int j = 0; j < families.count(); ++j) - populate(families.at(j)); + populateFamily(families.at(j)); } m_applicationFonts << font; @@ -1645,7 +1662,7 @@ QStringList QWindowsFontDatabase::fallbacksForFamily(const QString &family, QFon result.append(QWindowsFontDatabase::extraTryFontsForFamily(family)); qCDebug(lcQpaFonts) << __FUNCTION__ << family << style << styleHint - << script << result << m_families.size(); + << script << result; return result; } diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.h b/src/plugins/platforms/windows/qwindowsfontdatabase.h index 4abf2d703e..8a682e6bec 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.h +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.h @@ -70,6 +70,7 @@ public: ~QWindowsFontDatabase(); void populateFontDatabase() Q_DECL_OVERRIDE; + void populateFamily(const QString &familyName) Q_DECL_OVERRIDE; QFontEngineMulti *fontEngineMulti(QFontEngine *fontEngine, QChar::Script script) Q_DECL_OVERRIDE; QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) Q_DECL_OVERRIDE; QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) Q_DECL_OVERRIDE; @@ -99,9 +100,7 @@ public: static QString familyForStyleHint(QFont::StyleHint styleHint); private: - void populate(const QString &family = QString()); void removeApplicationFonts(); - QSet m_families; struct WinApplicationFont { HANDLE handle; -- cgit v1.2.3 From eb92a531c0bb237613f3f4948048e61af83dad77 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 20 Jan 2015 11:17:02 +0100 Subject: QWindowContainer: Restrict check for negative position to child windows. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise, the code triggers for top level windows in setups with multimonitors where the primary screen is on the right and the left monitor has negative coordinates. Task-number: QTBUG-43879 Task-number: QTBUG-38475 Change-Id: Ied3ee6dc59bd784e11db22031d2090cc6f42ef8b Reviewed-by: Jan Arve Sæther --- src/widgets/kernel/qwindowcontainer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp index 34cfb2d99f..5460a43ef4 100644 --- a/src/widgets/kernel/qwindowcontainer.cpp +++ b/src/widgets/kernel/qwindowcontainer.cpp @@ -64,7 +64,7 @@ public: void updateGeometry() { Q_Q(QWindowContainer); - if (q->geometry().bottom() <= 0 || q->geometry().right() <= 0) + if (!q->isWindow() && (q->geometry().bottom() <= 0 || q->geometry().right() <= 0)) /* Qt (e.g. QSplitter) sometimes prefer to hide a widget by *not* calling setVisible(false). This is often done by setting its coordinates to a sufficiently negative value so that its clipped outside the parent. Since a QWindow is not clipped -- cgit v1.2.3 From 912f1ebaad29e5a0b8acba48691a565ba56c6b9e Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 23 Jan 2015 16:39:12 +0100 Subject: Windows: Pass geometry in device-independent pixel when determining screen. Fixes the emission of QWindow::screenChanged() when running with QT_DEVICE_PIXEL_RATIO != 1. QPlatformScreen::screenForGeometry() takes device-independent pixel. Task-number: QTBUG-44070 Change-Id: I963ecf62743d06784d62bc2f467e09fe5474e57f Reviewed-by: Alessandro Portale --- src/plugins/platforms/windows/qwindowswindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index c268954314..0216b40e3e 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -1432,7 +1432,7 @@ void QWindowsWindow::handleGeometryChange() fireExpose(QRect(QPoint(0, 0), m_data.geometry.size()), true); } if (previousGeometry.topLeft() != m_data.geometry.topLeft()) { - QPlatformScreen *newScreen = screenForGeometry(m_data.geometry); + QPlatformScreen *newScreen = screenForGeometry(geometryDip); if (newScreen != screen()) QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->screen()); } -- cgit v1.2.3 From b85b78f17d3d18887b409a3ce9d2f2c71ae68844 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 27 Jan 2015 16:53:48 +0100 Subject: Suppress Ctrl/Ctrl+Shift keypresses in line/text edits. Ctrl/Ctrl+Shift should not cause any characters to be input (as opposed to AltGr(Alt+Ctrl) as used on German keyboards). Extend the tests in QLineEdit and QPlainTextEdit to check the modifiers, remove test from QTextEdit since it is handled by QWidgetTextControl. Task-number: QTBUG-35734 Change-Id: Ie0004fac68cf840c68247f27547e84b021355cd2 Reviewed-by: Gatis Paeglis --- src/widgets/widgets/qwidgetlinecontrol.cpp | 5 ++++- src/widgets/widgets/qwidgettextcontrol.cpp | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp index 7033eeea22..86a830a9f9 100644 --- a/src/widgets/widgets/qwidgetlinecontrol.cpp +++ b/src/widgets/widgets/qwidgetlinecontrol.cpp @@ -1879,7 +1879,10 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event) unknown = false; } - if (unknown && !isReadOnly()) { + // QTBUG-35734: ignore Ctrl/Ctrl+Shift; accept only AltGr (Alt+Ctrl) on German keyboards + if (unknown && !isReadOnly() + && event->modifiers() != Qt::ControlModifier + && event->modifiers() != (Qt::ControlModifier | Qt::ShiftModifier)) { QString t = event->text(); if (!t.isEmpty() && t.at(0).isPrint()) { insert(t); diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp index 8c48533a03..2e1e87be72 100644 --- a/src/widgets/widgets/qwidgettextcontrol.cpp +++ b/src/widgets/widgets/qwidgettextcontrol.cpp @@ -1339,6 +1339,12 @@ void QWidgetTextControlPrivate::keyPressEvent(QKeyEvent *e) process: { + // QTBUG-35734: ignore Ctrl/Ctrl+Shift; accept only AltGr (Alt+Ctrl) on German keyboards + if (e->modifiers() == Qt::ControlModifier + || e->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier)) { + e->ignore(); + return; + } QString text = e->text(); if (!text.isEmpty() && (text.at(0).isPrint() || text.at(0) == QLatin1Char('\t'))) { if (overwriteMode -- cgit v1.2.3 From cd7a36d341c84f2595a33ceeb6ac7458978f30e1 Mon Sep 17 00:00:00 2001 From: Arnaud Bienner Date: Thu, 29 Jan 2015 21:35:37 +0100 Subject: QHeaderView: check that length is correct and fix restoring Qt4 state. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When multiple sections were grouped together, sectionItem.size was the total size of grouped sections, not the size of one section. Length is supposed to be equal to the section items length, but the state saved might be corrupted. Task-number: QTBUG-40462 Change-Id: I401a1583dd30880ccf5b4c105a237d6563f212e8 Reviewed-by: Thorbjørn Lund Martsum --- src/widgets/itemviews/qheaderview.cpp | 77 ++++++++++++++++++++++++----------- 1 file changed, 54 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index beade16339..fe99f7a5e0 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -3641,6 +3641,17 @@ bool QHeaderViewPrivate::read(QDataStream &in) QVector visualIndicesIn; QVector logicalIndicesIn; QHash hiddenSectionSizeIn; + bool movableSectionsIn; + bool clickableSectionsIn; + bool highlightSelectedIn; + bool stretchLastSectionIn; + bool cascadingResizingIn; + int stretchSectionsIn; + int contentsSectionsIn; + int defaultSectionSizeIn; + int minimumSectionSizeIn; + QVector sectionItemsIn; + in >> orient; in >> order; @@ -3662,6 +3673,39 @@ bool QHeaderViewPrivate::read(QDataStream &in) if (in.status() != QDataStream::Ok || lengthIn < 0) return false; + in >> movableSectionsIn; + in >> clickableSectionsIn; + in >> highlightSelectedIn; + in >> stretchLastSectionIn; + in >> cascadingResizingIn; + in >> stretchSectionsIn; + in >> contentsSectionsIn; + in >> defaultSectionSizeIn; + in >> minimumSectionSizeIn; + + in >> align; + + in >> global; + + in >> sectionItemsIn; + // In Qt4 we had a vector of spans where one span could hold information on more sections. + // Now we have an itemvector where one items contains information about one section + // For backward compatibility with Qt4 we do the following + QVector newSectionItems; + for (int u = 0; u < sectionItemsIn.count(); ++u) { + int count = sectionItemsIn.at(u).tmpDataStreamSectionCount; + if (count > 0) + sectionItemsIn[u].size /= count; + for (int n = 0; n < count; ++n) + newSectionItems.append(sectionItemsIn[u]); + } + + int sectionItemsLengthTotal = 0; + foreach (const SectionItem §ion, newSectionItems) + sectionItemsLengthTotal += section.size; + if (sectionItemsLengthTotal != lengthIn) + return false; + orientation = static_cast(orient); sortIndicatorOrder = static_cast(order); sortIndicatorSection = sortIndicatorSectionIn; @@ -3671,32 +3715,19 @@ bool QHeaderViewPrivate::read(QDataStream &in) hiddenSectionSize = hiddenSectionSizeIn; length = lengthIn; - in >> movableSections; - in >> clickableSections; - in >> highlightSelected; - in >> stretchLastSection; - in >> cascadingResizing; - in >> stretchSections; - in >> contentsSections; - in >> defaultSectionSize; - in >> minimumSectionSize; + movableSections = movableSectionsIn; + clickableSections = clickableSectionsIn; + highlightSelected = highlightSelectedIn; + stretchLastSection = stretchLastSectionIn; + cascadingResizing = cascadingResizingIn; + stretchSections = stretchSectionsIn; + contentsSections = contentsSectionsIn; + defaultSectionSize = defaultSectionSizeIn; + minimumSectionSize = minimumSectionSizeIn; - in >> align; defaultAlignment = Qt::Alignment(align); + globalResizeMode = static_cast(global); - in >> global; - globalResizeMode = (QHeaderView::ResizeMode)global; - - in >> sectionItems; - // In Qt4 we had a vector of spans where one span could hold information on more sections. - // Now we have an itemvector where one items contains information about one section - // For backward compatibility with Qt4 we do the following - QVector newSectionItems; - for (int u = 0; u < sectionItems.count(); ++u) { - int count = sectionItems.at(u).tmpDataStreamSectionCount; - for (int n = 0; n < count; ++n) - newSectionItems.append(sectionItems[u]); - } sectionItems = newSectionItems; setHiddenSectionsFromBitVector(sectionHidden); recalcSectionStartPos(); -- cgit v1.2.3 From 9718cb330cb479ec6e91f1f10c5ee9097fa2f4fb Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Thu, 29 Jan 2015 12:13:53 +0100 Subject: CMake: Fix QObject::connect failing on ARM We need PIE, doesn't matter if reduce_relocations is used or not Change-Id: I9a359b9d4443a6059980cd4c48058132ec4267fe Reviewed-by: Simon Hausmann Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/Qt5CoreConfigExtras.cmake.in | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in index 9bda70ec07..4387bedc44 100644 --- a/src/corelib/Qt5CoreConfigExtras.cmake.in +++ b/src/corelib/Qt5CoreConfigExtras.cmake.in @@ -66,14 +66,12 @@ list(APPEND Qt5Core_INCLUDE_DIRS ${_qt5_corelib_extra_includes}) set_property(TARGET Qt5::Core APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${_qt5_corelib_extra_includes}) set(_qt5_corelib_extra_includes) -!!IF !isEmpty(CMAKE_ADD_FPIE_FLAGS) # Targets using Qt need to use the POSITION_INDEPENDENT_CODE property. The # Qt5_POSITION_INDEPENDENT_CODE variable is used in the # qt5_use_module # macro to add it. set(Qt5_POSITION_INDEPENDENT_CODE True) set_property(TARGET Qt5::Core PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE \"ON\") set(Qt5Core_EXECUTABLE_COMPILE_FLAGS \"-fPIE\") -!!ENDIF !!IF !isEmpty(QT_NAMESPACE) list(APPEND Qt5Core_DEFINITIONS -DQT_NAMESPACE=$$QT_NAMESPACE) -- cgit v1.2.3 From f562244f33dc0e7068cc651ee558597d9597b299 Mon Sep 17 00:00:00 2001 From: Joni Poikelin Date: Wed, 21 Jan 2015 14:55:30 +0200 Subject: Fix argv parameter to main() on Windows Task-number: QTBUG-44050 Change-Id: I5b7ddec9d66158d8075ab091b01e883520e5414e Reviewed-by: Friedemann Kleint --- src/winmain/qtmain_win.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/winmain/qtmain_win.cpp b/src/winmain/qtmain_win.cpp index 778ddee64b..25b79543ba 100644 --- a/src/winmain/qtmain_win.cpp +++ b/src/winmain/qtmain_win.cpp @@ -105,9 +105,10 @@ extern "C" int APIENTRY WinMain(HINSTANCE, HINSTANCE, LPSTR /*cmdParamarg*/, int wchar_t **argvW = CommandLineToArgvW(GetCommandLineW(), &argc); if (!argvW) return -1; - char **argv = new char *[argc]; + char **argv = new char *[argc + 1]; for (int i = 0; i < argc; ++i) argv[i] = wideToMulti(CP_ACP, argvW[i]); + argv[argc] = Q_NULLPTR; LocalFree(argvW); const int exitCode = main(argc, argv); for (int i = 0; i < argc; ++i) -- cgit v1.2.3 From 1b329bfc79d34d7859e27a1fc2aa6eb58e690dbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Thu, 22 Jan 2015 14:59:19 +0100 Subject: Cocoa: Don't crash on no target window. findEventTargetWindow() will return 0 if m_window is a top-level window with Qt::WindowTransparentForInput set. Change-Id: I413dabf2a8993b0522653c4e586bb304b642f3ed Task-number: QTBUG-44013 Reviewed-by: Timur Pocheptsov Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qnsview.mm | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 771b464805..5d3befa25b 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -1824,6 +1824,8 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin Qt::DropActions qtAllowed = qt_mac_mapNSDragOperations([sender draggingSourceOperationMask]); QWindow *target = findEventTargetWindow(m_window); + if (!target) + return NSDragOperationNone; // update these so selecting move/copy/link works QGuiApplicationPrivate::modifier_buttons = [QNSView convertKeyModifiers: [[NSApp currentEvent] modifierFlags]]; @@ -1843,6 +1845,8 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin - (void)draggingExited:(id )sender { QWindow *target = findEventTargetWindow(m_window); + if (!target) + return; NSPoint windowPoint = [self convertPoint: [sender draggingLocation] fromView: nil]; QPoint qt_windowPoint(windowPoint.x, windowPoint.y); @@ -1855,6 +1859,8 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin - (BOOL)performDragOperation:(id )sender { QWindow *target = findEventTargetWindow(m_window); + if (!target) + return false; NSPoint windowPoint = [self convertPoint: [sender draggingLocation] fromView: nil]; QPoint qt_windowPoint(windowPoint.x, windowPoint.y); @@ -1880,6 +1886,8 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin Q_UNUSED(img); Q_UNUSED(operation); QWindow *target = findEventTargetWindow(m_window); + if (!target) + return; // keep our state, and QGuiApplication state (buttons member) in-sync, // or future mouse events will be processed incorrectly -- cgit v1.2.3 From 5bd41b850f65b8054d94b58b787704bb45ede16c Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 2 Feb 2015 11:37:41 +0100 Subject: Correct inplace conversion methods from RGBA8888 formats The methods for inplace conversion from RGBA to ARGB was misplaced by one step causing conversion to RGB16 to get an invalid method. Change-Id: I3b2b4cffe993705c48613eec7d9b7c6213f57fc2 Reviewed-by: Gunnar Sletta --- src/gui/image/qimage_conversions.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp index 858a0d9f21..b2681f4261 100644 --- a/src/gui/image/qimage_conversions.cpp +++ b/src/gui/image/qimage_conversions.cpp @@ -2520,7 +2520,7 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma 0, 0, 0, - 0, + convert_RGBA_to_ARGB_inplace, convert_RGBA_to_ARGB_inplace, convert_RGBA_to_ARGB_inplace, 0, @@ -2543,7 +2543,6 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma 0, 0, 0, - 0, convert_RGBA_to_ARGB_inplace, convert_RGBA_to_ARGB_PM_inplace, 0, @@ -2557,6 +2556,7 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma 0, 0, 0, + 0, 0, 0, 0, 0 }, // Format_RGBA8888 { @@ -2566,7 +2566,6 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma 0, 0, 0, - 0, convert_RGBA_to_ARGB_inplace, 0, 0, @@ -2579,6 +2578,7 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma 0, 0, 0, + 0, 0, 0, 0, 0 }, // Format_RGBA8888_Premultiplied { -- cgit v1.2.3 From a2bcf43eb974d6ca725c11e06f1621db1d488892 Mon Sep 17 00:00:00 2001 From: Dyami Caliri Date: Mon, 2 Feb 2015 12:43:59 -0800 Subject: Set dpr of QImage in QOpenGLWidget grabFramebuffer The QImage returned from grabFramebuffer should have the dpr of the source. Change-Id: Iafeabc1ab4e032fc28b73307104917ba3e898ad5 Reviewed-by: Laszlo Agocs --- src/widgets/kernel/qopenglwidget.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp index db116b070c..12e054626c 100644 --- a/src/widgets/kernel/qopenglwidget.cpp +++ b/src/widgets/kernel/qopenglwidget.cpp @@ -758,6 +758,7 @@ QImage QOpenGLWidgetPrivate::grabFramebuffer() resolveSamples(); q->makeCurrent(); QImage res = qt_gl_read_framebuffer(q->size() * q->devicePixelRatio(), false, false); + res.setDevicePixelRatio(q->devicePixelRatio()); return res; } -- cgit v1.2.3 From 276de71be7309601963c87d0f3a658ae399d98e7 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 4 Feb 2015 11:14:08 +0100 Subject: Handle failure of Windows XP theme painting functions for PE_FrameWindow. QWindowsXPStylePrivate::buffer() can fail due to CreateDIBSection() failing for large sizes. Introduce a bool return for the QWindowsXPStylePrivate::drawBackground() helpers and fall back to QWindowsStyle:::drawPrimitive() should that happen for PE_FrameWindow in QWindowsXPStyle::drawPrimitive(). Task-number: QTBUG-44282 Change-Id: I122d84576455bbad8e6639022da5bf64f79aed3a Reviewed-by: Joerg Bornemann --- src/widgets/styles/qwindowsxpstyle.cpp | 45 ++++++++++++++++++++------------ src/widgets/styles/qwindowsxpstyle_p_p.h | 6 ++--- 2 files changed, 31 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp index c1f7b599b3..a16e44cbaa 100644 --- a/src/widgets/styles/qwindowsxpstyle.cpp +++ b/src/widgets/styles/qwindowsxpstyle.cpp @@ -696,16 +696,18 @@ bool QWindowsXPStylePrivate::swapAlphaChannel(const QRect &rect, bool allPixels) - Painter does not have an HDC - Theme part is flipped (mirrored horizontally) else use drawBackgroundDirectly(). + \note drawBackgroundThruNativeBuffer() can return false for large + sizes due to buffer()/CreateDIBSection() failing. */ -void QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData) +bool QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData) { if (themeData.rect.isEmpty()) - return; + return true; QPainter *painter = themeData.painter; Q_ASSERT_X(painter != 0, "QWindowsXPStylePrivate::drawBackground()", "Trying to draw a theme part without a painter"); if (!painter || !painter->isActive()) - return; + return false; painter->save(); @@ -741,13 +743,9 @@ void QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData) } const HDC dc = canDrawDirectly ? hdcForWidgetBackingStore(themeData.widget) : HDC(0); - if (dc) { - drawBackgroundDirectly(themeData); - } else { - drawBackgroundThruNativeBuffer(themeData); - } - + const bool result = dc ? drawBackgroundDirectly(themeData) : drawBackgroundThruNativeBuffer(themeData); painter->restore(); + return result; } /*! \internal @@ -755,7 +753,7 @@ void QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData) Do not use this if you need to perform other transformations on the resulting data. */ -void QWindowsXPStylePrivate::drawBackgroundDirectly(XPThemeData &themeData) +bool QWindowsXPStylePrivate::drawBackgroundDirectly(XPThemeData &themeData) { QPainter *painter = themeData.painter; HDC dc = 0; @@ -830,6 +828,7 @@ void QWindowsXPStylePrivate::drawBackgroundDirectly(XPThemeData &themeData) } SelectClipRgn(dc, 0); DeleteObject(hrgn); + return true; } /*! \internal @@ -840,7 +839,7 @@ void QWindowsXPStylePrivate::drawBackgroundDirectly(XPThemeData &themeData) flips (horizonal mirroring only, vertical are handled by the theme engine). */ -void QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeData) +bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeData) { QPainter *painter = themeData.painter; QRect rect = themeData.rect; @@ -964,7 +963,7 @@ void QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa QImage img; if (!haveCachedPixmap) { // If the pixmap is not cached, generate it! ------------------------- if (!buffer(w, h)) // Ensure a buffer of at least (w, h) in size - return; + return false; HDC dc = bufferHDC(); // Clear the buffer @@ -1017,7 +1016,7 @@ void QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa memset(&data, 0, sizeof(data)); data.dataValid = true; alphaCache.insert(key, data); - return; + return true; } hasAlpha = hasAlphaChannel(rect); if (!hasAlpha && partIsTransparent) @@ -1132,6 +1131,7 @@ void QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa data.hadInvalidAlpha = wasAlphaFixed; alphaCache.insert(key, data); } + return true; } @@ -1860,18 +1860,29 @@ case PE_Frame: if (!theme.isValid()) break; + // May fail due to too-large buffers for large widgets, fall back to Windows style. theme.rect = QRect(option->rect.x(), option->rect.y()+fwidth, option->rect.x()+fwidth, option->rect.height()-fwidth); theme.partId = WP_FRAMELEFT; - d->drawBackground(theme); + if (!d->drawBackground(theme)) { + QWindowsStyle::drawPrimitive(pe, option, p, widget); + return; + } theme.rect = QRect(option->rect.width()-fwidth, option->rect.y()+fwidth, fwidth, option->rect.height()-fwidth); theme.partId = WP_FRAMERIGHT; - d->drawBackground(theme); + if (!d->drawBackground(theme)) { + QWindowsStyle::drawPrimitive(pe, option, p, widget); + return; + } theme.rect = QRect(option->rect.x(), option->rect.height()-fwidth, option->rect.width(), fwidth); theme.partId = WP_FRAMEBOTTOM; - d->drawBackground(theme); + if (!d->drawBackground(theme)) { + QWindowsStyle::drawPrimitive(pe, option, p, widget); + return; + } theme.rect = QRect(option->rect.x(), option->rect.y(), option->rect.width(), option->rect.y()+fwidth); theme.partId = WP_CAPTION; - d->drawBackground(theme); + if (!d->drawBackground(theme)) + QWindowsStyle::drawPrimitive(pe, option, p, widget); return; } break; diff --git a/src/widgets/styles/qwindowsxpstyle_p_p.h b/src/widgets/styles/qwindowsxpstyle_p_p.h index 5027588c93..3bc4a7cd66 100644 --- a/src/widgets/styles/qwindowsxpstyle_p_p.h +++ b/src/widgets/styles/qwindowsxpstyle_p_p.h @@ -398,9 +398,9 @@ public: QRegion region(XPThemeData &themeData); void setTransparency(QWidget *widget, XPThemeData &themeData); - void drawBackground(XPThemeData &themeData); - void drawBackgroundThruNativeBuffer(XPThemeData &themeData); - void drawBackgroundDirectly(XPThemeData &themeData); + bool drawBackground(XPThemeData &themeData); + bool drawBackgroundThruNativeBuffer(XPThemeData &themeData); + bool drawBackgroundDirectly(XPThemeData &themeData); bool hasAlphaChannel(const QRect &rect); bool fixAlphaChannel(const QRect &rect); -- cgit v1.2.3 From b1b262559cb73904ab642d38bb9ffeb515776de2 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 4 Feb 2015 11:24:20 +0100 Subject: QWindowsXPStylePrivate::buffer(): Improve warnings. Task-number: QTBUG-44282 Change-Id: If617db5c6eae410042394f20855892a2c564e808 Reviewed-by: Joerg Bornemann --- src/widgets/styles/qwindowsxpstyle.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp index a16e44cbaa..78f8071461 100644 --- a/src/widgets/styles/qwindowsxpstyle.cpp +++ b/src/widgets/styles/qwindowsxpstyle.cpp @@ -505,13 +505,13 @@ HBITMAP QWindowsXPStylePrivate::buffer(int w, int h) nullBitmap = (HBITMAP)SelectObject(bufferDC, bufferBitmap); if (!bufferBitmap) { - qErrnoWarning("QWindowsXPStylePrivate::buffer(w,h), failed to create dibsection"); + qErrnoWarning("QWindowsXPStylePrivate::buffer(%dx%d), CreateDIBSection() failed.", w, h); bufferW = 0; bufferH = 0; return 0; } if (!bufferPixels) { - qErrnoWarning("QWindowsXPStylePrivate::buffer(w,h), did not allocate pixel data"); + qErrnoWarning("QWindowsXPStylePrivate::buffer(%dx%d), CreateDIBSection() did not allocate pixel data.", w, h); bufferW = 0; bufferH = 0; return 0; -- cgit v1.2.3 From 2e1a76a594c19d23263bb6dae616588eaaf602e3 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 4 Feb 2015 09:05:27 +0100 Subject: Streamline code in QDesktopWidget. Task-number: QTBUG-44070 Task-number: QTBUG-44213 Change-Id: Icbf0547eb521b9f3fcc725066ee4903226ecc630 Reviewed-by: Joerg Bornemann --- src/widgets/kernel/qdesktopwidget.cpp | 35 ++++++++++++++--------------------- src/widgets/kernel/qdesktopwidget_p.h | 2 +- 2 files changed, 15 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/widgets/kernel/qdesktopwidget.cpp b/src/widgets/kernel/qdesktopwidget.cpp index 67264133ef..6698c13270 100644 --- a/src/widgets/kernel/qdesktopwidget.cpp +++ b/src/widgets/kernel/qdesktopwidget.cpp @@ -72,29 +72,22 @@ void QDesktopWidgetPrivate::_q_updateScreens() const QList screenList = QGuiApplication::screens(); const int targetLength = screenList.length(); const int oldLength = screens.length(); - int currentLength = oldLength; // Add or remove screen widgets as necessary - if(currentLength > targetLength) { - QDesktopScreenWidget *screen; - while (currentLength-- > targetLength) { - screen = screens.takeLast(); - delete screen; - } - } - else if (currentLength < targetLength) { - while (currentLength < targetLength) { - QScreen *qScreen = screenList.at(currentLength); - QDesktopScreenWidget *screenWidget = new QDesktopScreenWidget(currentLength++); - screenWidget->setGeometry(qScreen->geometry()); - QObject::connect(qScreen, SIGNAL(geometryChanged(QRect)), - q, SLOT(_q_updateScreens()), Qt::QueuedConnection); - QObject::connect(qScreen, SIGNAL(availableGeometryChanged(QRect)), - q, SLOT(_q_availableGeometryChanged()), Qt::QueuedConnection); - QObject::connect(qScreen, SIGNAL(destroyed()), - q, SLOT(_q_updateScreens()), Qt::QueuedConnection); - screens.append(screenWidget); - } + while (screens.size() > targetLength) + delete screens.takeLast(); + + for (int currentLength = screens.size(); currentLength < targetLength; ++currentLength) { + QScreen *qScreen = screenList.at(currentLength); + QDesktopScreenWidget *screenWidget = new QDesktopScreenWidget(currentLength); + screenWidget->setGeometry(qScreen->geometry()); + QObject::connect(qScreen, SIGNAL(geometryChanged(QRect)), + q, SLOT(_q_updateScreens()), Qt::QueuedConnection); + QObject::connect(qScreen, SIGNAL(availableGeometryChanged(QRect)), + q, SLOT(_q_availableGeometryChanged()), Qt::QueuedConnection); + QObject::connect(qScreen, SIGNAL(destroyed()), + q, SLOT(_q_updateScreens()), Qt::QueuedConnection); + screens.append(screenWidget); } QRegion virtualGeometry; diff --git a/src/widgets/kernel/qdesktopwidget_p.h b/src/widgets/kernel/qdesktopwidget_p.h index 62f4d8ed6f..9cd57e7110 100644 --- a/src/widgets/kernel/qdesktopwidget_p.h +++ b/src/widgets/kernel/qdesktopwidget_p.h @@ -65,7 +65,7 @@ class QDesktopWidgetPrivate : public QWidgetPrivate { Q_DECLARE_PUBLIC(QDesktopWidget) public: - ~QDesktopWidgetPrivate() {foreach(QDesktopScreenWidget *s, screens) delete s; } + ~QDesktopWidgetPrivate() { qDeleteAll(screens); } void _q_updateScreens(); void _q_availableGeometryChanged(); -- cgit v1.2.3 From 83a3292342f70ba3bdc636c38031c6a1a74646c3 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 4 Feb 2015 01:16:35 +0100 Subject: QPair: work around std::move not being constexpr in C++11 Use a static_cast instead. This is not 100% equivalent, since it's missing remove_reference<>, which we don't want to depend on and whose emulation in qtypetraits.h is missing rvalue support. That will be fixed in dev. Change-Id: Ib03754c81c904932943d3a5415b54ff107f4719d Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/tools/qpair.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/tools/qpair.h b/src/corelib/tools/qpair.h index b2217e4dd0..76b7abd263 100644 --- a/src/corelib/tools/qpair.h +++ b/src/corelib/tools/qpair.h @@ -56,7 +56,9 @@ struct QPair { first = p.first; second = p.second; return *this; } #ifdef Q_COMPILER_RVALUE_REFS template - Q_DECL_CONSTEXPR QPair(QPair &&p) : first(std::move(p.first)), second(std::move(p.second)) {} + Q_DECL_CONSTEXPR QPair(QPair &&p) + // can't use std::move here as it's not constexpr in C++11: + : first(static_cast(p.first)), second(static_cast(p.second)) {} template QPair &operator=(QPair &&p) { first = std::move(p.first); second = std::move(p.second); return *this; } -- cgit v1.2.3 From dcedbce99a28a0a07c664ac264820412406a963e Mon Sep 17 00:00:00 2001 From: Antonio Lotti Date: Wed, 17 Dec 2014 15:55:09 +0100 Subject: Windows : fix call to LookupAccountNameW The call to LookupAccountNameW from advapi32 was rewritten following the example: http://msdn.microsoft.com/en-us/library/aa392742%28v=vs.85%29.aspx This prevents the generation of a garbage pointer when accessing QWindowsSystemProxy::init() for Qt compiled as 64bit library with MinGW-w64. Task-number: QTBUG-39874 Task-number: QTBUG-38145 Change-Id: I620b2fa64941f84838f9a386851480285336e8d1 Reviewed-by: Friedemann Kleint Reviewed-by: Richard J. Moore --- src/network/kernel/qnetworkproxy_win.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/network/kernel/qnetworkproxy_win.cpp b/src/network/kernel/qnetworkproxy_win.cpp index da2c020a65..f2176d664d 100644 --- a/src/network/kernel/qnetworkproxy_win.cpp +++ b/src/network/kernel/qnetworkproxy_win.cpp @@ -130,10 +130,17 @@ static bool currentProcessIsService() DWORD size = UNLEN; if (ptrGetUserName(userName, &size)) { SID_NAME_USE type = SidTypeUser; - DWORD dummy = MAX_PATH; - wchar_t dummyStr[MAX_PATH] = L""; - PSID psid = 0; - if (ptrLookupAccountName(NULL, userName, &psid, &dummy, dummyStr, &dummy, &type)) + DWORD sidSize = 0; + DWORD domainSize = 0; + // first call is to get the correct size + bool bRet = ptrLookupAccountName(NULL, userName, NULL, &sidSize, NULL, &domainSize, &type); + if (bRet == FALSE && ERROR_INSUFFICIENT_BUFFER != GetLastError()) + return false; + QVarLengthArray buff(sidSize); + QVarLengthArray domainName(domainSize); + // second call to LookupAccountNameW actually gets the SID + // both the pointer to the buffer and the pointer to the domain name should not be NULL + if (ptrLookupAccountName(NULL, userName, buff.data(), &sidSize, domainName.data(), &domainSize, &type)) return type != SidTypeUser; //returns true if the current user is not a user } } -- cgit v1.2.3 From 6a607aa7aa56ddf4323aa78d64925192494befb8 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 28 Jan 2015 10:44:38 +0100 Subject: Do not specifically mention features supported since XP We do not support Windows older versions in the first place ... Change-Id: I2cd3135f1b7f2dac6929c07624ea9373f4ac0ff1 Reviewed-by: Oswald Buddenhagen --- src/network/kernel/qnetworkinterface.cpp | 3 +-- src/network/socket/qlocalsocket.cpp | 3 --- 2 files changed, 1 insertion(+), 5 deletions(-) (limited to 'src') diff --git a/src/network/kernel/qnetworkinterface.cpp b/src/network/kernel/qnetworkinterface.cpp index b21bcee585..7bdfae0d0d 100644 --- a/src/network/kernel/qnetworkinterface.cpp +++ b/src/network/kernel/qnetworkinterface.cpp @@ -353,8 +353,7 @@ void QNetworkAddressEntry::setBroadcast(const QHostAddress &newBroadcast) Not all operating systems support reporting all features. Only the IPv4 addresses are guaranteed to be listed by this class in all platforms. In particular, IPv6 address listing is only supported - on Windows XP and more recent versions, Linux, MacOS X and the - BSDs. + on Windows, Linux, OS X and the BSDs. \sa QNetworkAddressEntry */ diff --git a/src/network/socket/qlocalsocket.cpp b/src/network/socket/qlocalsocket.cpp index 164117e84f..c1beedd53e 100644 --- a/src/network/socket/qlocalsocket.cpp +++ b/src/network/socket/qlocalsocket.cpp @@ -56,9 +56,6 @@ QT_BEGIN_NAMESPACE waitForReadyRead(), waitForBytesWritten(), and waitForDisconnected() which blocks until the operation is complete or the timeout expires. - \note This feature is not supported on versions of Windows earlier than - Windows XP. - \sa QLocalServer */ -- cgit v1.2.3 From df3ffeec15cd20c249cb6ffb2d235526a05722a5 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 4 Feb 2015 15:12:36 +0100 Subject: QProcess/Win: fix sporadic crash QProcessPrivate::_q_processDied() was potentially called twice if there was a slot connected to readyRead() that called processEvents(), because the processFinishedNotifier was still enabled when readyRead() was emitted. This led to a null pointer access in findExitCode. Change-Id: I4b796b81f050dc46bb9469602984accaa6ebfa28 Task-number: QTBUG-33731 Reviewed-by: Friedemann Kleint Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qprocess.cpp | 2 +- src/corelib/io/qprocess_win.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index a234050777..939cecfb44 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -1044,9 +1044,9 @@ bool QProcessPrivate::_q_processDied() return false; #endif #ifdef Q_OS_WIN - drainOutputPipes(); if (processFinishedNotifier) processFinishedNotifier->setEnabled(false); + drainOutputPipes(); #endif // the process may have died before it got a chance to report that it was diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp index ee6b7e13f4..9e60daa5b4 100644 --- a/src/corelib/io/qprocess_win.cpp +++ b/src/corelib/io/qprocess_win.cpp @@ -785,6 +785,7 @@ bool QProcessPrivate::waitForFinished(int msecs) void QProcessPrivate::findExitCode() { DWORD theExitCode; + Q_ASSERT(pid); if (GetExitCodeProcess(pid->hProcess, &theExitCode)) { exitCode = theExitCode; crashed = (exitCode == 0xf291 // our magic number, see killProcess -- cgit v1.2.3 From 239f67f158c55d3eb88348a53b87fa272402c733 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 19 Jan 2015 16:57:20 +0100 Subject: Do not close popup widgets when showing a widget embedded into QGraphicsView. Disable top-level widget code path for embedded widget in the show helper. Task-number: QTBUG-43780 Change-Id: I574e07130e5e68a019a426cee3fde982f3883720 Reviewed-by: Shawn Rutledge --- src/widgets/kernel/qwidget.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 453a7ca537..d8b8b151c2 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -7738,10 +7738,17 @@ void QWidgetPrivate::show_helper() + const bool isWindow = q->isWindow(); +#ifndef QT_NO_GRAPHICSVIEW + bool isEmbedded = isWindow && q->graphicsProxyWidget() != Q_NULLPTR; +#else + bool isEmbedded = false; +#endif + // popup handling: new popups and tools need to be raised, and // existing popups must be closed. Also propagate the current // windows's KeyboardFocusChange status. - if (q->isWindow()) { + if (isWindow && !isEmbedded) { if ((q->windowType() == Qt::Tool) || (q->windowType() == Qt::Popup) || q->windowType() == Qt::ToolTip) { q->raise(); if (q->parentWidget() && q->parentWidget()->window()->testAttribute(Qt::WA_KeyboardFocusChange)) @@ -7756,10 +7763,8 @@ void QWidgetPrivate::show_helper() // Automatic embedding of child windows of widgets already embedded into // QGraphicsProxyWidget when they are shown the first time. - bool isEmbedded = false; #ifndef QT_NO_GRAPHICSVIEW - if (q->isWindow()) { - isEmbedded = q->graphicsProxyWidget() ? true : false; + if (isWindow) { if (!isEmbedded && !bypassGraphicsProxyWidget(q)) { QGraphicsProxyWidget *ancestorProxy = nearestGraphicsProxyWidget(q->parentWidget()); if (ancestorProxy) { -- cgit v1.2.3 From 3c24dddaf963026c6e3cd90dd7d538dfa8044c83 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Thu, 5 Feb 2015 14:05:21 +0100 Subject: SSL NPN negotiation: Do not abort on unmatched protocols ... but choose HTTP/1.1 and continue connecting anyhow. According to the NPN spec, actually we should choose SPDY: "In the event that the client doesn't support any of server's protocols, or the server doesn't advertise any, it SHOULD select the first protocol that it supports." However, some tested servers did not advertise anything and did not support SPDY, so blindly trying the newest protocol would fail. We are conservative in that case and choose HTTP. Task-number: QTBUG-40714 Change-Id: Ia8aaf01fea74e13d9e4416306f85f1890b25559e Reviewed-by: Richard J. Moore --- src/network/access/qhttpnetworkconnectionchannel.cpp | 7 ++----- src/network/ssl/qsslsocket_openssl.cpp | 20 +++++++++++++------- 2 files changed, 15 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index d24fb159e2..9f63280bf8 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -931,7 +931,8 @@ void QHttpNetworkConnectionChannel::_q_encrypted() if (!protocolHandler) { switch (sslSocket->sslConfiguration().nextProtocolNegotiationStatus()) { - case QSslConfiguration::NextProtocolNegotiationNegotiated: { + case QSslConfiguration::NextProtocolNegotiationNegotiated: /* fall through */ + case QSslConfiguration::NextProtocolNegotiationUnsupported: { QByteArray nextProtocol = sslSocket->sslConfiguration().nextNegotiatedProtocol(); if (nextProtocol == QSslConfiguration::NextProtocolHttp1_1) { // fall through to create a QHttpProtocolHandler @@ -953,10 +954,6 @@ void QHttpNetworkConnectionChannel::_q_encrypted() // re-queue requests from SPDY queue to HTTP queue, if any requeueSpdyRequests(); break; - case QSslConfiguration::NextProtocolNegotiationUnsupported: - emitFinishedWithError(QNetworkReply::SslHandshakeFailedError, - "chosen Next Protocol Negotiation value unsupported"); - break; default: emitFinishedWithError(QNetworkReply::SslHandshakeFailedError, "detected unknown Next Protocol Negotiation protocol"); diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 8833e3fdd8..0e1a3e53c9 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -1518,14 +1518,20 @@ void QSslSocketBackendPrivate::continueHandshake() } #if OPENSSL_VERSION_NUMBER >= 0x1000100fL && !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG) - const unsigned char *proto = 0; - unsigned int proto_len = 0; - q_SSL_get0_next_proto_negotiated(ssl, &proto, &proto_len); - if (proto_len) - configuration.nextNegotiatedProtocol = QByteArray(reinterpret_cast(proto), proto_len); - else - configuration.nextNegotiatedProtocol.clear(); + configuration.nextProtocolNegotiationStatus = sslContextPointer->npnContext().status; + if (sslContextPointer->npnContext().status == QSslConfiguration::NextProtocolNegotiationUnsupported) { + // we could not agree -> be conservative and use HTTP/1.1 + configuration.nextNegotiatedProtocol = QByteArrayLiteral("http/1.1"); + } else { + const unsigned char *proto = 0; + unsigned int proto_len = 0; + q_SSL_get0_next_proto_negotiated(ssl, &proto, &proto_len); + if (proto_len) + configuration.nextNegotiatedProtocol = QByteArray(reinterpret_cast(proto), proto_len); + else + configuration.nextNegotiatedProtocol.clear(); + } #endif // OPENSSL_VERSION_NUMBER >= 0x1000100fL ... connectionEncrypted = true; -- cgit v1.2.3 From 612953a626ec21b8518ee23a4f5268b566cf41e5 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Thu, 29 Jan 2015 16:22:08 +0100 Subject: xcb: delay showing tray icon window until it is embedded Otherwise there is a race condition: when the tray implementation gets around to embedding the window, if it was already shown, it will be unmapped, embedded, and then remapped. Some tray implementations will resize the tray icon to 1 pixel wide in that case. We also never want to show a window that was intended for the tray in any other location, so it's better that it remain invisible until we are sure it is embedded. Task-number: QTBUG-31762 Task-number: QTBUG-35658 Task-number: QTBUG-32811 Change-Id: Id324b0bfded0f8258ff1686a223cb2c069827d42 Reviewed-by: Laszlo Agocs --- src/plugins/platforms/xcb/qxcbwindow.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 4fd71f1635..96c5663d83 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -755,6 +755,9 @@ void QXcbWindow::show() if (connection()->time() != XCB_TIME_CURRENT_TIME) updateNetWmUserTime(connection()->time()); + if (window()->objectName() == QLatin1String("QSystemTrayIconSysWindow")) + return; // defer showing until XEMBED_EMBEDDED_NOTIFY + Q_XCB_CALL(xcb_map_window(xcb_connection(), m_window)); if (QGuiApplication::modalWindow() == window()) @@ -2338,7 +2341,10 @@ void QXcbWindow::handleXEmbedMessage(const xcb_client_message_event_t *event) switch (event->data.data32[1]) { case XEMBED_WINDOW_ACTIVATE: case XEMBED_WINDOW_DEACTIVATE: + break; case XEMBED_EMBEDDED_NOTIFY: + Q_XCB_CALL(xcb_map_window(xcb_connection(), m_window)); + m_screen->windowShown(this); break; case XEMBED_FOCUS_IN: Qt::FocusReason reason; -- cgit v1.2.3 From dd4b09ae1aed3dd20c46ec240a43d70dc13f1ee4 Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Fri, 6 Feb 2015 00:07:29 +0100 Subject: Fix QLineF Detailed Description Currently angle() is used in place of angleTo() to describe the difference with intersect. This patch fixes that. Task-number: QTBUG-44309 Change-Id: Idfc521932247f76fe15fd980ff8e87e52feec1f1 Reviewed-by: Sze Howe Koh --- src/corelib/tools/qline.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/corelib/tools/qline.cpp b/src/corelib/tools/qline.cpp index 4561f831c8..9feb697aad 100644 --- a/src/corelib/tools/qline.cpp +++ b/src/corelib/tools/qline.cpp @@ -334,7 +334,7 @@ QDataStream &operator>>(QDataStream &stream, QLine &line) or a null line. The intersect() function determines the IntersectType for this - line and a given line, while the angle() function returns the + line and a given line, while the angleTo() function returns the angle between the lines. In addition, the unitVector() function returns a line that has the same starting point as this line, but with a length of only 1, while the normalVector() function returns -- cgit v1.2.3 From 6246e142a48dd66a8cba4ac2846276db5da952ed Mon Sep 17 00:00:00 2001 From: Samuel Gaist Date: Sun, 25 Jan 2015 23:36:08 +0100 Subject: Improve QTextDocument::setPlainText/Html doc related to undo stack This patch aims to improve the documentation of setPlainText/setHtml to let the user know that the undo stack is cleared when both these function are called. Change-Id: I079f9f1dd407387941777ebbc7b5a7bc6dc005ec Reviewed-by: Konstantin Ritt Reviewed-by: Sze Howe Koh --- src/gui/text/qtextdocument.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index ea2b794feb..77e0fec80d 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -1171,7 +1171,7 @@ QString QTextDocument::toPlainText() const /*! Replaces the entire contents of the document with the given plain - \a text. + \a text. The undo/redo history is reset when this function is called. \sa setHtml() */ @@ -1189,7 +1189,8 @@ void QTextDocument::setPlainText(const QString &text) /*! Replaces the entire contents of the document with the given - HTML-formatted text in the \a html string. + HTML-formatted text in the \a html string. The undo/redo history + is reset when this function is called. The HTML formatting is respected as much as possible; for example, "bold text" will produce text where the first word has a font -- cgit v1.2.3 From 4805714b0f5d5584fd390067b6c092ca5ee7f482 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 26 Jan 2015 16:22:48 +0100 Subject: QIcon: Fix that HiDPI image was not found with QRC alias MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When using images in QRC and giving the 1x and 2x image files respective aliases but without any file extension (for example 'myimage' and 'myimage@2x'), then QIcon would fail to find the 2x variant. Task-number: QTBUG-44049 Change-Id: I400bf6d22aeefe0aa351c68e473bf24ac2a36471 Reviewed-by: Morten Johan Sørvig --- src/gui/image/qicon.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index 6f6bf158c8..86d9c02c6e 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -1026,13 +1026,13 @@ void QIcon::addFile(const QString &fileName, const QSize &size, Mode mode, State // Check if a "@2x" file exists and add it. static bool disable2xImageLoading = !qgetenv("QT_HIGHDPI_DISABLE_2X_IMAGE_LOADING").isEmpty(); if (!disable2xImageLoading && qApp->devicePixelRatio() > 1.0) { + QString at2xfileName = fileName; int dotIndex = fileName.lastIndexOf(QLatin1Char('.')); - if (dotIndex != -1) { - QString at2xfileName = fileName; - at2xfileName.insert(dotIndex, QStringLiteral("@2x")); - if (QFile::exists(at2xfileName)) - d->engine->addFile(at2xfileName, size, mode, state); - } + if (dotIndex == -1) /* no dot */ + dotIndex = fileName.size(); /* append */ + at2xfileName.insert(dotIndex, QStringLiteral("@2x")); + if (QFile::exists(at2xfileName)) + d->engine->addFile(at2xfileName, size, mode, state); } } -- cgit v1.2.3 From b3fc5e1ea3eb4fe838ac716aaca4efaa5de5a814 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 4 Feb 2015 13:23:26 +0100 Subject: Improve handling of screens in QWidgets. Historically, the screen number of a QWidget was stored in QTLWExtra::screenIndex which came in via the Q_WS_QWS platform. The variable contained the screen number of the QDesktopScreenWidget and the desired screen number for widget creation (from parent widget or desktop parent widgets) and was not updated according to widget geometry or when the associated QWindow moved to another screen. Storing the screen number is problematic in Qt 5 since it may change when the list of QScreens in QGuiApplication is rearranged. This change renames it to initialScreen and changes its usage to only contain a screen number when a screen is requested by parenting on a desktop widget or reparenting. A value of -1 indicates no screen is requested and the number should be deduced from the geometry. For the usage in QDesktopScreenWidget, add a method to determine the number via index in the list of QDesktopWidget. Task-number: QTBUG-44070 Task-number: QTBUG-44213 Change-Id: I153d19073ad4b0fd14ef3d24caa6d3e76f350e82 Reviewed-by: Andy Shaw Reviewed-by: Shawn Rutledge Reviewed-by: Laszlo Agocs --- src/widgets/kernel/qdesktopwidget.cpp | 9 +++++++- src/widgets/kernel/qdesktopwidget_p.h | 6 +++--- src/widgets/kernel/qwidget.cpp | 40 ++++++++++++++++++++--------------- src/widgets/kernel/qwidget_p.h | 2 +- 4 files changed, 35 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/widgets/kernel/qdesktopwidget.cpp b/src/widgets/kernel/qdesktopwidget.cpp index 6698c13270..563707b021 100644 --- a/src/widgets/kernel/qdesktopwidget.cpp +++ b/src/widgets/kernel/qdesktopwidget.cpp @@ -39,6 +39,13 @@ QT_BEGIN_NAMESPACE +int QDesktopScreenWidget::screenNumber() const +{ + const QDesktopWidgetPrivate *desktopWidgetP + = static_cast(qt_widget_private(QApplication::desktop())); + return desktopWidgetP->screens.indexOf(const_cast(this)); +} + const QRect QDesktopWidget::screenGeometry(const QWidget *widget) const { if (!widget) { @@ -79,7 +86,7 @@ void QDesktopWidgetPrivate::_q_updateScreens() for (int currentLength = screens.size(); currentLength < targetLength; ++currentLength) { QScreen *qScreen = screenList.at(currentLength); - QDesktopScreenWidget *screenWidget = new QDesktopScreenWidget(currentLength); + QDesktopScreenWidget *screenWidget = new QDesktopScreenWidget; screenWidget->setGeometry(qScreen->geometry()); QObject::connect(qScreen, SIGNAL(geometryChanged(QRect)), q, SLOT(_q_updateScreens()), Qt::QueuedConnection); diff --git a/src/widgets/kernel/qdesktopwidget_p.h b/src/widgets/kernel/qdesktopwidget_p.h index 9cd57e7110..29daaa4f97 100644 --- a/src/widgets/kernel/qdesktopwidget_p.h +++ b/src/widgets/kernel/qdesktopwidget_p.h @@ -53,12 +53,12 @@ QT_BEGIN_NAMESPACE class QDesktopScreenWidget : public QWidget { Q_OBJECT public: - QDesktopScreenWidget(int screenNumber = -1) : QWidget(0, Qt::Desktop) + QDesktopScreenWidget() : QWidget(Q_NULLPTR, Qt::Desktop) { setVisible(false); - QTLWExtra *topData = d_func()->topData(); - topData->screenIndex = screenNumber; } + + int screenNumber() const; }; class QDesktopWidgetPrivate : public QWidgetPrivate { diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index d8b8b151c2..27d45ccea6 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -35,7 +35,7 @@ #include "qapplication_p.h" #include "qbrush.h" #include "qcursor.h" -#include "qdesktopwidget.h" +#include "qdesktopwidget_p.h" #include "qevent.h" #include "qhash.h" #include "qlayout.h" @@ -1111,9 +1111,10 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f) if (allWidgets) allWidgets->insert(q); - QWidget *desktopWidget = 0; + int targetScreen = -1; if (parentWidget && parentWidget->windowType() == Qt::Desktop) { - desktopWidget = parentWidget; + const QDesktopScreenWidget *sw = qobject_cast(parentWidget); + targetScreen = sw ? sw->screenNumber() : 0; parentWidget = 0; } @@ -1133,10 +1134,10 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f) xinfo = desktopWidget->d_func()->xinfo; } #endif - if (desktopWidget) { - const int screen = desktopWidget->d_func()->topData()->screenIndex; + if (targetScreen >= 0) { + topData()->initialScreenIndex = targetScreen; if (QWindow *window = q->windowHandle()) - window->setScreen(QGuiApplication::screens().value(screen, 0)); + window->setScreen(QGuiApplication::screens().value(targetScreen, Q_NULLPTR)); } data.fstrut_dirty = true; @@ -1414,8 +1415,15 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO win->setGeometry(q->geometry()); else win->resize(q->size()); - if (win->isTopLevel()) - win->setScreen(QGuiApplication::screens().value(topData()->screenIndex, 0)); + if (win->isTopLevel()) { + int screenNumber = topData()->initialScreenIndex; + topData()->initialScreenIndex = -1; + if (screenNumber < 0) { + screenNumber = q->windowType() != Qt::Desktop + ? QApplication::desktop()->screenNumber(q) : 0; + } + win->setScreen(QGuiApplication::screens().value(screenNumber, Q_NULLPTR)); + } QSurfaceFormat format = win->requestedFormat(); if ((flags & Qt::Window) && win->surfaceType() != QSurface::OpenGLSurface @@ -1715,7 +1723,7 @@ void QWidgetPrivate::createTLExtra() x->embedded = 0; x->window = 0; x->shareContext = 0; - x->screenIndex = 0; + x->initialScreenIndex = -1; #ifdef Q_WS_MAC x->wasMaximized = false; #endif // Q_WS_MAC @@ -10503,9 +10511,8 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) if (newparent && newparent->windowType() == Qt::Desktop) { // make sure the widget is created on the same screen as the // programmer specified desktop widget - - // get the desktop's screen number - targetScreen = newparent->window()->d_func()->topData()->screenIndex; + const QDesktopScreenWidget *sw = qobject_cast(newparent); + targetScreen = sw ? sw->screenNumber() : 0; newparent = 0; } @@ -10537,7 +10544,7 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) f |= Qt::Window; if (targetScreen == -1) { if (parent) - targetScreen = q->parentWidget()->window()->d_func()->topData()->screenIndex; + targetScreen = QApplication::desktop()->screenNumber(q->parentWidget()->window()); } } @@ -10581,12 +10588,11 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) // move the window to the selected screen if (!newparent && targetScreen != -1) { - if (maybeTopData()) - maybeTopData()->screenIndex = targetScreen; // only if it is already created - if (q->testAttribute(Qt::WA_WState_Created)) { + if (q->testAttribute(Qt::WA_WState_Created)) q->windowHandle()->setScreen(QGuiApplication::screens().value(targetScreen, 0)); - } + else + topData()->initialScreenIndex = targetScreen; } } diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h index b3552cba68..85e1cf93d6 100644 --- a/src/widgets/kernel/qwidget_p.h +++ b/src/widgets/kernel/qwidget_p.h @@ -212,7 +212,7 @@ struct QTLWExtra { #endif QWidgetWindow *window; QOpenGLContext *shareContext; - quint32 screenIndex; // index in qplatformscreenlist + int initialScreenIndex; // Screen number when passing a QDesktop[Screen]Widget as parent. }; struct QWExtra { -- cgit v1.2.3 From b444769840b2497f1295bca0694fe59aa78bb551 Mon Sep 17 00:00:00 2001 From: Maks Naumov Date: Sat, 24 Jan 2015 21:26:06 +0200 Subject: Don't crash with invalid QModelIndex or when QTreeWidgetItem is NULL in mimeData() Change-Id: I0a9abaa05cf136eadf222d3e7d102930719b84ff Reviewed-by: David Faure --- src/gui/itemmodels/qstandarditemmodel.cpp | 23 +++++++++++------------ src/widgets/itemviews/qtreewidget.cpp | 12 +++++++++++- 2 files changed, 22 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/gui/itemmodels/qstandarditemmodel.cpp b/src/gui/itemmodels/qstandarditemmodel.cpp index 44ee710268..eae2b419e3 100644 --- a/src/gui/itemmodels/qstandarditemmodel.cpp +++ b/src/gui/itemmodels/qstandarditemmodel.cpp @@ -2942,9 +2942,13 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const itemsSet.reserve(indexes.count()); stack.reserve(indexes.count()); for (int i = 0; i < indexes.count(); ++i) { - QStandardItem *item = itemFromIndex(indexes.at(i)); - itemsSet << item; - stack.push(item); + if (QStandardItem *item = itemFromIndex(indexes.at(i))) { + itemsSet << item; + stack.push(item); + } else { + qWarning() << "QStandardItemModel::mimeData: No item associated with invalid index"; + return 0; + } } //remove duplicates childrens @@ -2978,16 +2982,11 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const //stream everything recursively while (!stack.isEmpty()) { QStandardItem *item = stack.pop(); - if(itemsSet.contains(item)) { //if the item is selection 'top-level', strem its position + if (itemsSet.contains(item)) //if the item is selection 'top-level', stream its position stream << item->row() << item->column(); - } - if(item) { - stream << *item << item->columnCount() << item->d_ptr->children.count(); - stack += item->d_ptr->children; - } else { - QStandardItem dummy; - stream << dummy << 0 << 0; - } + + stream << *item << item->columnCount() << item->d_ptr->children.count(); + stack += item->d_ptr->children; } data->setData(format, encoded); diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp index 7378b9979a..769a5b97b9 100644 --- a/src/widgets/itemviews/qtreewidget.cpp +++ b/src/widgets/itemviews/qtreewidget.cpp @@ -3273,8 +3273,18 @@ QMimeData *QTreeWidget::mimeData(const QList items) const QList indexes; for (int i = 0; i < items.count(); ++i) { QTreeWidgetItem *item = items.at(i); + if (!item) { + qWarning() << "QTreeWidget::mimeData: Null-item passed"; + return 0; + } + for (int c = 0; c < item->values.count(); ++c) { - indexes << indexFromItem(item, c); + const QModelIndex index = indexFromItem(item, c); + if (!index.isValid()) { + qWarning() << "QTreeWidget::mimeData: No index associated with item :" << item; + return 0; + } + indexes << index; } } return d->model->QAbstractItemModel::mimeData(indexes); -- cgit v1.2.3 From 0d990b9ca117514fe83f53b39f25d6272304f2fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A5re=20S=C3=A4rs?= Date: Thu, 22 Jan 2015 22:40:37 +0200 Subject: Fix Meta+... shortcuts on XCB If the window contains a widget that accepts text input, a Meta+... shortcut will be interpreted as if no modifier was pressed. This fix enables the usage of Meta+... shortcuts for the XCB platform plugin. Change-Id: I80034b7e6bbbf18471c86fc77320d5038f5740be Task-number: QTBUG-43572 Reviewed-by: Aleix Pol Gonzalez Reviewed-by: Milian Wolff Reviewed-by: David Edmundson Reviewed-by: Lars Knoll --- src/plugins/platforms/xcb/qxcbkeyboard.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index 5fb745717b..85fef3912c 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -933,7 +933,7 @@ xkb_keysym_t QXcbKeyboard::lookupLatinKeysym(xkb_keycode_t keycode) const QList QXcbKeyboard::possibleKeys(const QKeyEvent *event) const { // turn off the modifier bits which doesn't participate in shortcuts - Qt::KeyboardModifiers notNeeded = Qt::MetaModifier | Qt::KeypadModifier | Qt::GroupSwitchModifier; + Qt::KeyboardModifiers notNeeded = Qt::KeypadModifier | Qt::GroupSwitchModifier; Qt::KeyboardModifiers modifiers = event->modifiers() &= ~notNeeded; // create a fresh kb state and test against the relevant modifier combinations struct xkb_state *kb_state = xkb_state_new(xkb_keymap); @@ -963,10 +963,12 @@ QList QXcbKeyboard::possibleKeys(const QKeyEvent *event) const xkb_mod_index_t shiftMod = xkb_keymap_mod_get_index(xkb_keymap, "Shift"); xkb_mod_index_t altMod = xkb_keymap_mod_get_index(xkb_keymap, "Alt"); xkb_mod_index_t controlMod = xkb_keymap_mod_get_index(xkb_keymap, "Control"); + xkb_mod_index_t metaMod = xkb_keymap_mod_get_index(xkb_keymap, "Meta"); Q_ASSERT(shiftMod < 32); Q_ASSERT(altMod < 32); Q_ASSERT(controlMod < 32); + Q_ASSERT(metaMod < 32); xkb_mod_mask_t depressed; int qtKey = 0; @@ -987,6 +989,8 @@ QList QXcbKeyboard::possibleKeys(const QKeyEvent *event) const depressed |= (1 << shiftMod); if (neededMods & Qt::ControlModifier) depressed |= (1 << controlMod); + if (neededMods & Qt::MetaModifier) + depressed |= (1 << metaMod); xkb_state_update_mask(kb_state, depressed, latchedMods, lockedMods, 0, 0, lockedLayout); sym = xkb_state_key_get_one_sym(kb_state, keycode); } -- cgit v1.2.3