diff options
author | Frederik Gladhorn <[email protected]> | 2015-02-10 09:32:16 +0100 |
---|---|---|
committer | Frederik Gladhorn <[email protected]> | 2015-02-10 09:42:25 +0100 |
commit | fc35f714340d5361231506dfbead132122f59460 (patch) | |
tree | fd80498d9417c87b386a011f5849f1e4e48ad3fa /src | |
parent | 6389160f04322449c34bd1ecfe53983e3b588943 (diff) | |
parent | 0d990b9ca117514fe83f53b39f25d6272304f2fb (diff) |
Merge remote-tracking branch 'origin/5.4' into dev
Conflicts:
src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro
src/gui/image/qimage_conversions.cpp
src/gui/opengl/qopenglextensions_p.h
src/gui/text/qtextengine.cpp
src/network/ssl/qsslsocket_openssl.cpp
src/plugins/platforms/eglfs/qeglfshooks_stub.cpp
src/plugins/platforms/eglfs/qeglfsscreen.cpp
src/plugins/platforms/eglfs/qeglfswindow.cpp
src/plugins/platforms/windows/qwindowsfontdatabase.cpp
src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
src/plugins/platforms/windows/qwindowsnativeinterface.cpp
src/plugins/platforms/windows/qwindowsscreen.cpp
src/plugins/platforms/windows/qwindowswindow.cpp
src/plugins/platforms/windows/qwindowswindow.h
src/plugins/platforms/xcb/qxcbdrag.h
src/widgets/itemviews/qabstractitemview.cpp
src/widgets/kernel/qwidget.cpp
src/widgets/util/qsystemtrayicon_p.h
tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp
Thanks to Friedemann Kleint for resolving the qwindowsfontdatabase.cpp
conflicts.
Change-Id: I937232c30523d5121c195d947d92aec6f129b03e
Diffstat (limited to 'src')
126 files changed, 1750 insertions, 926 deletions
diff --git a/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro b/src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro index e64e5b2002f..c142c5a9736 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 win32: DEFINES += HB_NO_WIN1256 INCLUDEPATH += $$PWD/include diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in index 9bda70ec07c..4387bedc447 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) diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index dc04f898f75..b47015cbc92 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 ** @@ -622,7 +622,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/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index feb86d28952..10326dea065 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<CFStringRef> extensionRef = QCFString::toCFStringRef(suffix); + QCFType<CFStringRef> 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<CFStringRef> path = QCFString::toCFStringRef(entry.filePath()); QCFType<CFURLRef> url = CFURLCreateWithFileSystemPath(0, path, kCFURLPOSIXPathStyle, true); UInt32 type, creator; diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index a7d521fc6cb..408f07f00e2 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -1043,9 +1043,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 ee6b7e13f46..9e60daa5b47 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 diff --git a/src/corelib/io/qtemporarydir.cpp b/src/corelib/io/qtemporarydir.cpp index 5e0def74eeb..5f0c5001838 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; } } diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp index f870fb11e33..fa455c0e8c1 100644 --- a/src/corelib/io/qtextstream.cpp +++ b/src/corelib/io/qtextstream.cpp @@ -1574,11 +1574,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, diff --git a/src/corelib/io/qurl_mac.mm b/src/corelib/io/qurl_mac.mm index c235365ad82..4468bf0f2bd 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) diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp index 93ab90fb94c..9e8ec250fc8 100644 --- a/src/corelib/kernel/qcoreevent.cpp +++ b/src/corelib/kernel/qcoreevent.cpp @@ -539,7 +539,7 @@ QTimerEvent::~QTimerEvent() \a child. \a type can be QEvent::ChildAdded, QEvent::ChildRemoved, - QEvent::ChildPolished, or QEvent::ChildRemoved. + or QEvent::ChildPolished. \sa child() */ diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 0a8369acbfb..b29376e851c 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -3711,13 +3711,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; diff --git a/src/corelib/kernel/qtcore_eval.cpp b/src/corelib/kernel/qtcore_eval.cpp index eb1019534cd..2ee8c20bc3d 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/corelib/tools/qline.cpp b/src/corelib/tools/qline.cpp index 4561f831c86..9feb697aad8 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 diff --git a/src/corelib/tools/qpair.h b/src/corelib/tools/qpair.h index 33f8c81e68f..4cba0a84212 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 <typename TT1, typename TT2> - Q_DECL_CONSTEXPR QPair(QPair<TT1, TT2> &&p) : first(std::move(p.first)), second(std::move(p.second)) {} + Q_DECL_CONSTEXPR QPair(QPair<TT1, TT2> &&p) + // can't use std::move here as it's not constexpr in C++11: + : first(static_cast<TT1 &&>(p.first)), second(static_cast<TT2 &&>(p.second)) {} template <typename TT1, typename TT2> Q_DECL_RELAXED_CONSTEXPR QPair &operator=(QPair<TT1, TT2> &&p) { first = std::move(p.first); second = std::move(p.second); return *this; } diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index 061c7a5a2db..a18b2c28a12 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; } diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp index fe3c4049ad9..f79c8e65fa6 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 7ff65e1718a..087d64fce89 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); diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index 5cd9894c4c2..3e27ba3efa5 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 = !qEnvironmentVariableIsEmpty("QT_HIGHDPI_DISABLE_2X_IMAGE_LOADING"); 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); } } diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp index 696f95b5650..0a4bf47c82d 100644 --- a/src/gui/image/qimage_conversions.cpp +++ b/src/gui/image/qimage_conversions.cpp @@ -2733,7 +2733,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, @@ -2756,7 +2756,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, @@ -2770,6 +2769,7 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0 }, // Format_RGBA8888 { @@ -2779,7 +2779,6 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma 0, 0, 0, - 0, convert_RGBA_to_ARGB_inplace, 0, 0, @@ -2792,6 +2791,7 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0 }, // Format_RGBA8888_Premultiplied { diff --git a/src/gui/itemmodels/qstandarditemmodel.cpp b/src/gui/itemmodels/qstandarditemmodel.cpp index 4102230e1bb..c0fa01d887f 100644 --- a/src/gui/itemmodels/qstandarditemmodel.cpp +++ b/src/gui/itemmodels/qstandarditemmodel.cpp @@ -2936,9 +2936,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 @@ -2972,16 +2976,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/gui/kernel/qdnd.cpp b/src/gui/kernel/qdnd.cpp index f515fe18df7..2a6cc4fc994 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/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 92be903b414..326d9a7b52a 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -2572,9 +2572,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/qplatformdrag.cpp b/src/gui/kernel/qplatformdrag.cpp index 8a5c7264d15..326f092ead8 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 34ad11e45fb..ce7a9aa1f22 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/gui/kernel/qscreen_p.h b/src/gui/kernel/qscreen_p.h index cdb923c4297..53d4f3404a8 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(); diff --git a/src/gui/opengl/qopenglextensions_p.h b/src/gui/opengl/qopenglextensions_p.h index 0d0cfd26bad..6c3d923b1f9 100644 --- a/src/gui/opengl/qopenglextensions_p.h +++ b/src/gui/opengl/qopenglextensions_p.h @@ -46,11 +46,36 @@ // #include "qopenglfunctions.h" +#include <QtCore/qlibrary.h> 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) @@ -105,6 +130,8 @@ public: void glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments); + 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 99604ca8b25..d436fd45ecb 100644 --- a/src/gui/opengl/qopenglfunctions.cpp +++ b/src/gui/opengl/qopenglfunctions.cpp @@ -3193,65 +3193,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) @@ -3506,4 +3546,9 @@ QOpenGLExtensionsPrivate::QOpenGLExtensionsPrivate(QOpenGLContext *ctx) DiscardFramebuffer = qopenglfResolveDiscardFramebuffer; } +QOpenGLES3Helper *QOpenGLExtensions::gles3Helper() +{ + return qgles3Helper(); +} + QT_END_NAMESPACE diff --git a/src/gui/opengl/qopengltexturehelper.cpp b/src/gui/opengl/qopengltexturehelper.cpp index 1eeab649116..d89e5d32369 100644 --- a/src/gui/opengl/qopengltexturehelper.cpp +++ b/src/gui/opengl/qopengltexturehelper.cpp @@ -34,6 +34,7 @@ #include "qopengltexturehelper_p.h" #include <QOpenGLContext> +#include <private/qopenglextensions_p.h> QT_BEGIN_NAMESPACE @@ -247,21 +248,23 @@ QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context) CompressedTexImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid*)>(context->getProcAddress(QByteArrayLiteral("glCompressedTexImage3DOES"))); CompressedTexSubImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid*)>(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<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLsizei , GLsizei , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glTexImage3D"))); - TexSubImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLint , GLint , GLsizei , GLsizei , GLsizei , GLenum , GLenum , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glTexSubImage3D"))); - - // OpenGL 1.3 - CompressedTexImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLenum , GLsizei , GLsizei , GLsizei , GLint , GLsizei , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glCompressedTexImage3D"))); - CompressedTexSubImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLint , GLint , GLsizei , GLsizei , GLsizei , GLenum , GLsizei , const GLvoid *)>(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<QOpenGLExtensions *>(ctx->functions())->gles3Helper(); + TexImage3D = es3->TexImage3D; + TexSubImage3D = es3->TexSubImage3D; + CompressedTexImage3D = es3->CompressedTexImage3D; + CompressedTexSubImage3D = es3->CompressedTexSubImage3D; + } else { + // OpenGL 1.2 + TexImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLsizei , GLsizei , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glTexImage3D"))); + TexSubImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLint , GLint , GLsizei , GLsizei , GLsizei , GLenum , GLenum , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glTexSubImage3D"))); + + // OpenGL 1.3 + CompressedTexImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLenum , GLsizei , GLsizei , GLsizei , GLint , GLsizei , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glCompressedTexImage3D"))); + CompressedTexSubImage3D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLint , GLint , GLsizei , GLsizei , GLsizei , GLenum , GLsizei , const GLvoid *)>(context->getProcAddress(QByteArrayLiteral("glCompressedTexSubImage3D"))); + } } #ifndef QT_OPENGL_ES_2 diff --git a/src/gui/opengl/qopenglvertexarrayobject.cpp b/src/gui/opengl/qopenglvertexarrayobject.cpp index 0fc140b3efd..42bb1a3a52d 100644 --- a/src/gui/opengl/qopenglvertexarrayobject.cpp +++ b/src/gui/opengl/qopenglvertexarrayobject.cpp @@ -35,12 +35,12 @@ #include <QtCore/private/qobject_p.h> #include <QtGui/qopenglcontext.h> -#include <QtGui/qopenglfunctions.h> #include <QtGui/qoffscreensurface.h> #include <QtGui/qopenglfunctions_3_0.h> #include <QtGui/qopenglfunctions_3_2_core.h> +#include <private/qopenglextensions_p.h> #include <private/qopenglvertexarrayobject_p.h> 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<QOpenGLExtensions *>(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<QOpenGLVertexArrayObjectHelper::qt_GenVertexArrays_t>(context->getProcAddress(QByteArrayLiteral("glGenVertexArraysOES"))); helper->DeleteVertexArrays = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_DeleteVertexArrays_t>(context->getProcAddress(QByteArrayLiteral("glDeleteVertexArraysOES"))); helper->BindVertexArray = reinterpret_cast<QOpenGLVertexArrayObjectHelper::qt_BindVertexArray_t>(context->getProcAddress(QByteArrayLiteral("glBindVertexArrayOES"))); diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index afc746042da..6ee1beaa3c3 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 \ diff --git a/src/gui/painting/qfixed_p.h b/src/gui/painting/qfixed_p.h index 69a7b06780e..68314d0434f 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 @@ -75,16 +75,16 @@ public: 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) diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 8dbd78cd57f..01c33fc6bd3 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -412,7 +412,7 @@ void QtFontFamily::ensurePopulated() return; QGuiApplicationPrivate::platformIntegration()->fontDatabase()->populateFamily(name); - Q_ASSERT(populated); + Q_ASSERT_X(populated, Q_FUNC_INFO, qPrintable(name)); } class QFontDatabasePrivate diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 98ab78f0dc6..a9d34b1815b 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<QFontEngine *>(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<QFontEngine *>(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<QFontEngine *>(this))) { hb_tag_t script_tag_1, script_tag_2; diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp index 2e289e2bd8d..b1205a8c850 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(). diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index bd5877c9248..91e01ffbb16 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -1172,7 +1172,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() */ @@ -1190,7 +1190,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, "<b>bold</b> text" will produce text where the first word has a font diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index d6e9172e60c..48e0550a612 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 (Q_LIKELY(useHarfbuzzNG)) + if (Q_LIKELY(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 (Q_LIKELY(useHarfbuzzNG)) + if (Q_LIKELY(qt_useHarfbuzzNG())) qt_getJustificationOpportunities(string, itemLength, si, glyphs, logClusters(&si)); #endif @@ -1234,6 +1234,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(); @@ -1604,7 +1613,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) { diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index ab4b10522a2..6d779d089df 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -1890,7 +1890,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. @@ -1928,7 +1928,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()); diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index d2a13220b9d..fb01f7d7b37 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -934,7 +934,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 @@ -956,10 +957,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/kernel/qnetworkinterface.cpp b/src/network/kernel/qnetworkinterface.cpp index 633d2ee9a81..0e0ef273628 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/kernel/qnetworkproxy_win.cpp b/src/network/kernel/qnetworkproxy_win.cpp index f7741ce86a5..91f7ac36cfe 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<BYTE, 68> buff(sidSize); + QVarLengthArray<wchar_t, MAX_PATH> 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 } } diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index 604214ce8e6..5a1ad40b901 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. diff --git a/src/network/socket/qlocalsocket.cpp b/src/network/socket/qlocalsocket.cpp index 164117e84f7..c1beedd53e8 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 */ diff --git a/src/network/ssl/qsslconfiguration.cpp b/src/network/ssl/qsslconfiguration.cpp index 1686d9e6353..715e592595c 100644 --- a/src/network/ssl/qsslconfiguration.cpp +++ b/src/network/ssl/qsslconfiguration.cpp @@ -514,6 +514,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/qsslcontext_openssl.cpp b/src/network/ssl/qsslcontext_openssl.cpp index b21732c88cd..fc291e9d602 100644 --- a/src/network/ssl/qsslcontext_openssl.cpp +++ b/src/network/ssl/qsslcontext_openssl.cpp @@ -139,7 +139,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.cpp b/src/network/ssl/qsslsocket.cpp index e12ae33ac26..5c76f327d08 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -1108,6 +1108,7 @@ QSslCipher QSslSocket::sessionCipher() const is set during the handshake phase. \sa protocol(), setProtocol() + \since 5.4 */ QSsl::SslProtocol QSslSocket::sessionProtocol() const { @@ -2123,6 +2124,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 diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 7cadf3e0a6d..83473e8822b 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -1616,14 +1616,20 @@ void QSslSocketBackendPrivate::continueHandshake() } #if OPENSSL_VERSION_NUMBER >= 0x1000100fL && !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<const char *>(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<const char *>(proto), proto_len); + else + configuration.nextNegotiatedProtocol.clear(); + } #endif // OPENSSL_VERSION_NUMBER >= 0x1000100fL ... connectionEncrypted = true; diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index 61c703eb2cc..7c07285a06a 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -287,7 +287,9 @@ DEFINEFUNC2(void, SSL_set_psk_client_callback, SSL* ssl, ssl, q_psk_client_callb #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 @@ -297,7 +299,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 @@ -306,11 +310,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 @@ -858,7 +866,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 @@ -868,7 +878,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 diff --git a/src/platformsupport/clipboard/qmacmime.mm b/src/platformsupport/clipboard/qmacmime.mm index 6fcd19e07bf..44580b017c9 100644 --- a/src/platformsupport/clipboard/qmacmime.mm +++ b/src/platformsupport/clipboard/qmacmime.mm @@ -611,9 +611,21 @@ QVariant QMacPasteboardMimeFileUri::convertToMime(const QString &mime, QList<QBy return QVariant(); QList<QVariant> 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); } diff --git a/src/platformsupport/eglconvenience/qeglplatformintegration_p.h b/src/platformsupport/eglconvenience/qeglplatformintegration_p.h index 7f0037db924..80e6fae47a6 100644 --- a/src/platformsupport/eglconvenience/qeglplatformintegration_p.h +++ b/src/platformsupport/eglconvenience/qeglplatformintegration_p.h @@ -45,9 +45,9 @@ // We mean it. // +#include <QtCore/QVariant> #include <qpa/qplatformintegration.h> #include <qpa/qplatformnativeinterface.h> -#include <QtCore/QVariant> #include <EGL/egl.h> QT_BEGIN_NAMESPACE diff --git a/src/platformsupport/fbconvenience/qfbbackingstore.cpp b/src/platformsupport/fbconvenience/qfbbackingstore.cpp index 0fa23ebe026..733235ff428 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 cf9e5088ad4..be4cdfbecde 100644 --- a/src/platformsupport/fbconvenience/qfbbackingstore_p.h +++ b/src/platformsupport/fbconvenience/qfbbackingstore_p.h @@ -46,6 +46,7 @@ // #include <qpa/qplatformbackingstore.h> +#include <QtCore/QMutex> QT_BEGIN_NAMESPACE @@ -64,12 +65,19 @@ public: virtual void resize(const QSize &size, const QRegion ®ion) Q_DECL_OVERRIDE; - 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 aa35825be0e..13341344d80 100644 --- a/src/platformsupport/fbconvenience/qfbscreen.cpp +++ b/src/platformsupport/fbconvenience/qfbscreen.cpp @@ -37,11 +37,15 @@ #include "qfbbackingstore_p.h" #include <QtGui/QPainter> +#include <QtCore/QCoreApplication> #include <qpa/qwindowsysteminterface.h> +#include <QtCore/QDebug> +#include <QtCore/QElapsedTimer> + 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 b6e50dc7867..55aacab9bc2 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<QFbWindow *> mWindowStack; QRegion mRepaintRegion; - QTimer mRedrawTimer; + bool mUpdatePending; QFbCursor *mCursor; QRect mGeometry; diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp index f2e2ded3f5c..d001b71a530 100644 --- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp +++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp @@ -535,6 +535,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", @@ -544,27 +561,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", @@ -574,25 +595,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 @@ -832,10 +834,8 @@ void QFontconfigDatabase::setupFontEngine(QFontEngineFT *engine, const QFontDef QGuiApplication::platformNativeInterface()->nativeResourceForScreen("antialiasingEnabled", QGuiApplication::primaryScreen()); int antialiasingEnabled = int(reinterpret_cast<qintptr>(antialiasResource)); - if (antialiasingEnabled > 0) { + if (antialiasingEnabled > 0) antialias = antialiasingEnabled - 1; - forcedAntialiasSetting = true; - } } QFontEngine::GlyphFormat format; diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm index 4244719b34e..1cc7d90fc7c 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm @@ -354,6 +354,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; @@ -368,7 +370,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; diff --git a/src/platformsupport/input/evdevtouch/qevdevtouch.cpp b/src/platformsupport/input/evdevtouch/qevdevtouch.cpp index dd831c9e820..771a1da549c 100644 --- a/src/platformsupport/input/evdevtouch/qevdevtouch.cpp +++ b/src/platformsupport/input/evdevtouch/qevdevtouch.cpp @@ -39,6 +39,8 @@ #include <QLoggingCategory> #include <QtCore/private/qcore_unix_p.h> #include <QtPlatformSupport/private/qdevicediscovery_p.h> +#include <QtGui/private/qguiapplication_p.h> +#include <QtGui/private/qinputdevicemanager_p_p.h> #include <linux/input.h> #if !defined(QT_NO_MTDEV) @@ -146,6 +148,12 @@ void QEvdevTouchScreenData::registerDevice() m_device->setCapabilities(m_device->capabilities() | QTouchDevice::Pressure); QWindowSystemInterface::registerTouchDevice(m_device); + + // No monitoring of added/removed devices is done here, so for now just + // increase the number of touch devices. + QInputDeviceManager *imgr = QGuiApplicationPrivate::inputDeviceManager(); + QInputDeviceManagerPrivate::get(imgr)->setDeviceCount(QInputDeviceManager::DeviceTypeTouch, + imgr->deviceCount(QInputDeviceManager::DeviceTypeTouch) + 1); } #define LONG_BITS (sizeof(long) << 3) diff --git a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp index 7cbda0c7455..b87d1c06b95 100644 --- a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp +++ b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp @@ -1048,6 +1048,8 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event) } break; } + case QAccessible::SelectionAdd: + case QAccessible::SelectionRemove: case QAccessible::Selection: { QAccessibleInterface * iface = event->accessibleInterface(); if (!iface) { @@ -1105,7 +1107,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: @@ -1147,7 +1148,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/platformsupport/linuxaccessibility/linuxaccessibility.pri b/src/platformsupport/linuxaccessibility/linuxaccessibility.pri index 1d51d2876c6..1b65fb1cad6 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 diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index 55847a04a4e..2b38409723a 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()) diff --git a/src/plugins/platforms/android/android.pro b/src/plugins/platforms/android/android.pro index 3c3a4b4b2ed..3ba817bf5bc 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 @@ -54,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 \ diff --git a/src/plugins/platforms/cocoa/qcocoamenubar.mm b/src/plugins/platforms/cocoa/qcocoamenubar.mm index aceb9b619b1..0b465087827 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<QPlatformMenu *>(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) diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 780be644e7e..fb7b615ee1a 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -1830,6 +1830,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]]; @@ -1849,6 +1851,8 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin - (void)draggingExited:(id <NSDraggingInfo>)sender { QWindow *target = findEventTargetWindow(m_window); + if (!target) + return; NSPoint windowPoint = [self convertPoint: [sender draggingLocation] fromView: nil]; QPoint qt_windowPoint(windowPoint.x, windowPoint.y); @@ -1861,6 +1865,8 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin - (BOOL)performDragOperation:(id <NSDraggingInfo>)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); @@ -1886,6 +1892,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 diff --git a/src/plugins/platforms/eglfs/qeglfscontext.cpp b/src/plugins/platforms/eglfs/qeglfscontext.cpp index 7054c905210..4bda09653f6 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 <QtGui/QSurface> +#include <QtDebug> +#include <QtPlatformSupport/private/qeglplatformcursor_p.h> #include <QtPlatformSupport/private/qeglconvenience_p.h> #include <QtPlatformSupport/private/qeglpbuffer_p.h> -#include <QtPlatformSupport/private/qeglplatformcursor_p.h> -#include <QtGui/QSurface> -#include <QtDebug> + +#include "qeglfswindow.h" +#include "qeglfshooks.h" +#include "qeglfscontext.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp index 80a029c27ff..a13a3344334 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp @@ -31,27 +31,27 @@ ** ****************************************************************************/ -#include "qeglfsintegration.h" +#include <QtCore/qtextstream.h> +#include <QtGui/private/qguiapplication_p.h> + +#include <qpa/qplatformwindow.h> +#include <QtGui/QSurfaceFormat> +#include <QtGui/QOpenGLContext> +#include <QtGui/QScreen> +#include <QtGui/QOffscreenSurface> +#include <qpa/qplatformcursor.h> +#include "qeglfsintegration.h" #include "qeglfswindow.h" #include "qeglfshooks.h" #include "qeglfscontext.h" #include "qeglfsoffscreenwindow.h" -#include <QtGui/private/qguiapplication_p.h> - #include <QtPlatformSupport/private/qeglconvenience_p.h> #include <QtPlatformSupport/private/qeglplatformcontext_p.h> #include <QtPlatformSupport/private/qeglpbuffer_p.h> #include <QtPlatformHeaders/QEGLNativeContext> -#include <qpa/qplatformwindow.h> -#include <QtGui/QSurfaceFormat> -#include <QtGui/QOpenGLContext> -#include <QtGui/QScreen> -#include <QtGui/QOffscreenSurface> -#include <qpa/qplatformcursor.h> - #include <EGL/egl.h> static void initResources() diff --git a/src/plugins/platforms/eglfs/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/qeglfsscreen.cpp index 84ea1c64835..cb726a016bd 100644 --- a/src/plugins/platforms/eglfs/qeglfsscreen.cpp +++ b/src/plugins/platforms/eglfs/qeglfsscreen.cpp @@ -31,10 +31,12 @@ ** ****************************************************************************/ +#include <QtCore/qtextstream.h> +#include <QtGui/qpa/qplatformcursor.h> + #include "qeglfsscreen.h" #include "qeglfswindow.h" #include "qeglfshooks.h" -#include <QtGui/qpa/qplatformcursor.h> QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/eglfs/qeglfswindow.cpp b/src/plugins/platforms/eglfs/qeglfswindow.cpp index d568d50e597..8a61bcf30db 100644 --- a/src/plugins/platforms/eglfs/qeglfswindow.cpp +++ b/src/plugins/platforms/eglfs/qeglfswindow.cpp @@ -31,14 +31,17 @@ ** ****************************************************************************/ -#include "qeglfswindow.h" -#include "qeglfshooks.h" +#include <QtCore/qtextstream.h> #include <qpa/qwindowsysteminterface.h> #include <qpa/qplatformintegration.h> #include <private/qguiapplication_p.h> #include <QtGui/QOpenGLContext> #include <QtPlatformSupport/private/qeglplatformcursor_p.h> #include <QtPlatformSupport/private/qeglconvenience_p.h> + +#include "qeglfswindow.h" +#include "qeglfshooks.h" + #include <QtDebug> QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/minimalegl/qminimaleglwindow.cpp b/src/plugins/platforms/minimalegl/qminimaleglwindow.cpp index 906a1308da9..d4bee2c9e44 100644 --- a/src/plugins/platforms/minimalegl/qminimaleglwindow.cpp +++ b/src/plugins/platforms/minimalegl/qminimaleglwindow.cpp @@ -31,10 +31,10 @@ ** ****************************************************************************/ -#include "qminimaleglwindow.h" - #include <qpa/qwindowsysteminterface.h> +#include "qminimaleglwindow.h" + QT_BEGIN_NAMESPACE QMinimalEglWindow::QMinimalEglWindow(QWindow *w) diff --git a/src/plugins/platforms/windows/qtwindows_additional.h b/src/plugins/platforms/windows/qtwindows_additional.h index 9451b9ce559..4e773501322 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 90e6d6ab9d7..083d82ed8c9 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 13a3d044a05..c253a9605b2 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) @@ -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; @@ -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/qwindowscontext.h b/src/plugins/platforms/windows/qwindowscontext.h index 28202219d6b..5c2e21192bb 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 0872741e475..b71497b1766 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); @@ -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){ @@ -358,28 +358,34 @@ QWindowsEGLStaticContext *QWindowsEGLStaticContext::create() } EGLDisplay display = EGL_NO_DISPLAY; + EGLint major = 0; + EGLint minor = 0; #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) + if (attributes) { display = libEGL.eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, dc, attributes); + if (!libEGL.eglInitialize(display, &major, &minor)) { + display = EGL_NO_DISPLAY; + major = minor = 0; + } + } } -#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) { @@ -387,9 +393,7 @@ QWindowsEGLStaticContext *QWindowsEGLStaticContext::create() 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) @@ -573,6 +577,7 @@ bool QWindowsEGLContext::makeCurrent(QPlatformSurface *surface) QWindowsEGLStaticContext::libEGL.eglBindAPI(m_api); QWindowsWindow *window = static_cast<QWindowsWindow *>(surface); + window->aboutToMakeCurrent(); EGLSurface eglSurface = static_cast<EGLSurface>(window->surface(m_eglConfig)); Q_ASSERT(eglSurface); diff --git a/src/plugins/platforms/windows/qwindowseglcontext.h b/src/plugins/platforms/windows/qwindowseglcontext.h index 63a7c25a6fd..c2b153e4c1e 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 <EGL/egl.h> QT_BEGIN_NAMESPACE @@ -74,7 +75,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 +84,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 +240,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 @@ -249,7 +251,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/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index 724d0e7aaff..91bc4c64a54 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -932,9 +932,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<QString> StringSet; const QString familyName = QString::fromWCharArray(f->elfLogFont.lfFaceName); const uchar charSet = f->elfLogFont.lfCharSet; @@ -943,79 +942,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<StringSet *>(namesSetIn)->insert(familyName); + addFontToDatabase(familyName, charSet, (TEXTMETRIC *)textmetric, &signature, type); // keep on enumerating return 1; } -static int QT_WIN_CALLBACK storeFontSub(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *textmetric, - int type, LPARAM namesSetIn) +void QWindowsFontDatabase::populateFamily(const QString &familyName) { - Q_UNUSED(textmetric) - Q_UNUSED(type) - + qCDebug(lcQpaFonts) << familyName; + if (familyName.size() >= LF_FACESIZE) { + qCWarning(lcQpaFonts) << "Unable to enumerate family '" << familyName << '\''; + return; + } HDC dummy = GetDC(0); LOGFONT lf; - memset(&lf, 0, sizeof(LOGFONT)); lf.lfCharSet = DEFAULT_CHARSET; - memcpy(lf.lfFaceName, f->elfLogFont.lfFaceName, LF_FACESIZE * sizeof(wchar_t)); + familyName.toWCharArray(lf.lfFaceName); + lf.lfFaceName[familyName.size()] = 0; lf.lfPitchAndFamily = 0; - EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFont, - (LPARAM)namesSetIn, 0); + EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFont, 0, 0); ReleaseDC(0, dummy); - - // keep on enumerating - return 1; } -void QWindowsFontDatabase::populateFontDatabase() +namespace { +// Context for enumerating system fonts, records whether the default font has been encountered, +// which is normally not enumerated by EnumFontFamiliesEx(). +struct PopulateFamiliesContext { - 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); -} - -/*! - \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. -*/ + 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<PopulateFamiliesContext *>(lparam); + if (!context->seenSystemDefaultFont && faceName == context->systemDefaultFont) + context->seenSystemDefaultFont = true; + } + return 1; // continue +} +void QWindowsFontDatabase::populateFontDatabase() +{ + removeApplicationFonts(); HDC dummy = GetDC(0); LOGFONT lf; - memset(&lf, 0, sizeof(LOGFONT)); lf.lfCharSet = DEFAULT_CHARSET; - if (family.size() >= LF_FACESIZE) { - qWarning("%s: Unable to enumerate family '%s'.", - __FUNCTION__, qPrintable(family)); - return; - } - + lf.lfFaceName[0] = 0; lf.lfPitchAndFamily = 0; - - if (family.isEmpty()) { - EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFontSub, - (LPARAM)&m_families, 0); - } else { - memcpy(lf.lfFaceName, family.utf16(), family.size() * sizeof(wchar_t)); - EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFont, - (LPARAM)&m_families, 0); - } - + PopulateFamiliesContext context(QWindowsFontDatabase::systemDefaultFont().family()); + EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)populateFontFamilies, reinterpret_cast<LPARAM>(&context), 0); ReleaseDC(0, dummy); + // Work around EnumFontFamiliesEx() not listing the system font. + if (!context.seenSystemDefaultFont) + QPlatformFontDatabase::registerFontFamily(context.systemDefaultFont); } typedef QSharedPointer<QWindowsFontEngineData> QWindowsFontEngineDataPtr; @@ -1379,7 +1368,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; @@ -1663,7 +1652,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 aa48fb2b08e..eb6273b835d 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<QString> m_families; struct WinApplicationFont { HANDLE handle; diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp index f562b82a2c2..c3bfd9825fe 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp @@ -483,26 +483,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; - memset(&lf, 0, sizeof(LOGFONT)); - lf.lfCharSet = DEFAULT_CHARSET; - memcpy(lf.lfFaceName, f->elfLogFont.lfFaceName, LF_FACESIZE * sizeof(wchar_t)); - 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(); @@ -528,7 +508,6 @@ void QWindowsFontDatabaseFT::populate(const QString &family) HDC dummy = GetDC(0); LOGFONT lf; - memset(&lf, 0, sizeof(LOGFONT)); lf.lfCharSet = DEFAULT_CHARSET; if (family.size() >= LF_FACESIZE) { qWarning("%s: Unable to enumerate family '%s'.", @@ -536,16 +515,12 @@ void QWindowsFontDatabaseFT::populate(const QString &family) return; } + wmemcpy(lf.lfFaceName, reinterpret_cast<const wchar_t*>(family.utf16()), + family.size() + 1); lf.lfPitchAndFamily = 0; - if (family.isEmpty()) { - EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFontSub, - (LPARAM)&m_families, 0); - } else { - memcpy(lf.lfFaceName, family.utf16(), family.size() * sizeof(wchar_t)); - 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/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp index 786a6622876..e71b1011252 100644 --- a/src/plugins/platforms/windows/qwindowsglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp @@ -1305,6 +1305,7 @@ bool QWindowsGLContext::makeCurrent(QPlatformSurface *surface) // Do we already have a DC entry for that window? QWindowsWindow *window = static_cast<QWindowsWindow *>(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/qwindowsinputcontext.cpp b/src/plugins/platforms/windows/qwindowsinputcontext.cpp index d8e4900780d..32074fd9b18 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. diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 54fb138d851..58d675876b3 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; } @@ -328,61 +324,65 @@ 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; - - return ctx; } -bool QWindowsIntegrationPrivate::ensureStaticOpenGLContext() +QWindowsStaticOpenGLContext *QWindowsStaticOpenGLContext::create() { - if (m_staticOpenGLContext.isNull()) - m_staticOpenGLContext = QSharedPointer<QWindowsStaticOpenGLContext>(QWindowsStaticOpenGLContext::create()); - return !m_staticOpenGLContext.isNull(); + return QWindowsStaticOpenGLContext::doCreate(); } QPlatformOpenGLContext *QWindowsIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const { qCDebug(lcQpaGl) << __FUNCTION__ << context->format(); - if (d->ensureStaticOpenGLContext()) { - QScopedPointer<QWindowsOpenGLContext> result(d->m_staticOpenGLContext->createContext(context)); + if (QWindowsStaticOpenGLContext *staticOpenGLContext = QWindowsIntegration::staticOpenGLContext()) { + QScopedPointer<QWindowsOpenGLContext> result(staticOpenGLContext->createContext(context)); if (result->isValid()) return result.take(); } @@ -396,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>(QWindowsStaticOpenGLContext::create()); + return d->m_staticOpenGLContext.data(); } #endif // !QT_NO_OPENGL diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp index acb692579bc..0fa34041d6f 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<QWindowSystemInterface::TouchPoint> 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<QWindowSystemInterface::TouchPoint> 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 6491de93b51..60fe26b2b98 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/qwindowsnativeinterface.cpp b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp index bd5022505ff..b2f853f3e61 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" @@ -223,4 +224,9 @@ QFunctionPointer QWindowsNativeInterface::platformFunction(const QByteArray &fun return Q_NULLPTR; } +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 9b2ac00986d..5c9e15fa358 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/qwindowsopenglcontext.h b/src/plugins/platforms/windows/qwindowsopenglcontext.h index 2f724f3dd70..550bf00a408 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 ba3a95ce7ab..f6caf8b06e3 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,231 @@ ****************************************************************************/ #include "qwindowsopengltester.h" -#include "qt_windows.h" #include "qwindowscontext.h" +#include <QtCore/QVariantMap> +#include <QtCore/QDebug> +#include <QtCore/QTextStream> +#include <QtCore/QCoreApplication> + +#ifndef Q_OS_WINCE +# include <QtCore/qt_windows.h> +# include <private/qsystemlibrary_p.h> +# include <d3d9.h> +# include <GL/gl.h> +#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; +} + +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 HMODULE lib = 0; HWND wnd = 0; HDC dc = 0; @@ -109,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<GetString_t>(::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"); @@ -133,6 +382,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 40a8e9d3ac1..6238eea4b00 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,14 +31,91 @@ ** ****************************************************************************/ +#ifndef QWINDOWSOPENGLTESTER_H +#define QWINDOWSOPENGLTESTER_H + #include <qtwindowsglobal.h> +#include <QtCore/QByteArray> +#include <QtCore/QFlags> + 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: + 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 diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp index 79219e361ad..2566f704366 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.cpp +++ b/src/plugins/platforms/windows/qwindowsscreen.cpp @@ -504,4 +504,13 @@ void QWindowsScreenManager::clearScreens() QWindowsIntegration::instance()->emitDestroyScreen(m_screens.takeLast()); } +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 924912dbc22..ab0fecd970f 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.h +++ b/src/plugins/platforms/windows/qwindowsscreen.h @@ -133,6 +133,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 5dfc48df996..d9c5c97672f 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 @@ -169,6 +170,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 +199,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. @@ -205,6 +227,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<QWindow *>(w))->compositing; + default: + return false; + } +} + static bool applyBlurBehindWindow(HWND hwnd) { #ifdef Q_OS_WINCE @@ -328,6 +362,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 +414,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 +433,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 +464,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 +536,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 ; @@ -514,8 +556,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; @@ -569,7 +615,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); @@ -598,6 +644,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; @@ -612,9 +662,6 @@ QWindowsWindowData result.embedded = embedded; result.customMargins = context->customMargins; - if (isGL && hasAlpha) - applyBlurBehindWindow(result.hwnd); - return result; } @@ -637,7 +684,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 +709,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); } @@ -945,7 +991,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 @@ -1036,7 +1083,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; } @@ -1272,8 +1319,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 @@ -1298,7 +1347,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), @@ -1369,11 +1419,11 @@ 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()) { - QPlatformScreen *newScreen = screenForGeometry(m_data.geometry); + QPlatformScreen *newScreen = screenForGeometry(geometryDip); if (newScreen != screen()) QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->screen()); } @@ -1402,7 +1452,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 @@ -1523,7 +1574,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; @@ -2287,8 +2338,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 @@ -2297,7 +2350,8 @@ void *QWindowsWindow::surface(void *nativeConfig) void QWindowsWindow::invalidateSurface() { if (m_surface) { - m_data.staticOpenGLContext->destroyWindowSurface(m_surface); + if (QWindowsStaticOpenGLContext *staticOpenGLContext = QWindowsIntegration::staticOpenGLContext()) + staticOpenGLContext->destroyWindowSurface(m_surface); m_surface = 0; } } @@ -2322,4 +2376,22 @@ void QWindowsWindow::registerTouchWindow(QWindowsWindowFunctions::TouchWindowTou #endif // !Q_OS_WINCE } +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 3e2f488f466..674f0ab00d3 100644 --- a/src/plugins/platforms/windows/qwindowswindow.h +++ b/src/plugins/platforms/windows/qwindowswindow.h @@ -108,9 +108,6 @@ struct QWindowsWindowData QMargins customMargins; // User-defined, additional frame for NCCALCSIZE HWND hwnd; bool embedded; -#ifndef QT_NO_OPENGL - QSharedPointer<QWindowsStaticOpenGLContext> staticOpenGLContext; -#endif // QT_NO_OPENGL static QWindowsWindowData create(const QWindow *w, const QWindowsWindowData ¶meters, @@ -141,7 +138,8 @@ public: WithinCreate = 0x20000, WithinMaximize = 0x40000, MaximizeToFullScreen = 0x80000, - InputMethodDisabled =0x100000 + InputMethodDisabled = 0x100000, + Compositing = 0x200000 }; QWindowsWindow(QWindow *window, const QWindowsWindowData &data); @@ -255,6 +253,7 @@ public: void *surface(void *nativeConfig); void invalidateSurface() Q_DECL_OVERRIDE; + void aboutToMakeCurrent(); #ifndef Q_OS_WINCE void setAlertState(bool enabled); diff --git a/src/plugins/platforms/windows/windows.pri b/src/plugins/platforms/windows/windows.pri index 8e5f35d2932..246598677fe 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 } diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp index 5de5b6bb55f..9944f54780e 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 1bca9a036fa..b5188fd41c4 100644 --- a/src/plugins/platforms/xcb/qxcbdrag.h +++ b/src/plugins/platforms/xcb/qxcbdrag.h @@ -70,7 +70,6 @@ public: virtual QMimeData *platformDropData() Q_DECL_OVERRIDE; - void startDrag() Q_DECL_OVERRIDE; void cancel() Q_DECL_OVERRIDE; void move(const QMouseEvent *me) Q_DECL_OVERRIDE; @@ -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; } diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index 5fb745717b9..85fef3912cc 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<int> 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<int> 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<int> 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); } diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 0e28cf26987..a945b4cc180 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -730,6 +730,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()) @@ -2300,7 +2303,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)); + xcbScreen()->windowShown(this); break; case XEMBED_FOCUS_IN: Qt::FocusReason reason; diff --git a/src/testlib/testlib.pro b/src/testlib/testlib.pro index 17a03781c25..dbcc588d100 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 \ diff --git a/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp b/src/tools/qdbuscpp2xml/qdbuscpp2xml.cpp index dc735df2978..8b13334ca0a 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 871175a8221..76401da15bd 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 e7d651704e5..bcad595f72c 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. @@ -3890,7 +3890,7 @@ <author>Qt Development Frameworks</author> <publisher>Qt Project</publisher> <copyright> - <copyryear year="2014"/> + <copyryear year="2015"/> <copyrholder>Qt Project</copyrholder> </copyright> <permissions view="all"/> diff --git a/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc b/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc index 94d38597d29..da381f1326b 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. @@ -1575,7 +1575,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 05c3c94cc96..6ffe322217a 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/tools/rcc/main.cpp b/src/tools/rcc/main.cpp index 3c556d76a8a..2cfc30ed3f9 100644 --- a/src/tools/rcc/main.cpp +++ b/src/tools/rcc/main.cpp @@ -47,6 +47,7 @@ #ifdef Q_OS_WIN # include <fcntl.h> # include <io.h> +# include <stdio.h> #endif // Q_OS_WIN QT_BEGIN_NAMESPACE @@ -199,7 +200,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; } diff --git a/src/tools/uic/ui4.cpp b/src/tools/uic/ui4.cpp index 01b4437db79..7563d1d64b2 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" @@ -128,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; } @@ -155,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); @@ -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; @@ -705,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); @@ -776,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; } @@ -853,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; } @@ -864,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); @@ -935,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; } @@ -1017,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; } @@ -1028,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); @@ -1157,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; } @@ -1172,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); @@ -1262,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; } @@ -1336,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; } @@ -1347,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); @@ -1438,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); @@ -1510,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); @@ -1582,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; } @@ -1593,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); @@ -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; @@ -1685,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; } @@ -1762,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); @@ -1831,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; } @@ -1927,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); @@ -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; @@ -2302,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); @@ -2370,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; } @@ -2440,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; } @@ -2536,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; } @@ -2611,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; } @@ -2686,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; } @@ -2776,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; } @@ -2811,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); @@ -2962,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; } @@ -2989,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); @@ -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; @@ -3145,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); @@ -3217,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); @@ -3299,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; } @@ -3314,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); @@ -3462,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()); @@ -3481,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; } @@ -3766,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; } @@ -3777,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); @@ -3856,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; } @@ -3867,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; } @@ -3985,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; } @@ -3996,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); @@ -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; @@ -4131,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; } @@ -4190,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); @@ -4311,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; } @@ -4322,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); @@ -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; @@ -4466,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; } @@ -4477,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); @@ -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; @@ -4572,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); @@ -4668,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); @@ -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; @@ -4832,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); @@ -5078,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; } @@ -5176,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; } @@ -5306,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; } @@ -5389,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; } @@ -5404,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; } @@ -5542,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; } @@ -5638,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; } @@ -5753,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; } @@ -5874,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; } @@ -6046,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; } @@ -6065,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; } @@ -6143,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; } @@ -6251,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; } @@ -6266,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); @@ -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; @@ -6585,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; } @@ -6669,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; } @@ -6767,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; } @@ -6899,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; } @@ -6991,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; } @@ -7066,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); @@ -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; @@ -7254,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; } @@ -7269,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); @@ -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; @@ -8082,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); @@ -8154,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); @@ -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; @@ -8318,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); @@ -8390,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; } @@ -8401,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; } @@ -8496,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; } @@ -8573,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); @@ -8645,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); @@ -8717,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; } @@ -8801,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); @@ -8873,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; } diff --git a/src/tools/uic/ui4.h b/src/tools/uic/ui4.h index d50a70c4683..51a70749ce7 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 diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index e4862f16d1c..34668f4473a 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) "<p>Qt and the Qt logo are trademarks of Digia Plc and/or its subsidiary(-ies).</p>" "<p>Qt is a Digia product developed as an open source project. See <a href=\"http://%3/\">%3</a> " "for more information.</p>" - ).arg(QStringLiteral("2014"), + ).arg(QStringLiteral("2015"), QStringLiteral("qt.io/licensing"), QStringLiteral("qt.io")); QMessageBox *msgBox = new QMessageBox(parent); diff --git a/src/widgets/graphicsview/qgraphicswidget.cpp b/src/widgets/graphicsview/qgraphicswidget.cpp index 87b4b2b5a81..554dda0b8e7 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; diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index 8a08badde23..2f9497b9910 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -2384,7 +2384,7 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) } #endif break; -#ifdef Q_DEAD_CODE_FROM_QT4_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 @@ -2414,7 +2414,7 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) selectAll(); break; } -#ifdef Q_DEAD_CODE_FROM_QT4_MAC +#ifdef Q_OS_MAC if (event->key() == Qt::Key_O && event->modifiers() & Qt::ControlModifier && currentIndex().isValid()) { emit activated(currentIndex()); break; diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp index e7d18092f12..add60d4d88f 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 062debf4ee3..79448227603 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 b440ed6421d..0fede7367da 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -3977,7 +3977,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); } diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp index 007760ef168..bd108886364 100644 --- a/src/widgets/itemviews/qtreewidget.cpp +++ b/src/widgets/itemviews/qtreewidget.cpp @@ -2935,8 +2935,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 { @@ -3276,8 +3274,18 @@ QMimeData *QTreeWidget::mimeData(const QList<QTreeWidgetItem*> items) const QList<QModelIndex> 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); diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 392db60e2b7..dfe507018b5 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -3304,12 +3304,10 @@ bool QApplication::notify(QObject *receiver, QEvent *e) QWidget* w = static_cast<QWidget *>(receiver); QWheelEvent* wheel = static_cast<QWheelEvent*>(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(); diff --git a/src/widgets/kernel/qdesktopwidget.cpp b/src/widgets/kernel/qdesktopwidget.cpp index 67264133efb..563707b0212 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<const QDesktopWidgetPrivate *>(qt_widget_private(QApplication::desktop())); + return desktopWidgetP->screens.indexOf(const_cast<QDesktopScreenWidget *>(this)); +} + const QRect QDesktopWidget::screenGeometry(const QWidget *widget) const { if (!widget) { @@ -72,29 +79,22 @@ void QDesktopWidgetPrivate::_q_updateScreens() const QList<QScreen *> 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; + 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 0f3083cbb59..639af3f9a7b 100644 --- a/src/widgets/kernel/qdesktopwidget_p.h +++ b/src/widgets/kernel/qdesktopwidget_p.h @@ -55,12 +55,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/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp index 8ed2f52cbbb..b5c547077c7 100644 --- a/src/widgets/kernel/qopenglwidget.cpp +++ b/src/widgets/kernel/qopenglwidget.cpp @@ -826,6 +826,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; } diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index ca82dadabb5..3d3b7bef814 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<const QDesktopScreenWidget *>(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; @@ -1412,8 +1413,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 @@ -1713,7 +1721,7 @@ void QWidgetPrivate::createTLExtra() x->embedded = 0; x->window = 0; x->shareContext = 0; - x->screenIndex = 0; + x->initialScreenIndex = -1; #ifdef Q_DEAD_CODE_FROM_QT4_MAC x->wasMaximized = false; #endif // Q_DEAD_CODE_FROM_QT4_MAC @@ -7736,10 +7744,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)) @@ -7754,10 +7769,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) { @@ -10496,9 +10509,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<const QDesktopScreenWidget *>(newparent); + targetScreen = sw ? sw->screenNumber() : 0; newparent = 0; } @@ -10530,7 +10542,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()); } } @@ -10574,12 +10586,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 6e4c93e7be7..febd94d1f7b 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 { diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp index 34cfb2d99f3..5460a43ef49 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 diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 40a2ca7f149..1321ffa497f 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; diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp index ed5eca7318d..d7d8e73767a 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; @@ -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 5027588c939..3bc4a7cd661 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); diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp index c0f9538c0a9..034894aa24f 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" @@ -708,11 +709,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()); } } @@ -745,6 +742,27 @@ void QSystemTrayIconPrivate::showMessage_sys_qpa(const QString &title, static_cast<QPlatformSystemTrayIcon::MessageIcon>(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<QAction *> 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 fdf91d4c433..8bf2302ab5d 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 &title, const QString &msg, QSystemTrayIcon::MessageIcon icon, int secs); + void addPlatformMenu(QMenu *menu) const; }; class QBalloonTip : public QWidget diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp index a73e0856330..6747bdc2a78 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 eabaa160a03..fe147472d17 100644 --- a/src/widgets/widgets/qwidgettextcontrol.cpp +++ b/src/widgets/widgets/qwidgettextcontrol.cpp @@ -1341,6 +1341,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 diff --git a/src/winmain/qtmain_win.cpp b/src/winmain/qtmain_win.cpp index 778ddee64b0..25b79543ba0 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) |