diff options
Diffstat (limited to 'src')
121 files changed, 1240 insertions, 878 deletions
diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in index 9bda70ec07..4387bedc44 100644 --- a/src/corelib/Qt5CoreConfigExtras.cmake.in +++ b/src/corelib/Qt5CoreConfigExtras.cmake.in @@ -66,14 +66,12 @@ list(APPEND Qt5Core_INCLUDE_DIRS ${_qt5_corelib_extra_includes}) set_property(TARGET Qt5::Core APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${_qt5_corelib_extra_includes}) set(_qt5_corelib_extra_includes) -!!IF !isEmpty(CMAKE_ADD_FPIE_FLAGS) # Targets using Qt need to use the POSITION_INDEPENDENT_CODE property. The # Qt5_POSITION_INDEPENDENT_CODE variable is used in the # qt5_use_module # macro to add it. set(Qt5_POSITION_INDEPENDENT_CODE True) set_property(TARGET Qt5::Core PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE \"ON\") set(Qt5Core_EXECUTABLE_COMPILE_FLAGS \"-fPIE\") -!!ENDIF !!IF !isEmpty(QT_NAMESPACE) list(APPEND Qt5Core_DEFINITIONS -DQT_NAMESPACE=$$QT_NAMESPACE) diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 7be4ed8bef..d144c4faad 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -533,7 +533,6 @@ # define Q_COMPILER_AUTO_FUNCTION # define Q_COMPILER_NULLPTR # define Q_COMPILER_TEMPLATE_ALIAS -# define Q_COMPILER_UNICODE_STRINGS # define Q_COMPILER_VARIADIC_TEMPLATES # endif # if __INTEL_COMPILER >= 1300 @@ -554,6 +553,7 @@ # define Q_COMPILER_RANGE_FOR # define Q_COMPILER_RAW_STRINGS # define Q_COMPILER_REF_QUALIFIERS +# define Q_COMPILER_UNICODE_STRINGS # define Q_COMPILER_UNRESTRICTED_UNIONS # endif # if __INTEL_COMPILER >= 1500 diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index cb8bd15d8d..dade7fc6ec 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -37,11 +37,11 @@ #include <stddef.h> -#define QT_VERSION_STR "5.4.1" +#define QT_VERSION_STR "5.4.2" /* QT_VERSION is (major << 16) + (minor << 8) + patch. */ -#define QT_VERSION 0x050401 +#define QT_VERSION 0x050402 /* can be used like #if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0)) */ diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 86ba082398..18b672d7ee 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -77,14 +77,21 @@ #endif #if !defined QT_NO_REGULAREXPRESSION && !defined(QT_BOOTSTRAPPED) -# if (defined(__GLIBC__) && defined(__GLIBCXX__)) || (__has_include(<cxxabi.h>) && __has_include(<execinfo.h>)) +# ifdef __UCLIBC__ +# if __UCLIBC_HAS_BACKTRACE__ +# define QLOGGING_HAVE_BACKTRACE +# endif +# elif (defined(__GLIBC__) && defined(__GLIBCXX__)) || (__has_include(<cxxabi.h>) && __has_include(<execinfo.h>)) # define QLOGGING_HAVE_BACKTRACE -# include <qregularexpression.h> -# include <cxxabi.h> -# include <execinfo.h> # endif #endif +#ifdef QLOGGING_HAVE_BACKTRACE +# include <qregularexpression.h> +# include <cxxabi.h> +# include <execinfo.h> +#endif + #include <stdio.h> QT_BEGIN_NAMESPACE diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp index cd42aff35c..bfa4483ca7 100644 --- a/src/corelib/io/qfilesystemengine_unix.cpp +++ b/src/corelib/io/qfilesystemengine_unix.cpp @@ -83,13 +83,13 @@ static bool isPackage(const QFileSystemMetaData &data, const QFileSystemEntry &e if (suffix.length() > 0) { // First step: is the extension known ? - CFStringRef extensionRef = QCFString::toCFStringRef(suffix); - CFStringRef uniformTypeIdentifier = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, extensionRef, NULL); + QCFType<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 a234050777..939cecfb44 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -1044,9 +1044,9 @@ bool QProcessPrivate::_q_processDied() return false; #endif #ifdef Q_OS_WIN - drainOutputPipes(); if (processFinishedNotifier) processFinishedNotifier->setEnabled(false); + drainOutputPipes(); #endif // the process may have died before it got a chance to report that it was diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp index ee6b7e13f4..9e60daa5b4 100644 --- a/src/corelib/io/qprocess_win.cpp +++ b/src/corelib/io/qprocess_win.cpp @@ -785,6 +785,7 @@ bool QProcessPrivate::waitForFinished(int msecs) void QProcessPrivate::findExitCode() { DWORD theExitCode; + Q_ASSERT(pid); if (GetExitCodeProcess(pid->hProcess, &theExitCode)) { exitCode = theExitCode; crashed = (exitCode == 0xf291 // our magic number, see killProcess diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp index 089a915a36..571875c508 100644 --- a/src/corelib/io/qtextstream.cpp +++ b/src/corelib/io/qtextstream.cpp @@ -1550,11 +1550,10 @@ QString QTextStream::readAll() the stream contains lines longer than this, then the lines will be split after \a maxlen characters and returned in parts. - If \a maxlen is 0, the lines can be of any length. A common value - for \a maxlen is 75. + If \a maxlen is 0, the lines can be of any length. The returned line has no trailing end-of-line characters ("\\n" - or "\\r\\n"), so calling QString::trimmed() is unnecessary. + or "\\r\\n"), so calling QString::trimmed() can be unnecessary. If the stream has read to the end of the file, \l {QTextStream::readLine()}{readLine()} will return a null QString. For strings, or for devices that support it, diff --git a/src/corelib/io/qwindowspipewriter_p.h b/src/corelib/io/qwindowspipewriter_p.h index 47b7744e81..6035993500 100644 --- a/src/corelib/io/qwindowspipewriter_p.h +++ b/src/corelib/io/qwindowspipewriter_p.h @@ -45,7 +45,7 @@ // We mean it. // -#include <qdatetime.h> +#include <qelapsedtimer.h> #include <qthread.h> #include <qmutex.h> #include <qwaitcondition.h> @@ -83,7 +83,7 @@ public: { if (totalTimeOut == -1) return SLEEPMAX; - return qMax(totalTimeOut - timer.elapsed(), 0); + return qMax(int(totalTimeOut - timer.elapsed()), 0); } bool hasTimedOut() const @@ -99,7 +99,7 @@ public: } private: - QTime timer; + QElapsedTimer timer; int totalTimeOut; int nextSleep; }; diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp index 191ceaa37b..85b7f51bd6 100644 --- a/src/corelib/kernel/qcoreevent.cpp +++ b/src/corelib/kernel/qcoreevent.cpp @@ -538,7 +538,7 @@ QTimerEvent::~QTimerEvent() \a child. \a type can be QEvent::ChildAdded, QEvent::ChildRemoved, - QEvent::ChildPolished, or QEvent::ChildRemoved. + or QEvent::ChildPolished. \sa child() */ diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index a1a04b3ce5..f2ceb7081c 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -3710,13 +3710,14 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i } else if (callFunction && c->method_offset <= receiver->metaObject()->methodOffset()) { //we compare the vtable to make sure we are not in the destructor of the object. locker.unlock(); + const int methodIndex = c->method(); if (qt_signal_spy_callback_set.slot_begin_callback != 0) - qt_signal_spy_callback_set.slot_begin_callback(receiver, c->method(), argv ? argv : empty_argv); + qt_signal_spy_callback_set.slot_begin_callback(receiver, methodIndex, argv ? argv : empty_argv); callFunction(receiver, QMetaObject::InvokeMetaMethod, method_relative, argv ? argv : empty_argv); if (qt_signal_spy_callback_set.slot_end_callback != 0) - qt_signal_spy_callback_set.slot_end_callback(receiver, c->method()); + qt_signal_spy_callback_set.slot_end_callback(receiver, methodIndex); locker.relock(); } else { const int method = method_relative + c->method_offset; diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index 3caad7c4b2..933fd06afa 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -178,7 +178,7 @@ QThreadPrivate::~QThreadPrivate() event loop by calling exec() and runs a Qt event loop inside the thread. You can use worker objects by moving them to the thread using - QObject::moveToThread. + QObject::moveToThread(). \snippet code/src_corelib_thread_qthread.cpp worker @@ -256,7 +256,7 @@ QThreadPrivate::~QThreadPrivate() \l{Mandelbrot Example}, as that is the name of the QThread subclass). Note that this is currently not available with release builds on Windows. - \sa {Thread Support in Qt}, QThreadStorage, {Synchronizing Threads} + \sa {Thread Support in Qt}, QThreadStorage, {Synchronizing Threads}, {Mandelbrot Example}, {Semaphores Example}, {Wait Conditions Example} */ diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index a3c1cc3907..bd0215902c 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -3945,7 +3945,7 @@ QByteArray QByteArray::fromRawData(const char *data, int size) copies of it exist that have not been modified. This function can be used instead of fromRawData() to re-use - existings QByteArray objects to save memory re-allocations. + existing QByteArray objects to save memory re-allocations. \sa fromRawData(), data(), constData() */ diff --git a/src/corelib/tools/qbytearraymatcher.cpp b/src/corelib/tools/qbytearraymatcher.cpp index f14d941c27..82f012be66 100644 --- a/src/corelib/tools/qbytearraymatcher.cpp +++ b/src/corelib/tools/qbytearraymatcher.cpp @@ -256,7 +256,7 @@ static int qFindByteArrayBoyerMoore( #define REHASH(a) \ if (sl_minus_1 < sizeof(uint) * CHAR_BIT) \ - hashHaystack -= (a) << sl_minus_1; \ + hashHaystack -= uint(a) << sl_minus_1; \ hashHaystack <<= 1 /*! diff --git a/src/corelib/tools/qfreelist_p.h b/src/corelib/tools/qfreelist_p.h index bfb03fb723..189140016c 100644 --- a/src/corelib/tools/qfreelist_p.h +++ b/src/corelib/tools/qfreelist_p.h @@ -171,7 +171,7 @@ class QFreeList // take the current serial number from \a o, increment it, and store it in \a n static inline int incrementserial(int o, int n) { - return (n & ConstantsType::IndexMask) | ((o + ConstantsType::SerialCounter) & ConstantsType::SerialMask); + return int((uint(n) & ConstantsType::IndexMask) | ((uint(o) + ConstantsType::SerialCounter) & ConstantsType::SerialMask)); } // the blocks diff --git a/src/corelib/tools/qline.cpp b/src/corelib/tools/qline.cpp index 4561f831c8..9feb697aad 100644 --- a/src/corelib/tools/qline.cpp +++ b/src/corelib/tools/qline.cpp @@ -334,7 +334,7 @@ QDataStream &operator>>(QDataStream &stream, QLine &line) or a null line. The intersect() function determines the IntersectType for this - line and a given line, while the angle() function returns the + line and a given line, while the angleTo() function returns the angle between the lines. In addition, the unitVector() function returns a line that has the same starting point as this line, but with a length of only 1, while the normalVector() function returns diff --git a/src/corelib/tools/qmargins.cpp b/src/corelib/tools/qmargins.cpp index 419551aaca..265e44bfcf 100644 --- a/src/corelib/tools/qmargins.cpp +++ b/src/corelib/tools/qmargins.cpp @@ -484,7 +484,7 @@ QDebug operator<<(QDebug dbg, const QMargins &m) { /*! \fn bool QMarginsF::isNull() const - Returns \c true if all margins are is 0; otherwise returns + Returns \c true if all margins are 0; otherwise returns false. */ diff --git a/src/corelib/tools/qpair.h b/src/corelib/tools/qpair.h index b2217e4dd0..76b7abd263 100644 --- a/src/corelib/tools/qpair.h +++ b/src/corelib/tools/qpair.h @@ -56,7 +56,9 @@ struct QPair { first = p.first; second = p.second; return *this; } #ifdef Q_COMPILER_RVALUE_REFS template <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> 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 061c7a5a2d..a18b2c28a1 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -412,6 +412,7 @@ public: # ifdef QT_SHAREDPOINTER_TRACK_POINTERS internalSafetyCheckAdd(result.d, result.value); # endif + result.enableSharedFromThis(result.data()); return result; } #else @@ -432,6 +433,7 @@ public: internalSafetyCheckAdd(result.d, result.value); # endif result.d->setQObjectShared(result.value, true); + result.enableSharedFromThis(result.data()); return result; } diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp index d1698b812f..ad10c63686 100644 --- a/src/corelib/xml/qxmlstream.cpp +++ b/src/corelib/xml/qxmlstream.cpp @@ -728,7 +728,7 @@ static const short QXmlStreamReader_tokenTypeString_indices[] = { /*! \property QXmlStreamReader::namespaceProcessing - the namespace-processing flag of the stream reader + The namespace-processing flag of the stream reader This property controls whether or not the stream reader processes namespaces. If enabled, the reader processes namespaces, otherwise @@ -3318,7 +3318,7 @@ QTextCodec *QXmlStreamWriter::codec() const /*! \property QXmlStreamWriter::autoFormatting \since 4.4 - the auto-formatting flag of the stream writer + The auto-formatting flag of the stream writer This property controls whether or not the stream writer automatically formats the generated XML data. If enabled, the diff --git a/src/gui/doc/snippets/code/src_gui_image_qpixmap.cpp b/src/gui/doc/snippets/code/src_gui_image_qpixmap.cpp index f43bba1324..a691c24ce0 100644 --- a/src/gui/doc/snippets/code/src_gui_image_qpixmap.cpp +++ b/src/gui/doc/snippets/code/src_gui_image_qpixmap.cpp @@ -48,7 +48,7 @@ static const char * const start_xpm[]={ //! [1] QPixmap myPixmap; -myPixmap->setMask(myPixmap->createHeuristicMask()); +myPixmap.setMask(myPixmap.createHeuristicMask()); //! [1] //! [2] diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index 6f6bf158c8..86d9c02c6e 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -1026,13 +1026,13 @@ void QIcon::addFile(const QString &fileName, const QSize &size, Mode mode, State // Check if a "@2x" file exists and add it. static bool disable2xImageLoading = !qgetenv("QT_HIGHDPI_DISABLE_2X_IMAGE_LOADING").isEmpty(); if (!disable2xImageLoading && qApp->devicePixelRatio() > 1.0) { + QString at2xfileName = fileName; int dotIndex = fileName.lastIndexOf(QLatin1Char('.')); - if (dotIndex != -1) { - QString at2xfileName = fileName; - at2xfileName.insert(dotIndex, QStringLiteral("@2x")); - if (QFile::exists(at2xfileName)) - d->engine->addFile(at2xfileName, size, mode, state); - } + if (dotIndex == -1) /* no dot */ + dotIndex = fileName.size(); /* append */ + at2xfileName.insert(dotIndex, QStringLiteral("@2x")); + if (QFile::exists(at2xfileName)) + d->engine->addFile(at2xfileName, size, mode, state); } } diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp index 858a0d9f21..b2681f4261 100644 --- a/src/gui/image/qimage_conversions.cpp +++ b/src/gui/image/qimage_conversions.cpp @@ -2520,7 +2520,7 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma 0, 0, 0, - 0, + convert_RGBA_to_ARGB_inplace, convert_RGBA_to_ARGB_inplace, convert_RGBA_to_ARGB_inplace, 0, @@ -2543,7 +2543,6 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma 0, 0, 0, - 0, convert_RGBA_to_ARGB_inplace, convert_RGBA_to_ARGB_PM_inplace, 0, @@ -2557,6 +2556,7 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma 0, 0, 0, + 0, 0, 0, 0, 0 }, // Format_RGBA8888 { @@ -2566,7 +2566,6 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma 0, 0, 0, - 0, convert_RGBA_to_ARGB_inplace, 0, 0, @@ -2579,6 +2578,7 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma 0, 0, 0, + 0, 0, 0, 0, 0 }, // Format_RGBA8888_Premultiplied { diff --git a/src/gui/itemmodels/qstandarditemmodel.cpp b/src/gui/itemmodels/qstandarditemmodel.cpp index 44ee710268..eae2b419e3 100644 --- a/src/gui/itemmodels/qstandarditemmodel.cpp +++ b/src/gui/itemmodels/qstandarditemmodel.cpp @@ -2942,9 +2942,13 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const itemsSet.reserve(indexes.count()); stack.reserve(indexes.count()); for (int i = 0; i < indexes.count(); ++i) { - QStandardItem *item = itemFromIndex(indexes.at(i)); - itemsSet << item; - stack.push(item); + if (QStandardItem *item = itemFromIndex(indexes.at(i))) { + itemsSet << item; + stack.push(item); + } else { + qWarning() << "QStandardItemModel::mimeData: No item associated with invalid index"; + return 0; + } } //remove duplicates childrens @@ -2978,16 +2982,11 @@ QMimeData *QStandardItemModel::mimeData(const QModelIndexList &indexes) const //stream everything recursively while (!stack.isEmpty()) { QStandardItem *item = stack.pop(); - if(itemsSet.contains(item)) { //if the item is selection 'top-level', strem its position + if (itemsSet.contains(item)) //if the item is selection 'top-level', stream its position stream << item->row() << item->column(); - } - if(item) { - stream << *item << item->columnCount() << item->d_ptr->children.count(); - stack += item->d_ptr->children; - } else { - QStandardItem dummy; - stream << dummy << 0 << 0; - } + + stream << *item << item->columnCount() << item->d_ptr->children.count(); + stack += item->d_ptr->children; } data->setData(format, encoded); diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index dc5501eaf5..928d0cddc9 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -2578,9 +2578,14 @@ void QGuiApplicationPrivate::reportRefreshRateChange(QWindowSystemInterfacePriva return; QScreen *s = e->screen.data(); - s->d_func()->refreshRate = e->rate; - - emit s->refreshRateChanged(s->refreshRate()); + qreal rate = e->rate; + // safeguard ourselves against buggy platform behavior... + if (rate < 1.0) + rate = 60.0; + if (!qFuzzyCompare(s->d_func()->refreshRate, rate)) { + s->d_func()->refreshRate = rate; + emit s->refreshRateChanged(s->refreshRate()); + } } void QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent *e) diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index 5918f30660..b663afabbc 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -518,8 +518,9 @@ void QOpenGLContext::setScreen(QScreen *screen) in addition. Therefore \a handle is variant containing a platform-specific value type. These classes can be found in the QtPlatformHeaders module. - When create() is called with native handles set, the handles' ownership are - not taken, meaning that \c destroy() will not destroy the native context. + When create() is called with native handles set, QOpenGLContext does not + take ownership of the handles, so destroying the QOpenGLContext does not + destroy the native context. \note Some frameworks track the current context and surfaces internally. Making the adopted QOpenGLContext current via Qt will have no effect on such @@ -582,8 +583,8 @@ QVariant QOpenGLContext::nativeHandle() const Returns \c true if the native context was successfully created and is ready to be used with makeCurrent(), swapBuffers(), etc. - \note If the context is already created, this function will first call - \c destroy(), and then create a new OpenGL context. + \note If the context already exists, this function destroys the existing + context first, and then creates a new one. \sa makeCurrent(), format() */ @@ -605,6 +606,8 @@ bool QOpenGLContext::create() } /*! + \internal + Destroy the underlying platform context associated with this context. If any other context is directly or indirectly sharing resources with this @@ -658,8 +661,7 @@ void QOpenGLContext::destroy() /*! Destroys the QOpenGLContext object. - This implicitly calls \c destroy(), so if this is the current context for the - thread, doneCurrent() is also called. + If this is the current context for the thread, doneCurrent() is also called. */ QOpenGLContext::~QOpenGLContext() { diff --git a/src/gui/kernel/qscreen_p.h b/src/gui/kernel/qscreen_p.h index cdb923c429..53d4f3404a 100644 --- a/src/gui/kernel/qscreen_p.h +++ b/src/gui/kernel/qscreen_p.h @@ -64,6 +64,9 @@ public: availableGeometry = platformScreen->availableGeometry(); logicalDpi = platformScreen->logicalDpi(); refreshRate = platformScreen->refreshRate(); + // safeguard ourselves against buggy platform behavior... + if (refreshRate < 1.0) + refreshRate = 60.0; updatePrimaryOrientation(); diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index a5a395cce2..579c0bc2a9 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -13,6 +13,7 @@ HEADERS += \ painting/qdrawhelper_x86_p.h \ painting/qdrawingprimitive_sse2_p.h \ painting/qemulationpaintengine_p.h \ + painting/qfixed_p.h \ painting/qgrayraster_p.h \ painting/qmatrix.h \ painting/qmemrotate_p.h \ diff --git a/src/gui/painting/qfixed_p.h b/src/gui/painting/qfixed_p.h index 69a7b06780..68314d0434 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/painting/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h index 82fcd9765a..b831621a0c 100644 --- a/src/gui/painting/qpaintengineex_p.h +++ b/src/gui/painting/qpaintengineex_p.h @@ -65,8 +65,6 @@ struct StrokeHandler; QDebug Q_GUI_EXPORT &operator<<(QDebug &, const QVectorPath &path); #endif -class QPixmapFilter; - class Q_GUI_EXPORT QPaintEngineEx : public QPaintEngine { Q_DECLARE_PRIVATE(QPaintEngineEx) @@ -140,13 +138,6 @@ public: virtual void beginNativePainting() {} virtual void endNativePainting() {} - // Return a pixmap filter of "type" that can render the parameters - // in "prototype". The returned filter is owned by the engine and - // will be destroyed when the engine is destroyed. The "prototype" - // allows the engine to pick different filters based on the parameters - // that will be requested, and not just the "type". - virtual QPixmapFilter *pixmapFilter(int /*type*/, const QPixmapFilter * /*prototype*/) { return 0; } - // These flags are needed in the implementation of paint buffers. enum Flags { diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 99814dba82..fcdb6ecca9 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -382,7 +382,7 @@ void QtFontFamily::ensurePopulated() return; QGuiApplicationPrivate::platformIntegration()->fontDatabase()->populateFamily(name); - Q_ASSERT(populated); + Q_ASSERT_X(populated, Q_FUNC_INFO, qPrintable(name)); } class QFontDatabasePrivate diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp index 2e289e2bd8..b1205a8c85 100644 --- a/src/gui/text/qtextcursor.cpp +++ b/src/gui/text/qtextcursor.cpp @@ -910,8 +910,8 @@ QTextLayout *QTextCursorPrivate::blockLayout(QTextBlock &block) const{ select text. For selections see selectionStart(), selectionEnd(), hasSelection(), clearSelection(), and removeSelectedText(). - If the position() is at the start of a block atBlockStart() - returns \c true; and if it is at the end of a block atBlockEnd() returns + If the position() is at the start of a block, atBlockStart() + returns \c true; and if it is at the end of a block, atBlockEnd() returns true. The format of the current character is returned by charFormat(), and the format of the current block is returned by blockFormat(). @@ -921,9 +921,9 @@ QTextLayout *QTextCursorPrivate::blockLayout(QTextBlock &block) const{ mergeBlockFormat() functions. The 'set' functions will replace the cursor's current character or block format, while the 'merge' functions add the given format properties to the cursor's current - format. If the cursor has a selection the given format is applied - to the current selection. Note that when only parts of a block is - selected the block format is applied to the entire block. The text + format. If the cursor has a selection, the given format is applied + to the current selection. Note that when only a part of a block is + selected, the block format is applied to the entire block. The text at the current character position can be turned into a list using createList(). diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index ea2b794feb..77e0fec80d 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -1171,7 +1171,7 @@ QString QTextDocument::toPlainText() const /*! Replaces the entire contents of the document with the given plain - \a text. + \a text. The undo/redo history is reset when this function is called. \sa setHtml() */ @@ -1189,7 +1189,8 @@ void QTextDocument::setPlainText(const QString &text) /*! Replaces the entire contents of the document with the given - HTML-formatted text in the \a html string. + HTML-formatted text in the \a html string. The undo/redo history + is reset when this function is called. The HTML formatting is respected as much as possible; for example, "<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 13bfa2386d..8f874e0245 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1237,6 +1237,15 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, const ushort *st } #ifdef Q_OS_MAC + // CTRunGetPosition has a bug which applies matrix on 10.6, so we disable + // scaling the advances for this particular version + if (actualFontEngine->fontDef.stretch != 100 + && QSysInfo::MacintoshVersion != QSysInfo::MV_10_6) { + QFixed stretch = QFixed(actualFontEngine->fontDef.stretch) / QFixed(100); + for (uint i = 0; i < num_glyphs; ++i) + g.advances[i] *= stretch; + } + if (actualFontEngine->fontDef.styleStrategy & QFont::ForceIntegerMetrics) { for (uint i = 0; i < num_glyphs; ++i) g.advances[i] = g.advances[i].round(); diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index cecfd85df1..0bffbcc802 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -319,7 +319,7 @@ uint QTextFormatPrivate::recalcHash() const { hashValue = 0; for (QVector<Property>::ConstIterator it = props.constBegin(); it != props.constEnd(); ++it) - hashValue += (it->key << 16) + variantHash(it->value); + hashValue += (static_cast<quint32>(it->key) << 16) + variantHash(it->value); hashDirty = false; @@ -1904,7 +1904,7 @@ void QTextCharFormat::setFont(const QFont &font) If \a behavior is QTextCharFormat::FontPropertiesAll, the font property that has not been explicitly set is treated like as it were set with default value; - If \a behavior is QTextCharFormat::FontPropertiesAll, the font property that + If \a behavior is QTextCharFormat::FontPropertiesSpecifiedOnly, the font property that has not been explicitly set is ignored and the respective property value remains unchanged. @@ -1942,7 +1942,7 @@ void QTextCharFormat::setFont(const QFont &font, FontPropertiesInheritanceBehavi setFontFixedPitch(font.fixedPitch()); if (mask & QFont::CapitalizationResolved) setFontCapitalization(font.capitalization()); - if (mask & QFont::LetterSpacingResolved) + if (mask & QFont::WordSpacingResolved) setFontWordSpacing(font.wordSpacing()); if (mask & QFont::LetterSpacingResolved) { setFontLetterSpacingType(font.letterSpacingType()); diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index d24fb159e2..9f63280bf8 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -931,7 +931,8 @@ void QHttpNetworkConnectionChannel::_q_encrypted() if (!protocolHandler) { switch (sslSocket->sslConfiguration().nextProtocolNegotiationStatus()) { - case QSslConfiguration::NextProtocolNegotiationNegotiated: { + case QSslConfiguration::NextProtocolNegotiationNegotiated: /* fall through */ + case QSslConfiguration::NextProtocolNegotiationUnsupported: { QByteArray nextProtocol = sslSocket->sslConfiguration().nextNegotiatedProtocol(); if (nextProtocol == QSslConfiguration::NextProtocolHttp1_1) { // fall through to create a QHttpProtocolHandler @@ -953,10 +954,6 @@ void QHttpNetworkConnectionChannel::_q_encrypted() // re-queue requests from SPDY queue to HTTP queue, if any requeueSpdyRequests(); break; - case QSslConfiguration::NextProtocolNegotiationUnsupported: - emitFinishedWithError(QNetworkReply::SslHandshakeFailedError, - "chosen Next Protocol Negotiation value unsupported"); - break; default: emitFinishedWithError(QNetworkReply::SslHandshakeFailedError, "detected unknown Next Protocol Negotiation protocol"); diff --git a/src/network/access/qnetworkreply.cpp b/src/network/access/qnetworkreply.cpp index 18ff05fcd7..fe9564a91c 100644 --- a/src/network/access/qnetworkreply.cpp +++ b/src/network/access/qnetworkreply.cpp @@ -605,7 +605,7 @@ QList<QByteArray> QNetworkReply::rawHeaderList() const /*! Returns the attribute associated with the code \a code. If the - attribute has not been set, it returns an invalid QVariant (type QMetaType::Unknown). + attribute has not been set, it returns an invalid QVariant (type QMetaType::UnknownType). You can expect the default values listed in QNetworkRequest::Attribute to be applied to the values returned by diff --git a/src/network/kernel/qnetworkinterface.cpp b/src/network/kernel/qnetworkinterface.cpp index b21bcee585..7bdfae0d0d 100644 --- a/src/network/kernel/qnetworkinterface.cpp +++ b/src/network/kernel/qnetworkinterface.cpp @@ -353,8 +353,7 @@ void QNetworkAddressEntry::setBroadcast(const QHostAddress &newBroadcast) Not all operating systems support reporting all features. Only the IPv4 addresses are guaranteed to be listed by this class in all platforms. In particular, IPv6 address listing is only supported - on Windows XP and more recent versions, Linux, MacOS X and the - BSDs. + on Windows, Linux, OS X and the BSDs. \sa QNetworkAddressEntry */ diff --git a/src/network/kernel/qnetworkproxy_win.cpp b/src/network/kernel/qnetworkproxy_win.cpp index da2c020a65..f2176d664d 100644 --- a/src/network/kernel/qnetworkproxy_win.cpp +++ b/src/network/kernel/qnetworkproxy_win.cpp @@ -130,10 +130,17 @@ static bool currentProcessIsService() DWORD size = UNLEN; if (ptrGetUserName(userName, &size)) { SID_NAME_USE type = SidTypeUser; - DWORD dummy = MAX_PATH; - wchar_t dummyStr[MAX_PATH] = L""; - PSID psid = 0; - if (ptrLookupAccountName(NULL, userName, &psid, &dummy, dummyStr, &dummy, &type)) + DWORD sidSize = 0; + DWORD domainSize = 0; + // first call is to get the correct size + bool bRet = ptrLookupAccountName(NULL, userName, NULL, &sidSize, NULL, &domainSize, &type); + if (bRet == FALSE && ERROR_INSUFFICIENT_BUFFER != GetLastError()) + return false; + QVarLengthArray<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 604214ce8e..5a1ad40b90 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -740,8 +740,15 @@ bool QAbstractSocketPrivate::canReadNotification() return true; } - if ((isBuffered || socketType != QAbstractSocket::TcpSocket) && socketEngine) - socketEngine->setReadNotificationEnabled(readBufferMaxSize == 0 || readBufferMaxSize > q->bytesAvailable()); + if (socketEngine) { + // turn the socket engine off if we've either: + // - got pending datagrams + // - reached the buffer size limit + if (isBuffered) + socketEngine->setReadNotificationEnabled(readBufferMaxSize == 0 || readBufferMaxSize > q->bytesAvailable()); + else if (socketType != QAbstractSocket::TcpSocket) + socketEngine->setReadNotificationEnabled(!socketEngine->hasPendingDatagrams()); + } // reset the read socket notifier state if we reentered inside the // readyRead() connected slot. diff --git a/src/network/socket/qlocalsocket.cpp b/src/network/socket/qlocalsocket.cpp index 164117e84f..c1beedd53e 100644 --- a/src/network/socket/qlocalsocket.cpp +++ b/src/network/socket/qlocalsocket.cpp @@ -56,9 +56,6 @@ QT_BEGIN_NAMESPACE waitForReadyRead(), waitForBytesWritten(), and waitForDisconnected() which blocks until the operation is complete or the timeout expires. - \note This feature is not supported on versions of Windows earlier than - Windows XP. - \sa QLocalServer */ diff --git a/src/network/ssl/qsslconfiguration.cpp b/src/network/ssl/qsslconfiguration.cpp index 7bb6e02b7e..55c9a281ba 100644 --- a/src/network/ssl/qsslconfiguration.cpp +++ b/src/network/ssl/qsslconfiguration.cpp @@ -512,6 +512,7 @@ QSslCipher QSslConfiguration::sessionCipher() const is set during the handshake phase. \sa protocol(), setProtocol() + \since 5.4 */ QSsl::SslProtocol QSslConfiguration::sessionProtocol() const { diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 0f7c376e04..c0c15fb5b1 100644 --- a/src/network/ssl/qsslsocket.cpp +++ b/src/network/ssl/qsslsocket.cpp @@ -1081,6 +1081,7 @@ QSslCipher QSslSocket::sessionCipher() const is set during the handshake phase. \sa protocol(), setProtocol() + \since 5.4 */ QSsl::SslProtocol QSslSocket::sessionProtocol() const { diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 8833e3fdd8..0e1a3e53c9 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -1518,14 +1518,20 @@ void QSslSocketBackendPrivate::continueHandshake() } #if OPENSSL_VERSION_NUMBER >= 0x1000100fL && !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG) - const unsigned char *proto = 0; - unsigned int proto_len = 0; - q_SSL_get0_next_proto_negotiated(ssl, &proto, &proto_len); - if (proto_len) - configuration.nextNegotiatedProtocol = QByteArray(reinterpret_cast<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/platformsupport/eglconvenience/qeglplatformcontext_p.h b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h index 7825c7b3d7..0c10710304 100644 --- a/src/platformsupport/eglconvenience/qeglplatformcontext_p.h +++ b/src/platformsupport/eglconvenience/qeglplatformcontext_p.h @@ -45,6 +45,7 @@ // We mean it. // +#include <QtCore/qtextstream.h> #include <qpa/qplatformwindow.h> #include <qpa/qplatformopenglcontext.h> #include <QtCore/QVariant> diff --git a/src/platformsupport/eglconvenience/qeglplatformintegration_p.h b/src/platformsupport/eglconvenience/qeglplatformintegration_p.h index 4d7adce309..2b5d5f50fb 100644 --- a/src/platformsupport/eglconvenience/qeglplatformintegration_p.h +++ b/src/platformsupport/eglconvenience/qeglplatformintegration_p.h @@ -45,9 +45,9 @@ // We mean it. // +#include <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 0fa23ebe02..733235ff42 100644 --- a/src/platformsupport/fbconvenience/qfbbackingstore.cpp +++ b/src/platformsupport/fbconvenience/qfbbackingstore.cpp @@ -69,5 +69,30 @@ void QFbBackingStore::resize(const QSize &size, const QRegion &staticContents) mImage = QImage(size, window()->screen()->handle()->format()); } +const QImage QFbBackingStore::image() +{ + return mImage; +} + +void QFbBackingStore::lock() +{ + mImageMutex.lock(); +} + +void QFbBackingStore::unlock() +{ + mImageMutex.unlock(); +} + +void QFbBackingStore::beginPaint(const QRegion &) +{ + lock(); +} + +void QFbBackingStore::endPaint() +{ + unlock(); +} + QT_END_NAMESPACE diff --git a/src/platformsupport/fbconvenience/qfbbackingstore_p.h b/src/platformsupport/fbconvenience/qfbbackingstore_p.h index 08a4b37eee..a9917e1450 100644 --- a/src/platformsupport/fbconvenience/qfbbackingstore_p.h +++ b/src/platformsupport/fbconvenience/qfbbackingstore_p.h @@ -46,6 +46,7 @@ // #include <qpa/qplatformbackingstore.h> +#include <QtCore/QMutex> QT_BEGIN_NAMESPACE @@ -64,12 +65,19 @@ public: virtual void resize(const QSize &size, const QRegion ®ion); - const QImage image() { return mImage; } + const QImage image(); + + void lock(); + void unlock(); + + void beginPaint(const QRegion &); + void endPaint(); protected: friend class QFbWindow; QImage mImage; + QMutex mImageMutex; }; QT_END_NAMESPACE diff --git a/src/platformsupport/fbconvenience/qfbscreen.cpp b/src/platformsupport/fbconvenience/qfbscreen.cpp index aa35825be0..13341344d8 100644 --- a/src/platformsupport/fbconvenience/qfbscreen.cpp +++ b/src/platformsupport/fbconvenience/qfbscreen.cpp @@ -37,11 +37,15 @@ #include "qfbbackingstore_p.h" #include <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 b6e50dc786..55aacab9bc 100644 --- a/src/platformsupport/fbconvenience/qfbscreen_p.h +++ b/src/platformsupport/fbconvenience/qfbscreen_p.h @@ -94,10 +94,11 @@ protected slots: protected: void initializeCompositor(); + bool event(QEvent *event); QList<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 27ff33be86..e7b03e9651 100644 --- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp +++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp @@ -526,6 +526,23 @@ QFontEngine::HintStyle defaultHintStyleFromMatch(QFont::HintingPreference hintin return QFontEngine::HintNone; } + int hint_style = 0; + if (FcPatternGetInteger (match, FC_HINT_STYLE, 0, &hint_style) == FcResultMatch) { + switch (hint_style) { + case FC_HINT_NONE: + return QFontEngine::HintNone; + case FC_HINT_SLIGHT: + return QFontEngine::HintLight; + case FC_HINT_MEDIUM: + return QFontEngine::HintMedium; + case FC_HINT_FULL: + return QFontEngine::HintFull; + default: + Q_UNREACHABLE(); + break; + } + } + if (useXftConf) { void *hintStyleResource = QGuiApplication::platformNativeInterface()->nativeResourceForScreen("hintstyle", @@ -535,27 +552,31 @@ QFontEngine::HintStyle defaultHintStyleFromMatch(QFont::HintingPreference hintin return QFontEngine::HintStyle(hintStyle - 1); } - int hint_style = 0; - if (FcPatternGetInteger (match, FC_HINT_STYLE, 0, &hint_style) == FcResultNoMatch) - hint_style = FC_HINT_FULL; - switch (hint_style) { - case FC_HINT_NONE: - return QFontEngine::HintNone; - case FC_HINT_SLIGHT: - return QFontEngine::HintLight; - case FC_HINT_MEDIUM: - return QFontEngine::HintMedium; - case FC_HINT_FULL: - return QFontEngine::HintFull; - default: - Q_UNREACHABLE(); - break; - } return QFontEngine::HintFull; } QFontEngine::SubpixelAntialiasingType subpixelTypeFromMatch(FcPattern *match, bool useXftConf) { + int subpixel = FC_RGBA_UNKNOWN; + if (FcPatternGetInteger(match, FC_RGBA, 0, &subpixel) == FcResultMatch) { + switch (subpixel) { + case FC_RGBA_UNKNOWN: + case FC_RGBA_NONE: + return QFontEngine::Subpixel_None; + case FC_RGBA_RGB: + return QFontEngine::Subpixel_RGB; + case FC_RGBA_BGR: + return QFontEngine::Subpixel_BGR; + case FC_RGBA_VRGB: + return QFontEngine::Subpixel_VRGB; + case FC_RGBA_VBGR: + return QFontEngine::Subpixel_VBGR; + default: + Q_UNREACHABLE(); + break; + } + } + if (useXftConf) { void *subpixelTypeResource = QGuiApplication::platformNativeInterface()->nativeResourceForScreen("subpixeltype", @@ -565,25 +586,6 @@ QFontEngine::SubpixelAntialiasingType subpixelTypeFromMatch(FcPattern *match, bo return QFontEngine::SubpixelAntialiasingType(subpixelType - 1); } - int subpixel = FC_RGBA_UNKNOWN; - FcPatternGetInteger(match, FC_RGBA, 0, &subpixel); - - switch (subpixel) { - case FC_RGBA_UNKNOWN: - case FC_RGBA_NONE: - return QFontEngine::Subpixel_None; - case FC_RGBA_RGB: - return QFontEngine::Subpixel_RGB; - case FC_RGBA_BGR: - return QFontEngine::Subpixel_BGR; - case FC_RGBA_VRGB: - return QFontEngine::Subpixel_VRGB; - case FC_RGBA_VBGR: - return QFontEngine::Subpixel_VBGR; - default: - Q_UNREACHABLE(); - break; - } return QFontEngine::Subpixel_None; } } // namespace @@ -823,10 +825,8 @@ void QFontconfigDatabase::setupFontEngine(QFontEngineFT *engine, const QFontDef QGuiApplication::platformNativeInterface()->nativeResourceForScreen("antialiasingEnabled", QGuiApplication::primaryScreen()); int antialiasingEnabled = int(reinterpret_cast<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 5a6c5de0b4..fe408305e0 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm @@ -370,6 +370,8 @@ void QCoreTextFontDatabase::releaseHandle(void *handle) CFRelease(CTFontDescriptorRef(handle)); } +extern CGAffineTransform qt_transform_from_fontdef(const QFontDef &fontDef); + QFontEngine *QCoreTextFontDatabase::fontEngine(const QFontDef &f, void *usrPtr) { qreal scaledPointSize = f.pixelSize; @@ -384,7 +386,8 @@ QFontEngine *QCoreTextFontDatabase::fontEngine(const QFontDef &f, void *usrPtr) scaledPointSize = f.pointSize; CTFontDescriptorRef descriptor = (CTFontDescriptorRef) usrPtr; - CTFontRef font = CTFontCreateWithFontDescriptor(descriptor, scaledPointSize, NULL); + CGAffineTransform matrix = qt_transform_from_fontdef(f); + CTFontRef font = CTFontCreateWithFontDescriptor(descriptor, scaledPointSize, &matrix); if (font) { QFontEngine *engine = new QCoreTextFontEngine(font, f); engine->fontDef = f; diff --git a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp index c3573489e9..c5de6ee533 100644 --- a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp +++ b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp @@ -1047,6 +1047,8 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event) } break; } + case QAccessible::SelectionAdd: + case QAccessible::SelectionRemove: case QAccessible::Selection: { QAccessibleInterface * iface = event->accessibleInterface(); if (!iface) { @@ -1104,7 +1106,6 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event) case QAccessible::ParentChanged: case QAccessible::DialogStart: case QAccessible::DialogEnd: - case QAccessible::SelectionRemove: case QAccessible::PopupMenuStart: case QAccessible::PopupMenuEnd: case QAccessible::SoundPlayed: @@ -1146,7 +1147,6 @@ void AtSpiAdaptor::notify(QAccessibleEvent *event) case QAccessible::TextAttributeChanged: case QAccessible::TextColumnChanged: case QAccessible::VisibleDataChanged: - case QAccessible::SelectionAdd: case QAccessible::SelectionWithin: case QAccessible::LocationChanged: case QAccessible::HelpChanged: diff --git a/src/platformsupport/linuxaccessibility/linuxaccessibility.pri b/src/platformsupport/linuxaccessibility/linuxaccessibility.pri index 1d51d2876c..1b65fb1cad 100644 --- a/src/platformsupport/linuxaccessibility/linuxaccessibility.pri +++ b/src/platformsupport/linuxaccessibility/linuxaccessibility.pri @@ -2,7 +2,6 @@ contains(QT_CONFIG, accessibility-atspi-bridge) { QT_FOR_PRIVATE += dbus include(../../3rdparty/atspi2/atspi2.pri) - include(../accessibility/accessibility.pri) INCLUDEPATH += $$PWD diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index 55847a04a4..2b38409723 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -430,7 +430,6 @@ QCoreWlanEngine::QCoreWlanEngine(QObject *parent) QCoreWlanEngine::~QCoreWlanEngine() { - scanThread->terminate(); scanThread->wait(); while (!foundConfigurations.isEmpty()) diff --git a/src/plugins/platforms/android/android.pro b/src/plugins/platforms/android/android.pro index 3c3a4b4b2e..3ba817bf5b 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 aceb9b619b..0b46508782 100644 --- a/src/plugins/platforms/cocoa/qcocoamenubar.mm +++ b/src/plugins/platforms/cocoa/qcocoamenubar.mm @@ -100,7 +100,9 @@ void QCocoaMenuBar::insertNativeMenu(QCocoaMenu *menu, QCocoaMenu *beforeMenu) menu->setMenuBar(this); syncMenu(static_cast<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 771b464805..5d3befa25b 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -1824,6 +1824,8 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin Qt::DropActions qtAllowed = qt_mac_mapNSDragOperations([sender draggingSourceOperationMask]); QWindow *target = findEventTargetWindow(m_window); + if (!target) + return NSDragOperationNone; // update these so selecting move/copy/link works QGuiApplicationPrivate::modifier_buttons = [QNSView convertKeyModifiers: [[NSApp currentEvent] modifierFlags]]; @@ -1843,6 +1845,8 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin - (void)draggingExited:(id <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); @@ -1855,6 +1859,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); @@ -1880,6 +1886,8 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin Q_UNUSED(img); Q_UNUSED(operation); QWindow *target = findEventTargetWindow(m_window); + if (!target) + return; // keep our state, and QGuiApplication state (buttons member) in-sync, // or future mouse events will be processed incorrectly diff --git a/src/plugins/platforms/eglfs/qeglfscontext.cpp b/src/plugins/platforms/eglfs/qeglfscontext.cpp index 6216fa8575..6470280e2c 100644 --- a/src/plugins/platforms/eglfs/qeglfscontext.cpp +++ b/src/plugins/platforms/eglfs/qeglfscontext.cpp @@ -31,15 +31,16 @@ ** ****************************************************************************/ -#include "qeglfscontext.h" -#include "qeglfswindow.h" -#include "qeglfshooks.h" +#include <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/qeglfshooks_stub.cpp b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp index 26d77a2abb..120c603125 100644 --- a/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp +++ b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp @@ -31,10 +31,10 @@ ** ****************************************************************************/ -#include "qeglfshooks.h" #include <QtPlatformSupport/private/qeglplatformcursor_p.h> #include <QtPlatformSupport/private/qeglconvenience_p.h> #include <QtCore/QRegularExpression> +#include "qeglfshooks.h" #if defined(Q_OS_LINUX) #include <fcntl.h> diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp index 2a4eae3fe2..fbdd1d4c4d 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp @@ -31,26 +31,26 @@ ** ****************************************************************************/ -#include "qeglfsintegration.h" +#include <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 <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 cd68540581..bc93fe28e7 100644 --- a/src/plugins/platforms/eglfs/qeglfsscreen.cpp +++ b/src/plugins/platforms/eglfs/qeglfsscreen.cpp @@ -31,10 +31,12 @@ ** ****************************************************************************/ +#include <QtCore/qtextstream.h> +#include <QtPlatformSupport/private/qeglplatformcursor_p.h> + #include "qeglfsscreen.h" #include "qeglfswindow.h" #include "qeglfshooks.h" -#include <QtPlatformSupport/private/qeglplatformcursor_p.h> QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/eglfs/qeglfswindow.cpp b/src/plugins/platforms/eglfs/qeglfswindow.cpp index f5839e086d..39a3ef94e9 100644 --- a/src/plugins/platforms/eglfs/qeglfswindow.cpp +++ b/src/plugins/platforms/eglfs/qeglfswindow.cpp @@ -31,8 +31,7 @@ ** ****************************************************************************/ -#include "qeglfswindow.h" -#include "qeglfshooks.h" +#include <QtCore/qtextstream.h> #include <qpa/qwindowsysteminterface.h> #include <qpa/qplatformintegration.h> #include <private/qguiapplication_p.h> @@ -40,6 +39,9 @@ #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 906a1308da..d4bee2c9e4 100644 --- a/src/plugins/platforms/minimalegl/qminimaleglwindow.cpp +++ b/src/plugins/platforms/minimalegl/qminimaleglwindow.cpp @@ -31,10 +31,10 @@ ** ****************************************************************************/ -#include "qminimaleglwindow.h" - #include <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 9451b9ce55..4e77350132 100644 --- a/src/plugins/platforms/windows/qtwindows_additional.h +++ b/src/plugins/platforms/windows/qtwindows_additional.h @@ -166,4 +166,8 @@ typedef TOUCHINPUT const * PCTOUCHINPUT; #endif // if defined(Q_CC_MINGW) || !defined(TOUCHEVENTF_MOVE) +#ifndef WM_GESTURE +# define WM_GESTURE 0x0119 +#endif + #endif // QTWINDOWS_ADDITIONAL_H diff --git a/src/plugins/platforms/windows/qtwindowsglobal.h b/src/plugins/platforms/windows/qtwindowsglobal.h index 90e6d6ab9d..083d82ed8c 100644 --- a/src/plugins/platforms/windows/qtwindowsglobal.h +++ b/src/plugins/platforms/windows/qtwindowsglobal.h @@ -109,6 +109,7 @@ enum WindowsEventType // Simplify event types DisplayChangedEvent = 437, SettingChangedEvent = DisplayChangedEvent + 1, ContextMenu = 123, + GestureEvent = 124, UnknownEvent = 542 }; @@ -247,6 +248,8 @@ inline QtWindows::WindowsEventType windowsEventType(UINT message, WPARAM wParamI case WM_APPCOMMAND: return QtWindows::AppCommandEvent; #endif + case WM_GESTURE: + return QtWindows::GestureEvent; default: break; } diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 99ba5463bf..72bfeec143 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) @@ -913,6 +913,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 28202219d6..5c2e21192b 100644 --- a/src/plugins/platforms/windows/qwindowscontext.h +++ b/src/plugins/platforms/windows/qwindowscontext.h @@ -161,7 +161,7 @@ public: int defaultDPI() const; - QString registerWindowClass(const QWindow *w, bool isGL); + QString registerWindowClass(const QWindow *w); QString registerWindowClass(QString cname, WNDPROC proc, unsigned style = 0, HBRUSH brush = 0, bool icon = false); diff --git a/src/plugins/platforms/windows/qwindowscursor.cpp b/src/plugins/platforms/windows/qwindowscursor.cpp index d10c7fdb20..9a42b7712d 100644 --- a/src/plugins/platforms/windows/qwindowscursor.cpp +++ b/src/plugins/platforms/windows/qwindowscursor.cpp @@ -126,13 +126,15 @@ HCURSOR QWindowsCursor::createPixmapCursor(const QPixmap &pixmap, const QPoint & // Create a cursor from image and mask of the format QImage::Format_Mono. static HCURSOR createBitmapCursor(const QImage &bbits, const QImage &mbits, - QPoint hotSpot = QPoint(), + QPoint hotSpot = QPoint(-1, -1), bool invb = false, bool invm = false) { const int width = bbits.width(); const int height = bbits.height(); - if (hotSpot.isNull()) - hotSpot = QPoint(width / 2, height / 2); + if (hotSpot.x() < 0) + hotSpot.setX(width / 2); + if (hotSpot.y() < 0) + hotSpot.setY(height / 2); const int n = qMax(1, width / 8); #if !defined(Q_OS_WINCE) QScopedArrayPointer<uchar> xBits(new uchar[height * n]); diff --git a/src/plugins/platforms/windows/qwindowseglcontext.cpp b/src/plugins/platforms/windows/qwindowseglcontext.cpp index 7f0421ad90..f52c5b733c 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); @@ -577,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 45ccbfb734..c2b153e4c1 100644 --- a/src/plugins/platforms/windows/qwindowseglcontext.h +++ b/src/plugins/platforms/windows/qwindowseglcontext.h @@ -75,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 @@ -84,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; } @@ -239,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 diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index f15783490e..9c26a227b8 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -946,9 +946,8 @@ static bool addFontToDatabase(const QString &familyName, uchar charSet, } static int QT_WIN_CALLBACK storeFont(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *textmetric, - int type, LPARAM namesSetIn) + int type, LPARAM) { - typedef QSet<QString> StringSet; const QString familyName = QString::fromWCharArray(f->elfLogFont.lfFaceName); const uchar charSet = f->elfLogFont.lfCharSet; @@ -957,83 +956,69 @@ static int QT_WIN_CALLBACK storeFont(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *textmetr // NEWTEXTMETRICEX is a NEWTEXTMETRIC, which according to the documentation is // identical to a TEXTMETRIC except for the last four members, which we don't use // anyway - if (addFontToDatabase(familyName, charSet, (TEXTMETRIC *)textmetric, &signature, type)) - reinterpret_cast<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; lf.lfCharSet = DEFAULT_CHARSET; - if (wcslen(f->elfLogFont.lfFaceName) >= LF_FACESIZE) { - qWarning("%s: Unable to enumerate family '%s'.", - __FUNCTION__, qPrintable(QString::fromWCharArray(f->elfLogFont.lfFaceName))); - return 1; - } - wmemcpy(lf.lfFaceName, f->elfLogFont.lfFaceName, - wcslen(f->elfLogFont.lfFaceName) + 1); + 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; lf.lfCharSet = DEFAULT_CHARSET; - if (family.size() >= LF_FACESIZE) { - qWarning("%s: Unable to enumerate family '%s'.", - __FUNCTION__, qPrintable(family)); - return; - } - wmemcpy(lf.lfFaceName, reinterpret_cast<const wchar_t*>(family.utf16()), - family.size() + 1); + lf.lfFaceName[0] = 0; lf.lfPitchAndFamily = 0; - - if (family.isEmpty()) { - EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFontSub, - (LPARAM)&m_families, 0); - } else { - EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFont, - (LPARAM)&m_families, 0); - } - + 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; @@ -1397,7 +1382,7 @@ QStringList QWindowsFontDatabase::addApplicationFont(const QByteArray &fontData, // Fonts based on files are added via populate, as they will show up in font enumeration. for (int j = 0; j < families.count(); ++j) - populate(families.at(j)); + populateFamily(families.at(j)); } m_applicationFonts << font; @@ -1677,7 +1662,7 @@ QStringList QWindowsFontDatabase::fallbacksForFamily(const QString &family, QFon result.append(QWindowsFontDatabase::extraTryFontsForFamily(family)); qCDebug(lcQpaFonts) << __FUNCTION__ << family << style << styleHint - << script << result << m_families.size(); + << script << result; return result; } diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.h b/src/plugins/platforms/windows/qwindowsfontdatabase.h index 4abf2d703e..8a682e6bec 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.h +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.h @@ -70,6 +70,7 @@ public: ~QWindowsFontDatabase(); void populateFontDatabase() Q_DECL_OVERRIDE; + void populateFamily(const QString &familyName) Q_DECL_OVERRIDE; QFontEngineMulti *fontEngineMulti(QFontEngine *fontEngine, QChar::Script script) Q_DECL_OVERRIDE; QFontEngine *fontEngine(const QFontDef &fontDef, void *handle) Q_DECL_OVERRIDE; QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference) Q_DECL_OVERRIDE; @@ -99,9 +100,7 @@ public: static QString familyForStyleHint(QFont::StyleHint styleHint); private: - void populate(const QString &family = QString()); void removeApplicationFonts(); - QSet<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 42e5a8c6ad..0fc5e0dc0c 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp @@ -375,31 +375,6 @@ static int QT_WIN_CALLBACK storeFont(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *textmetr return 1; } -static int QT_WIN_CALLBACK storeFontSub(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *textmetric, - int type, LPARAM namesSetIn) -{ - Q_UNUSED(textmetric) - Q_UNUSED(type) - - HDC dummy = GetDC(0); - LOGFONT lf; - lf.lfCharSet = DEFAULT_CHARSET; - if (wcslen(f->elfLogFont.lfFaceName) >= LF_FACESIZE) { - qWarning("%s: Unable to enumerate family '%s'.", - __FUNCTION__, qPrintable(QString::fromWCharArray(f->elfLogFont.lfFaceName))); - return 1; - } - wmemcpy(lf.lfFaceName, f->elfLogFont.lfFaceName, - wcslen(f->elfLogFont.lfFaceName) + 1); - lf.lfPitchAndFamily = 0; - EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFont, - (LPARAM)namesSetIn, 0); - ReleaseDC(0, dummy); - - // keep on enumerating - return 1; -} - void QWindowsFontDatabaseFT::populateFontDatabase() { m_families.clear(); @@ -434,15 +409,8 @@ void QWindowsFontDatabaseFT::populate(const QString &family) wmemcpy(lf.lfFaceName, reinterpret_cast<const wchar_t*>(family.utf16()), family.size() + 1); lf.lfPitchAndFamily = 0; - - if (family.isEmpty()) { - EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFontSub, - (LPARAM)&m_families, 0); - } else { - EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFont, - (LPARAM)&m_families, 0); - } - + EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)storeFont, + (LPARAM)&m_families, 0); ReleaseDC(0, dummy); } diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp index 0e3e6826ec..3348241d37 100644 --- a/src/plugins/platforms/windows/qwindowsglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp @@ -1267,6 +1267,7 @@ bool QWindowsGLContext::makeCurrent(QPlatformSurface *surface) // Do we already have a DC entry for that window? QWindowsWindow *window = static_cast<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/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp index acb692579b..0fa34041d6 100644 --- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp +++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp @@ -422,11 +422,12 @@ bool QWindowsMouseHandler::translateMouseWheelEvent(QWindow *window, HWND, } // from bool QApplicationPrivate::translateTouchEvent() -bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND, +bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND hwnd, QtWindows::WindowsEventType, MSG msg, LRESULT *) { #ifndef Q_OS_WINCE + Q_UNUSED(hwnd); typedef QWindowSystemInterface::TouchPoint QTouchPoint; typedef QList<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 6491de93b5..60fe26b2b9 100644 --- a/src/plugins/platforms/windows/qwindowsmousehandler.h +++ b/src/plugins/platforms/windows/qwindowsmousehandler.h @@ -79,6 +79,10 @@ private: QTouchDevice *m_touchDevice; bool m_leftButtonDown; QWindow *m_previousCaptureWindow; +#ifdef Q_OS_WINCE +//This is required to send a touch up if we don't get a second touch position any more + bool m_had2ndTouchPoint; +#endif }; Qt::MouseButtons QWindowsMouseHandler::keyStateToMouseButtons(int wParam) diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp index fd57d9ee61..ae8020a53e 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.cpp +++ b/src/plugins/platforms/windows/qwindowsscreen.cpp @@ -497,4 +497,13 @@ bool QWindowsScreenManager::handleScreenChanges() return true; } +const QWindowsScreen *QWindowsScreenManager::screenAtDp(const QPoint &p) const +{ + foreach (QWindowsScreen *scr, m_screens) { + if (scr->geometryDp().contains(p)) + return scr; + } + return Q_NULLPTR; +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsscreen.h b/src/plugins/platforms/windows/qwindowsscreen.h index aa1408358b..28256f3000 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.h +++ b/src/plugins/platforms/windows/qwindowsscreen.h @@ -137,6 +137,8 @@ public: bool handleDisplayChange(WPARAM wParam, LPARAM lParam); const WindowsScreenList &screens() const { return m_screens; } + const QWindowsScreen *screenAtDp(const QPoint &p) const; + private: void removeScreen(int index); diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 926e7da67e..0216b40e3e 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -170,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) @@ -180,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. @@ -206,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 @@ -329,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. @@ -370,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; @@ -390,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) @@ -421,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, @@ -495,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 ; @@ -574,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); @@ -603,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; @@ -617,9 +662,6 @@ QWindowsWindowData result.embedded = embedded; result.customMargins = context->customMargins; - if (isGL && hasAlpha) - applyBlurBehindWindow(result.hwnd); - return result; } @@ -642,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; @@ -667,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); } @@ -1051,7 +1092,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; } @@ -1287,8 +1328,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 @@ -1313,7 +1356,8 @@ void QWindowsWindow::setGeometryDp(const QRect &rectIn) const QMargins margins = frameMarginsDp(); rect.moveTopLeft(rect.topLeft() + QPoint(margins.left(), margins.top())); } - m_data.geometry = rect; + if (m_windowState == Qt::WindowMinimized) + m_data.geometry = rect; // Otherwise set by handleGeometryChange() triggered by event. if (m_data.hwnd) { // A ResizeEvent with resulting geometry will be sent. If we cannot // achieve that size (for example, window title minimal constraint), @@ -1384,11 +1428,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()); } @@ -1417,7 +1461,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 @@ -1538,7 +1583,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; @@ -1626,17 +1671,6 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState) setFlag(FrameDirty); - if ((oldState == Qt::WindowMaximized) != (newState == Qt::WindowMaximized)) { - if (visible && !(newState == Qt::WindowMinimized)) { - setFlag(WithinMaximize); - if (newState == Qt::WindowFullScreen) - setFlag(MaximizeToFullScreen); - ShowWindow(m_data.hwnd, (newState == Qt::WindowMaximized) ? SW_MAXIMIZE : SW_SHOWNOACTIVATE); - clearFlag(WithinMaximize); - clearFlag(MaximizeToFullScreen); - } - } - if ((oldState == Qt::WindowFullScreen) != (newState == Qt::WindowFullScreen)) { #ifdef Q_OS_WINCE HWND handle = FindWindow(L"HHTaskBar", L""); @@ -1716,6 +1750,15 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState) m_savedStyle = 0; m_savedFrameGeometry = QRect(); } + } else if ((oldState == Qt::WindowMaximized) != (newState == Qt::WindowMaximized)) { + if (visible && !(newState == Qt::WindowMinimized)) { + setFlag(WithinMaximize); + if (newState == Qt::WindowFullScreen) + setFlag(MaximizeToFullScreen); + ShowWindow(m_data.hwnd, (newState == Qt::WindowMaximized) ? SW_MAXIMIZE : SW_SHOWNOACTIVATE); + clearFlag(WithinMaximize); + clearFlag(MaximizeToFullScreen); + } } if ((oldState == Qt::WindowMinimized) != (newState == Qt::WindowMinimized)) { @@ -2313,4 +2356,22 @@ void *QWindowsWindow::surface(void *nativeConfig) #endif } +void QWindowsWindow::aboutToMakeCurrent() +{ +#ifndef QT_NO_OPENGL + // For RasterGLSurface windows, that become OpenGL windows dynamically, it might be + // time to set up some GL specifics. This is particularly important for layered + // windows (WS_EX_LAYERED due to alpha > 0). + const bool isCompositing = qt_window_private(window())->compositing; + if (isCompositing != testFlag(Compositing)) { + if (isCompositing) + setFlag(Compositing); + else + clearFlag(Compositing); + + updateGLWindowSettings(window(), m_data.hwnd, m_data.flags, m_opacity); + } +#endif +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h index 922d00f230..6d6d473ccd 100644 --- a/src/plugins/platforms/windows/qwindowswindow.h +++ b/src/plugins/platforms/windows/qwindowswindow.h @@ -137,7 +137,8 @@ public: WithinCreate = 0x20000, WithinMaximize = 0x40000, MaximizeToFullScreen = 0x80000, - InputMethodDisabled =0x100000 + InputMethodDisabled = 0x100000, + Compositing = 0x200000 }; QWindowsWindow(QWindow *window, const QWindowsWindowData &data); @@ -250,6 +251,7 @@ public: void setWindowIcon(const QIcon &icon); void *surface(void *nativeConfig); + void aboutToMakeCurrent(); #ifndef Q_OS_WINCE void setAlertState(bool enabled); diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 7286b6b89b..4d0596550c 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -506,6 +506,7 @@ private: XInput2TouchDeviceData *touchDeviceForId(int id); void xi2HandleEvent(xcb_ge_event_t *event); void xi2HandleHierachyEvent(void *event); + void xi2HandleDeviceChangedEvent(void *event); int m_xiOpCode, m_xiEventBase, m_xiErrorBase; #ifndef QT_NO_TABLETEVENT struct TabletData { @@ -539,6 +540,7 @@ private: Qt::Orientations legacyOrientations; QPointF lastScrollPosition; }; + void updateScrollingDevice(ScrollingDevice& scrollingDevice, int num_classes, void *classes); void xi2HandleScrollEvent(void *event, ScrollingDevice &scrollingDevice); QHash<int, ScrollingDevice> m_scrollingDevices; #endif // XCB_USE_XINPUT2 diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index 90d323ed34..60ae062586 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -346,6 +346,7 @@ void QXcbConnection::xi2Select(xcb_window_t window) // Listen for hotplug events XIEventMask xiEventMask; bitMask = XI_HierarchyChangedMask; + bitMask |= XI_DeviceChangedMask; xiEventMask.deviceid = XIAllDevices; xiEventMask.mask_len = sizeof(bitMask); xiEventMask.mask = xiBitMask; @@ -464,6 +465,11 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event) xi2HandleHierachyEvent(xiEvent); return; } + if (xiEvent->evtype == XI_DeviceChanged) { + xi2HandleDeviceChangedEvent(xiEvent); + return; + } + #ifndef QT_NO_TABLETEVENT for (int i = 0; i < m_tabletData.count(); ++i) { if (m_tabletData.at(i).deviceId == xiEvent->deviceid) { @@ -624,6 +630,64 @@ void QXcbConnection::xi2HandleHierachyEvent(void *event) } } +void QXcbConnection::xi2HandleDeviceChangedEvent(void *event) +{ + xXIDeviceChangedEvent *xiEvent = reinterpret_cast<xXIDeviceChangedEvent *>(event); + + // ### If a slave device changes (XIDeviceChange), we should probably run setup on it again. + if (xiEvent->reason != XISlaveSwitch) + return; + +#ifdef XCB_USE_XINPUT21 + // This code handles broken scrolling device drivers that reset absolute positions + // when they are made active. Whenever a new slave device is made active the + // primary pointer sends a DeviceChanged event with XISlaveSwitch, and the new + // active slave in sourceid. + + QHash<int, ScrollingDevice>::iterator device = m_scrollingDevices.find(xiEvent->sourceid); + if (device == m_scrollingDevices.end()) + return; + + int nrDevices = 0; + XIDeviceInfo* xiDeviceInfo = XIQueryDevice(static_cast<Display *>(m_xlib_display), xiEvent->sourceid, &nrDevices); + if (nrDevices <= 0) { + qCDebug(lcQpaXInputDevices, "scrolling device %d no longer present", xiEvent->sourceid); + return; + } + updateScrollingDevice(*device, xiDeviceInfo->num_classes, xiDeviceInfo->classes); + XIFreeDeviceInfo(xiDeviceInfo); +#endif +} + +void QXcbConnection::updateScrollingDevice(ScrollingDevice &scrollingDevice, int num_classes, void *classInfo) +{ +#ifdef XCB_USE_XINPUT21 + XIAnyClassInfo **classes = reinterpret_cast<XIAnyClassInfo**>(classInfo); + QPointF lastScrollPosition; + if (lcQpaXInput().isDebugEnabled()) + lastScrollPosition = scrollingDevice.lastScrollPosition; + for (int c = 0; c < num_classes; ++c) { + if (classes[c]->type == XIValuatorClass) { + XIValuatorClassInfo *vci = reinterpret_cast<XIValuatorClassInfo *>(classes[c]); + const int valuatorAtom = qatom(vci->label); + if (valuatorAtom == QXcbAtom::RelHorizScroll || valuatorAtom == QXcbAtom::RelHorizWheel) + scrollingDevice.lastScrollPosition.setX(vci->value); + else if (valuatorAtom == QXcbAtom::RelVertScroll || valuatorAtom == QXcbAtom::RelVertWheel) + scrollingDevice.lastScrollPosition.setY(vci->value); + } + } + if (lcQpaXInput().isDebugEnabled() && lastScrollPosition != scrollingDevice.lastScrollPosition) + qCDebug(lcQpaXInput, "scrolling device %d moved from (%f, %f) to (%f, %f)", scrollingDevice.deviceId, + lastScrollPosition.x(), lastScrollPosition.y(), + scrollingDevice.lastScrollPosition.x(), + scrollingDevice.lastScrollPosition.y()); +#else + Q_UNUSED(scrollingDevice); + Q_UNUSED(num_classes); + Q_UNUSED(classInfo); +#endif +} + void QXcbConnection::handleEnterEvent(const xcb_enter_notify_event_t *) { #ifdef XCB_USE_XINPUT21 @@ -634,19 +698,11 @@ void QXcbConnection::handleEnterEvent(const xcb_enter_notify_event_t *) int nrDevices = 0; XIDeviceInfo* xiDeviceInfo = XIQueryDevice(static_cast<Display *>(m_xlib_display), scrollingDevice.deviceId, &nrDevices); if (nrDevices <= 0) { + qCDebug(lcQpaXInputDevices, "scrolling device %d no longer present", scrollingDevice.deviceId); it = m_scrollingDevices.erase(it); continue; } - for (int c = 0; c < xiDeviceInfo->num_classes; ++c) { - if (xiDeviceInfo->classes[c]->type == XIValuatorClass) { - XIValuatorClassInfo *vci = reinterpret_cast<XIValuatorClassInfo *>(xiDeviceInfo->classes[c]); - const int valuatorAtom = qatom(vci->label); - if (valuatorAtom == QXcbAtom::RelHorizScroll || valuatorAtom == QXcbAtom::RelHorizWheel) - scrollingDevice.lastScrollPosition.setX(vci->value); - else if (valuatorAtom == QXcbAtom::RelVertScroll || valuatorAtom == QXcbAtom::RelVertWheel) - scrollingDevice.lastScrollPosition.setY(vci->value); - } - } + updateScrollingDevice(scrollingDevice, xiDeviceInfo->num_classes, xiDeviceInfo->classes); XIFreeDeviceInfo(xiDeviceInfo); ++it; } diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index 5fb745717b..85fef3912c 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -933,7 +933,7 @@ xkb_keysym_t QXcbKeyboard::lookupLatinKeysym(xkb_keycode_t keycode) const QList<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 00942787d9..233514a181 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -767,6 +767,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()) @@ -2350,7 +2353,10 @@ void QXcbWindow::handleXEmbedMessage(const xcb_client_message_event_t *event) switch (event->data.data32[1]) { case XEMBED_WINDOW_ACTIVATE: case XEMBED_WINDOW_DEACTIVATE: + break; case XEMBED_EMBEDDED_NOTIFY: + Q_XCB_CALL(xcb_map_window(xcb_connection(), m_window)); + m_screen->windowShown(this); break; case XEMBED_FOCUS_IN: Qt::FocusReason reason; diff --git a/src/printsupport/kernel/qprinter.cpp b/src/printsupport/kernel/qprinter.cpp index 437a68e609..8ed2732c1e 100644 --- a/src/printsupport/kernel/qprinter.cpp +++ b/src/printsupport/kernel/qprinter.cpp @@ -1224,7 +1224,10 @@ void QPrinter::setPageSize(PageSize newPageSize) void QPrinter::setPaperSize(const QSizeF &paperSize, QPrinter::Unit unit) { - setPageSize(QPageSize(paperSize, QPageSize::Unit(unit))); + if (unit == QPrinter::DevicePixel) + setPageSize(QPageSize(paperSize * qt_pixelMultiplier(resolution()), QPageSize::Point)); + else + setPageSize(QPageSize(paperSize, QPageSize::Unit(unit))); } /*! diff --git a/src/testlib/doc/src/qt-webpages.qdoc b/src/testlib/doc/src/qt-webpages.qdoc index e90790b7c0..03213413c3 100644 --- a/src/testlib/doc/src/qt-webpages.qdoc +++ b/src/testlib/doc/src/qt-webpages.qdoc @@ -25,10 +25,10 @@ ** ****************************************************************************/ /*! - \externalpage http://blog.qt.digia.com + \externalpage http://blog.qt.io \title Qt Labs */ /*! - \externalpage http://blog.qt.digia.com/blog/2008/12/05/qtestlib-now-with-nice-graphs-pointing-upwards/ + \externalpage http://blog.qt.io/blog/2008/12/05/qtestlib-now-with-nice-graphs-pointing-upwards/ \title qtestlib-tools Announcement */ diff --git a/src/testlib/qbenchmark_p.h b/src/testlib/qbenchmark_p.h index 889798e862..5bf3760f66 100644 --- a/src/testlib/qbenchmark_p.h +++ b/src/testlib/qbenchmark_p.h @@ -105,6 +105,7 @@ public: QBenchmarkResult() : value(-1) , iterations(-1) + , metric(QTest::FramesPerSecond) , setByMacro(true) , valid(false) { } diff --git a/src/testlib/qtest.h b/src/testlib/qtest.h index 6298262958..995d653118 100644 --- a/src/testlib/qtest.h +++ b/src/testlib/qtest.h @@ -91,8 +91,7 @@ template<> inline char *toString(const QDate &date) template<> inline char *toString(const QDateTime &dateTime) { return dateTime.isValid() - ? qstrdup(qPrintable(dateTime.toString(QLatin1String("yyyy/MM/dd hh:mm:ss.zzz")) + - (dateTime.timeSpec() == Qt::LocalTime ? QLatin1String("[local time]") : QLatin1String("[UTC]")))) + ? qstrdup(qPrintable(dateTime.toString(QLatin1String("yyyy/MM/dd hh:mm:ss.zzz[t]")))) : qstrdup("Invalid QDateTime"); } #endif // QT_NO_DATESTRING diff --git a/src/testlib/testlib.pro b/src/testlib/testlib.pro index 17a03781c2..dbcc588d10 100644 --- a/src/testlib/testlib.pro +++ b/src/testlib/testlib.pro @@ -17,6 +17,7 @@ HEADERS = qbenchmark.h \ qbenchmarkvalgrind_p.h \ qbenchmarkevent_p.h \ qbenchmarkperfevents_p.h \ + qbenchmarkmetric.h \ qbenchmarkmetric_p.h \ qsignalspy.h \ qtestaccessible.h \ diff --git a/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc b/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc index 446b441675..9f5ef59e94 100644 --- a/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc +++ b/src/tools/qdoc/doc/qdoc-manual-contextcmds.qdoc @@ -805,7 +805,7 @@ {QWidget::addAction}(). \endquotation - If you don't include the function name with the \b{\\overlaod} + If you don't include the function name with the \b{\\overload} command, then instead of the "This function overloads..." line with the link to the documentation for the primary version, you get the old standard line: diff --git a/src/tools/rcc/main.cpp b/src/tools/rcc/main.cpp index c2e9b26fb3..2cfc30ed3f 100644 --- a/src/tools/rcc/main.cpp +++ b/src/tools/rcc/main.cpp @@ -200,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 01b4437db7..7563d1d64b 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 d50a70c468..51a70749ce 100644 --- a/src/tools/uic/ui4.h +++ b/src/tools/uic/ui4.h @@ -42,7 +42,7 @@ // We mean it. // -// THIS FILE IS AUTOMATICALLY GENERATED +// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT! #ifndef UI4_H #define UI4_H diff --git a/src/widgets/doc/src/widgets-and-layouts/layout.qdoc b/src/widgets/doc/src/widgets-and-layouts/layout.qdoc index f581df4cb3..7e2e79fc5d 100644 --- a/src/widgets/doc/src/widgets-and-layouts/layout.qdoc +++ b/src/widgets/doc/src/widgets-and-layouts/layout.qdoc @@ -219,7 +219,7 @@ \section1 Custom Widgets in Layouts When you make your own widget class, you should also communicate its layout - properties. If the widget has a one of Qt's layouts, this is already taken + properties. If the widget uses one of Qt's layouts, this is already taken care of. If the widget does not have any child widgets, or uses manual layout, you can change the behavior of the widget using any or all of the following mechanisms: diff --git a/src/widgets/effects/qpixmapfilter.cpp b/src/widgets/effects/qpixmapfilter.cpp index 6f618b8914..216b19ca48 100644 --- a/src/widgets/effects/qpixmapfilter.cpp +++ b/src/widgets/effects/qpixmapfilter.cpp @@ -416,17 +416,7 @@ void QPixmapConvolutionFilter::draw(QPainter *painter, const QPointF &p, const Q if (src.isNull()) return; - QPixmapFilter *filter = painter->paintEngine() && painter->paintEngine()->isExtended() ? - static_cast<QPaintEngineEx *>(painter->paintEngine())->pixmapFilter(type(), this) : 0; - QPixmapConvolutionFilter *convolutionFilter = static_cast<QPixmapConvolutionFilter*>(filter); - if (convolutionFilter) { - convolutionFilter->setConvolutionKernel(d->convolutionKernel, d->kernelWidth, d->kernelHeight); - convolutionFilter->d_func()->convoluteAlpha = d->convoluteAlpha; - convolutionFilter->draw(painter, p, src, srcRect); - return; - } - - // falling back to raster implementation + // raster implementation QImage *target = 0; if (painter->paintEngine()->paintDevice()->devType() == QInternal::Image) { @@ -924,16 +914,6 @@ void QPixmapBlurFilter::draw(QPainter *painter, const QPointF &p, const QPixmap if (qt_scaleForTransform(painter->transform(), &scale)) scaledRadius /= scale; - QPixmapFilter *filter = painter->paintEngine() && painter->paintEngine()->isExtended() ? - static_cast<QPaintEngineEx *>(painter->paintEngine())->pixmapFilter(type(), this) : 0; - QPixmapBlurFilter *blurFilter = static_cast<QPixmapBlurFilter*>(filter); - if (blurFilter) { - blurFilter->setRadius(scaledRadius); - blurFilter->setBlurHints(d->hints); - blurFilter->draw(painter, p, src, srcRect); - return; - } - QImage srcImage; QImage destImage; @@ -1094,17 +1074,7 @@ void QPixmapColorizeFilter::draw(QPainter *painter, const QPointF &dest, const Q if (src.isNull()) return; - QPixmapFilter *filter = painter->paintEngine() && painter->paintEngine()->isExtended() ? - static_cast<QPaintEngineEx *>(painter->paintEngine())->pixmapFilter(type(), this) : 0; - QPixmapColorizeFilter *colorizeFilter = static_cast<QPixmapColorizeFilter*>(filter); - if (colorizeFilter) { - colorizeFilter->setColor(d->color); - colorizeFilter->setStrength(d->strength); - colorizeFilter->draw(painter, dest, src, srcRect); - return; - } - - // falling back to raster implementation + // raster implementation if (!d->opaque) { painter->drawPixmap(dest, src, srcRect); @@ -1328,17 +1298,6 @@ void QPixmapDropShadowFilter::draw(QPainter *p, if (px.isNull()) return; - QPixmapFilter *filter = p->paintEngine() && p->paintEngine()->isExtended() ? - static_cast<QPaintEngineEx *>(p->paintEngine())->pixmapFilter(type(), this) : 0; - QPixmapDropShadowFilter *dropShadowFilter = static_cast<QPixmapDropShadowFilter*>(filter); - if (dropShadowFilter) { - dropShadowFilter->setColor(d->color); - dropShadowFilter->setBlurRadius(d->radius); - dropShadowFilter->setOffset(d->offset); - dropShadowFilter->draw(p, pos, px, src); - return; - } - QImage tmp(px.size(), QImage::Format_ARGB32_Premultiplied); tmp.fill(0); QPainter tmpPainter(&tmp); diff --git a/src/widgets/graphicsview/qgraphicswidget.cpp b/src/widgets/graphicsview/qgraphicswidget.cpp index 5bd563e535..98e011ff05 100644 --- a/src/widgets/graphicsview/qgraphicswidget.cpp +++ b/src/widgets/graphicsview/qgraphicswidget.cpp @@ -1311,7 +1311,7 @@ Qt::WindowFrameSection QGraphicsWidget::windowFrameSectionAt(const QPointF &pos) if (x <= left + cornerMargin) { if (y <= top + windowFrameWidth || (x <= left + windowFrameWidth && y <= top + cornerMargin)) { s = Qt::TopLeftSection; - } else if (y >= bottom - windowFrameWidth || (x <= left + windowFrameWidth && y >= bottom - windowFrameWidth)) { + } else if (y >= bottom - windowFrameWidth || (x <= left + windowFrameWidth && y >= bottom - cornerMargin)) { s = Qt::BottomLeftSection; } else if (x <= left + windowFrameWidth) { s = Qt::LeftSection; @@ -1319,7 +1319,7 @@ Qt::WindowFrameSection QGraphicsWidget::windowFrameSectionAt(const QPointF &pos) } else if (x >= right - cornerMargin) { if (y <= top + windowFrameWidth || (x >= right - windowFrameWidth && y <= top + cornerMargin)) { s = Qt::TopRightSection; - } else if (y >= bottom - windowFrameWidth || (x >= right - windowFrameWidth && y >= bottom - windowFrameWidth)) { + } else if (y >= bottom - windowFrameWidth || (x >= right - windowFrameWidth && y >= bottom - cornerMargin)) { s = Qt::BottomRightSection; } else if (x >= right - windowFrameWidth) { s = Qt::RightSection; diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index 0f346a9682..9b8c19df6d 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -2388,7 +2388,7 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) } #endif break; -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC case Qt::Key_Enter: case Qt::Key_Return: // Propagate the enter if you couldn't edit the item and there are no @@ -2418,7 +2418,7 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) selectAll(); break; } -#ifdef Q_WS_MAC +#ifdef Q_OS_MAC if (event->key() == Qt::Key_O && event->modifiers() & Qt::ControlModifier && currentIndex().isValid()) { emit activated(currentIndex()); break; diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index beade16339..fe99f7a5e0 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -3641,6 +3641,17 @@ bool QHeaderViewPrivate::read(QDataStream &in) QVector<int> visualIndicesIn; QVector<int> logicalIndicesIn; QHash<int, int> hiddenSectionSizeIn; + bool movableSectionsIn; + bool clickableSectionsIn; + bool highlightSelectedIn; + bool stretchLastSectionIn; + bool cascadingResizingIn; + int stretchSectionsIn; + int contentsSectionsIn; + int defaultSectionSizeIn; + int minimumSectionSizeIn; + QVector<SectionItem> sectionItemsIn; + in >> orient; in >> order; @@ -3662,6 +3673,39 @@ bool QHeaderViewPrivate::read(QDataStream &in) if (in.status() != QDataStream::Ok || lengthIn < 0) return false; + in >> movableSectionsIn; + in >> clickableSectionsIn; + in >> highlightSelectedIn; + in >> stretchLastSectionIn; + in >> cascadingResizingIn; + in >> stretchSectionsIn; + in >> contentsSectionsIn; + in >> defaultSectionSizeIn; + in >> minimumSectionSizeIn; + + in >> align; + + in >> global; + + in >> sectionItemsIn; + // In Qt4 we had a vector of spans where one span could hold information on more sections. + // Now we have an itemvector where one items contains information about one section + // For backward compatibility with Qt4 we do the following + QVector<SectionItem> newSectionItems; + for (int u = 0; u < sectionItemsIn.count(); ++u) { + int count = sectionItemsIn.at(u).tmpDataStreamSectionCount; + if (count > 0) + sectionItemsIn[u].size /= count; + for (int n = 0; n < count; ++n) + newSectionItems.append(sectionItemsIn[u]); + } + + int sectionItemsLengthTotal = 0; + foreach (const SectionItem §ion, newSectionItems) + sectionItemsLengthTotal += section.size; + if (sectionItemsLengthTotal != lengthIn) + return false; + orientation = static_cast<Qt::Orientation>(orient); sortIndicatorOrder = static_cast<Qt::SortOrder>(order); sortIndicatorSection = sortIndicatorSectionIn; @@ -3671,32 +3715,19 @@ bool QHeaderViewPrivate::read(QDataStream &in) hiddenSectionSize = hiddenSectionSizeIn; length = lengthIn; - in >> movableSections; - in >> clickableSections; - in >> highlightSelected; - in >> stretchLastSection; - in >> cascadingResizing; - in >> stretchSections; - in >> contentsSections; - in >> defaultSectionSize; - in >> minimumSectionSize; + movableSections = movableSectionsIn; + clickableSections = clickableSectionsIn; + highlightSelected = highlightSelectedIn; + stretchLastSection = stretchLastSectionIn; + cascadingResizing = cascadingResizingIn; + stretchSections = stretchSectionsIn; + contentsSections = contentsSectionsIn; + defaultSectionSize = defaultSectionSizeIn; + minimumSectionSize = minimumSectionSizeIn; - in >> align; defaultAlignment = Qt::Alignment(align); + globalResizeMode = static_cast<QHeaderView::ResizeMode>(global); - in >> global; - globalResizeMode = (QHeaderView::ResizeMode)global; - - in >> sectionItems; - // In Qt4 we had a vector of spans where one span could hold information on more sections. - // Now we have an itemvector where one items contains information about one section - // For backward compatibility with Qt4 we do the following - QVector<SectionItem> newSectionItems; - for (int u = 0; u < sectionItems.count(); ++u) { - int count = sectionItems.at(u).tmpDataStreamSectionCount; - for (int n = 0; n < count; ++n) - newSectionItems.append(sectionItems[u]); - } sectionItems = newSectionItems; setHiddenSectionsFromBitVector(sectionHidden); recalcSectionStartPos(); diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp index e7d18092f1..add60d4d88 100644 --- a/src/widgets/itemviews/qlistview.cpp +++ b/src/widgets/itemviews/qlistview.cpp @@ -3198,7 +3198,7 @@ void QListView::selectionChanged(const QItemSelection &selected, QModelIndex sel = selected.indexes().value(0); if (sel.isValid()) { int entry = visualIndex(sel); - QAccessibleEvent event(this, QAccessible::Selection); + QAccessibleEvent event(this, QAccessible::SelectionAdd); event.setChild(entry); QAccessible::updateAccessibility(&event); } diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp index b5eb509766..be1bfce9ff 100644 --- a/src/widgets/itemviews/qtableview.cpp +++ b/src/widgets/itemviews/qtableview.cpp @@ -3337,7 +3337,7 @@ void QTableView::selectionChanged(const QItemSelection &selected, QModelIndex sel = selected.indexes().value(0); if (sel.isValid()) { int entry = d->accessibleTable2Index(sel); - QAccessibleEvent event(this, QAccessible::Selection); + QAccessibleEvent event(this, QAccessible::SelectionAdd); event.setChild(entry); QAccessible::updateAccessibility(&event); } diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp index 2c5f4b7c72..531ef8b8aa 100644 --- a/src/widgets/itemviews/qtreeview.cpp +++ b/src/widgets/itemviews/qtreeview.cpp @@ -3981,7 +3981,7 @@ void QTreeView::selectionChanged(const QItemSelection &selected, if (sel.isValid()) { int entry = d->accessibleTree2Index(sel); Q_ASSERT(entry >= 0); - QAccessibleEvent event(this, QAccessible::Selection); + QAccessibleEvent event(this, QAccessible::SelectionAdd); event.setChild(entry); QAccessible::updateAccessibility(&event); } diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp index 0a4e57812a..769a5b97b9 100644 --- a/src/widgets/itemviews/qtreewidget.cpp +++ b/src/widgets/itemviews/qtreewidget.cpp @@ -2934,8 +2934,6 @@ void QTreeWidget::closePersistentEditor(QTreeWidgetItem *item, int column) Returns the widget displayed in the cell specified by \a item and the given \a column. - \note The tree takes ownership of the widget. - */ QWidget *QTreeWidget::itemWidget(QTreeWidgetItem *item, int column) const { @@ -3275,8 +3273,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/qdesktopwidget.cpp b/src/widgets/kernel/qdesktopwidget.cpp index 67264133ef..563707b021 100644 --- a/src/widgets/kernel/qdesktopwidget.cpp +++ b/src/widgets/kernel/qdesktopwidget.cpp @@ -39,6 +39,13 @@ QT_BEGIN_NAMESPACE +int QDesktopScreenWidget::screenNumber() const +{ + const QDesktopWidgetPrivate *desktopWidgetP + = static_cast<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 62f4d8ed6f..29daaa4f97 100644 --- a/src/widgets/kernel/qdesktopwidget_p.h +++ b/src/widgets/kernel/qdesktopwidget_p.h @@ -53,19 +53,19 @@ 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 { Q_DECLARE_PUBLIC(QDesktopWidget) public: - ~QDesktopWidgetPrivate() {foreach(QDesktopScreenWidget *s, screens) delete s; } + ~QDesktopWidgetPrivate() { qDeleteAll(screens); } void _q_updateScreens(); void _q_availableGeometryChanged(); diff --git a/src/widgets/kernel/qgridlayout.cpp b/src/widgets/kernel/qgridlayout.cpp index 10d338c40c..3de0eb7960 100644 --- a/src/widgets/kernel/qgridlayout.cpp +++ b/src/widgets/kernel/qgridlayout.cpp @@ -565,7 +565,7 @@ void QGridLayoutPrivate::add(QGridBox *box, int row1, int row2, int col1, int co add(box, row1, col1); return; } - expand(row2 + 1, col2 + 1); + expand(qMax(row1, row2) + 1, qMax(col1, col2) + 1); box->row = row1; box->col = col1; diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp index db116b070c..12e054626c 100644 --- a/src/widgets/kernel/qopenglwidget.cpp +++ b/src/widgets/kernel/qopenglwidget.cpp @@ -758,6 +758,7 @@ QImage QOpenGLWidgetPrivate::grabFramebuffer() resolveSamples(); q->makeCurrent(); QImage res = qt_gl_read_framebuffer(q->size() * q->devicePixelRatio(), false, false); + res.setDevicePixelRatio(q->devicePixelRatio()); return res; } diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index c99e15b9b8..68715413d1 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; @@ -1414,8 +1415,15 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO win->setGeometry(q->geometry()); else win->resize(q->size()); - if (win->isTopLevel()) - win->setScreen(QGuiApplication::screens().value(topData()->screenIndex, 0)); + if (win->isTopLevel()) { + int screenNumber = topData()->initialScreenIndex; + topData()->initialScreenIndex = -1; + if (screenNumber < 0) { + screenNumber = q->windowType() != Qt::Desktop + ? QApplication::desktop()->screenNumber(q) : 0; + } + win->setScreen(QGuiApplication::screens().value(screenNumber, Q_NULLPTR)); + } QSurfaceFormat format = win->requestedFormat(); if ((flags & Qt::Window) && win->surfaceType() != QSurface::OpenGLSurface @@ -1715,7 +1723,7 @@ void QWidgetPrivate::createTLExtra() x->embedded = 0; x->window = 0; x->shareContext = 0; - x->screenIndex = 0; + x->initialScreenIndex = -1; #ifdef Q_WS_MAC x->wasMaximized = false; #endif // Q_WS_MAC @@ -5219,6 +5227,9 @@ QGraphicsEffect *QWidget::graphicsEffect() const \note This function will apply the effect on itself and all its children. + \note Graphics effects are not supported for OpenGL-based widgets, such as QGLWidget, + QOpenGLWidget and QQuickWidget. + \since 4.6 \sa graphicsEffect() @@ -7235,7 +7246,7 @@ QByteArray QWidget::saveGeometry() const /*! \since 4.2 - Restores the geometry and state top-level widgets stored in the + Restores the geometry and state of top-level widgets stored in the byte array \a geometry. Returns \c true on success; otherwise returns \c false. @@ -7738,10 +7749,17 @@ void QWidgetPrivate::show_helper() + const bool isWindow = q->isWindow(); +#ifndef QT_NO_GRAPHICSVIEW + bool isEmbedded = isWindow && q->graphicsProxyWidget() != Q_NULLPTR; +#else + bool isEmbedded = false; +#endif + // popup handling: new popups and tools need to be raised, and // existing popups must be closed. Also propagate the current // windows's KeyboardFocusChange status. - if (q->isWindow()) { + if (isWindow && !isEmbedded) { if ((q->windowType() == Qt::Tool) || (q->windowType() == Qt::Popup) || q->windowType() == Qt::ToolTip) { q->raise(); if (q->parentWidget() && q->parentWidget()->window()->testAttribute(Qt::WA_KeyboardFocusChange)) @@ -7756,10 +7774,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) { @@ -10498,9 +10514,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; } @@ -10532,7 +10547,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()); } } @@ -10576,12 +10591,11 @@ void QWidgetPrivate::setParent_sys(QWidget *newparent, Qt::WindowFlags f) // move the window to the selected screen if (!newparent && targetScreen != -1) { - if (maybeTopData()) - maybeTopData()->screenIndex = targetScreen; // only if it is already created - if (q->testAttribute(Qt::WA_WState_Created)) { + if (q->testAttribute(Qt::WA_WState_Created)) q->windowHandle()->setScreen(QGuiApplication::screens().value(targetScreen, 0)); - } + else + topData()->initialScreenIndex = targetScreen; } } diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h index b3552cba68..85e1cf93d6 100644 --- a/src/widgets/kernel/qwidget_p.h +++ b/src/widgets/kernel/qwidget_p.h @@ -212,7 +212,7 @@ struct QTLWExtra { #endif QWidgetWindow *window; QOpenGLContext *shareContext; - quint32 screenIndex; // index in qplatformscreenlist + int initialScreenIndex; // Screen number when passing a QDesktop[Screen]Widget as parent. }; struct QWExtra { diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp index 34cfb2d99f..5460a43ef4 100644 --- a/src/widgets/kernel/qwindowcontainer.cpp +++ b/src/widgets/kernel/qwindowcontainer.cpp @@ -64,7 +64,7 @@ public: void updateGeometry() { Q_Q(QWindowContainer); - if (q->geometry().bottom() <= 0 || q->geometry().right() <= 0) + if (!q->isWindow() && (q->geometry().bottom() <= 0 || q->geometry().right() <= 0)) /* Qt (e.g. QSplitter) sometimes prefer to hide a widget by *not* calling setVisible(false). This is often done by setting its coordinates to a sufficiently negative value so that its clipped outside the parent. Since a QWindow is not clipped diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp index ed7b4ab3b6..cf2f3ea26b 100644 --- a/src/widgets/styles/qfusionstyle.cpp +++ b/src/widgets/styles/qfusionstyle.cpp @@ -514,6 +514,9 @@ void QFusionStyle::drawPrimitive(PrimitiveElement elem, break; } arrow = colorizedImage(QLatin1String(":/qt-project.org/styles/commonstyle/images/fusion_arrow.png"), arrowColor, rotation); + if (arrow.isNull()) + break; + QRect rect = option->rect; QRect arrowRect; int imageMax = qMin(arrow.height(), arrow.width()); diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 38c082baf5..0a9fb19fa4 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -1970,6 +1970,7 @@ void QMacStylePrivate::drawColorlessButton(const HIRect &macRect, HIThemeButtonD || bdi->kind == kThemeComboBoxSmall || bdi->kind == kThemeComboBoxMini; const bool button = opt->type == QStyleOption::SO_Button; + const bool viewItem = opt->type == QStyleOption::SO_ViewItem; const bool pressed = bdi->state == kThemeStatePressed; const bool usingYosemiteOrLater = QSysInfo::MacintoshVersion > QSysInfo::MV_10_9; @@ -2010,6 +2011,8 @@ void QMacStylePrivate::drawColorlessButton(const HIRect &macRect, HIThemeButtonD HIRect newRect = CGRectMake(xoff, yoff, macRect.size.width, macRect.size.height); if (button && pressed) bdi->state = kThemeStateActive; + else if (usingYosemiteOrLater && viewItem) + bdi->state = kThemeStateInactive; HIThemeDrawButton(&newRect, bdi, cg, kHIThemeOrientationNormal, 0); } } @@ -2057,7 +2060,7 @@ void QMacStylePrivate::drawColorlessButton(const HIRect &macRect, HIThemeButtonD rect.adjust(0, 0, -5, 0); drawNSViewInRect(cw, bc, rect, p); return; - } else if (usingYosemiteOrLater && editableCombo) { + } else if (usingYosemiteOrLater && (editableCombo || viewItem)) { QImage image = activePixmap.toImage(); for (int y = 0; y < height; ++y) { diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index e9f20de842..3d9ba6b490 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -3397,8 +3397,10 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q state = QIcon::On; QPixmap pixmap = button->icon.pixmap(button->iconSize, mode, state); - int labelWidth = pixmap.width(); - int labelHeight = pixmap.height(); + int pixmapWidth = pixmap.width() / pixmap.devicePixelRatio(); + int pixmapHeight = pixmap.height() / pixmap.devicePixelRatio(); + int labelWidth = pixmapWidth; + int labelHeight = pixmapHeight; int iconSpacing = 4;//### 4 is currently hardcoded in QPushButton::sizeHint() int textWidth = button->fontMetrics.boundingRect(opt->rect, tf, button->text).width(); if (!button->text.isEmpty()) @@ -3407,15 +3409,15 @@ void QStyleSheetStyle::drawControl(ControlElement ce, const QStyleOption *opt, Q //Determine label alignment: if (textAlignment & Qt::AlignLeft) { /*left*/ iconRect = QRect(textRect.x(), textRect.y() + (textRect.height() - labelHeight) / 2, - pixmap.width(), pixmap.height()); + pixmapWidth, pixmapHeight); } else if (textAlignment & Qt::AlignHCenter) { /* center */ iconRect = QRect(textRect.x() + (textRect.width() - labelWidth) / 2, textRect.y() + (textRect.height() - labelHeight) / 2, - pixmap.width(), pixmap.height()); + pixmapWidth, pixmapHeight); } else { /*right*/ iconRect = QRect(textRect.x() + textRect.width() - labelWidth, textRect.y() + (textRect.height() - labelHeight) / 2, - pixmap.width(), pixmap.height()); + pixmapWidth, pixmapHeight); } iconRect = visualRect(button->direction, textRect, iconRect); diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp index c1f7b599b3..78f8071461 100644 --- a/src/widgets/styles/qwindowsxpstyle.cpp +++ b/src/widgets/styles/qwindowsxpstyle.cpp @@ -505,13 +505,13 @@ HBITMAP QWindowsXPStylePrivate::buffer(int w, int h) nullBitmap = (HBITMAP)SelectObject(bufferDC, bufferBitmap); if (!bufferBitmap) { - qErrnoWarning("QWindowsXPStylePrivate::buffer(w,h), failed to create dibsection"); + qErrnoWarning("QWindowsXPStylePrivate::buffer(%dx%d), CreateDIBSection() failed.", w, h); bufferW = 0; bufferH = 0; return 0; } if (!bufferPixels) { - qErrnoWarning("QWindowsXPStylePrivate::buffer(w,h), did not allocate pixel data"); + qErrnoWarning("QWindowsXPStylePrivate::buffer(%dx%d), CreateDIBSection() did not allocate pixel data.", w, h); bufferW = 0; bufferH = 0; return 0; @@ -696,16 +696,18 @@ bool QWindowsXPStylePrivate::swapAlphaChannel(const QRect &rect, bool allPixels) - Painter does not have an HDC - Theme part is flipped (mirrored horizontally) else use drawBackgroundDirectly(). + \note drawBackgroundThruNativeBuffer() can return false for large + sizes due to buffer()/CreateDIBSection() failing. */ -void QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData) +bool QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData) { if (themeData.rect.isEmpty()) - return; + return true; QPainter *painter = themeData.painter; Q_ASSERT_X(painter != 0, "QWindowsXPStylePrivate::drawBackground()", "Trying to draw a theme part without a painter"); if (!painter || !painter->isActive()) - return; + return false; painter->save(); @@ -741,13 +743,9 @@ void QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData) } const HDC dc = canDrawDirectly ? hdcForWidgetBackingStore(themeData.widget) : HDC(0); - if (dc) { - drawBackgroundDirectly(themeData); - } else { - drawBackgroundThruNativeBuffer(themeData); - } - + const bool result = dc ? drawBackgroundDirectly(themeData) : drawBackgroundThruNativeBuffer(themeData); painter->restore(); + return result; } /*! \internal @@ -755,7 +753,7 @@ void QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData) Do not use this if you need to perform other transformations on the resulting data. */ -void QWindowsXPStylePrivate::drawBackgroundDirectly(XPThemeData &themeData) +bool QWindowsXPStylePrivate::drawBackgroundDirectly(XPThemeData &themeData) { QPainter *painter = themeData.painter; HDC dc = 0; @@ -830,6 +828,7 @@ void QWindowsXPStylePrivate::drawBackgroundDirectly(XPThemeData &themeData) } SelectClipRgn(dc, 0); DeleteObject(hrgn); + return true; } /*! \internal @@ -840,7 +839,7 @@ void QWindowsXPStylePrivate::drawBackgroundDirectly(XPThemeData &themeData) flips (horizonal mirroring only, vertical are handled by the theme engine). */ -void QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeData) +bool QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeData) { QPainter *painter = themeData.painter; QRect rect = themeData.rect; @@ -964,7 +963,7 @@ void QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa QImage img; if (!haveCachedPixmap) { // If the pixmap is not cached, generate it! ------------------------- if (!buffer(w, h)) // Ensure a buffer of at least (w, h) in size - return; + return false; HDC dc = bufferHDC(); // Clear the buffer @@ -1017,7 +1016,7 @@ void QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa memset(&data, 0, sizeof(data)); data.dataValid = true; alphaCache.insert(key, data); - return; + return true; } hasAlpha = hasAlphaChannel(rect); if (!hasAlpha && partIsTransparent) @@ -1132,6 +1131,7 @@ void QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa data.hadInvalidAlpha = wasAlphaFixed; alphaCache.insert(key, data); } + return true; } @@ -1860,18 +1860,29 @@ case PE_Frame: if (!theme.isValid()) break; + // May fail due to too-large buffers for large widgets, fall back to Windows style. theme.rect = QRect(option->rect.x(), option->rect.y()+fwidth, option->rect.x()+fwidth, option->rect.height()-fwidth); theme.partId = WP_FRAMELEFT; - d->drawBackground(theme); + if (!d->drawBackground(theme)) { + QWindowsStyle::drawPrimitive(pe, option, p, widget); + return; + } theme.rect = QRect(option->rect.width()-fwidth, option->rect.y()+fwidth, fwidth, option->rect.height()-fwidth); theme.partId = WP_FRAMERIGHT; - d->drawBackground(theme); + if (!d->drawBackground(theme)) { + QWindowsStyle::drawPrimitive(pe, option, p, widget); + return; + } theme.rect = QRect(option->rect.x(), option->rect.height()-fwidth, option->rect.width(), fwidth); theme.partId = WP_FRAMEBOTTOM; - d->drawBackground(theme); + if (!d->drawBackground(theme)) { + QWindowsStyle::drawPrimitive(pe, option, p, widget); + return; + } theme.rect = QRect(option->rect.x(), option->rect.y(), option->rect.width(), option->rect.y()+fwidth); theme.partId = WP_CAPTION; - d->drawBackground(theme); + if (!d->drawBackground(theme)) + QWindowsStyle::drawPrimitive(pe, option, p, widget); return; } break; diff --git a/src/widgets/styles/qwindowsxpstyle_p_p.h b/src/widgets/styles/qwindowsxpstyle_p_p.h index 5027588c93..3bc4a7cd66 100644 --- a/src/widgets/styles/qwindowsxpstyle_p_p.h +++ b/src/widgets/styles/qwindowsxpstyle_p_p.h @@ -398,9 +398,9 @@ public: QRegion region(XPThemeData &themeData); void setTransparency(QWidget *widget, XPThemeData &themeData); - void drawBackground(XPThemeData &themeData); - void drawBackgroundThruNativeBuffer(XPThemeData &themeData); - void drawBackgroundDirectly(XPThemeData &themeData); + bool drawBackground(XPThemeData &themeData); + bool drawBackgroundThruNativeBuffer(XPThemeData &themeData); + bool drawBackgroundDirectly(XPThemeData &themeData); bool hasAlphaChannel(const QRect &rect); bool fixAlphaChannel(const QRect &rect); diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp index 7d04cab05e..d151e57d04 100644 --- a/src/widgets/util/qsystemtrayicon.cpp +++ b/src/widgets/util/qsystemtrayicon.cpp @@ -37,6 +37,7 @@ #ifndef QT_NO_SYSTEMTRAYICON #include "qmenu.h" +#include "qlist.h" #include "qevent.h" #include "qpoint.h" #include "qlabel.h" @@ -704,11 +705,7 @@ void QSystemTrayIconPrivate::updateIcon_sys_qpa() void QSystemTrayIconPrivate::updateMenu_sys_qpa() { if (menu) { - if (!menu->platformMenu()) { - QPlatformMenu *platformMenu = qpa_sys->createMenu(); - if (platformMenu) - menu->setPlatformMenu(platformMenu); - } + addPlatformMenu(menu); qpa_sys->updateMenu(menu->platformMenu()); } } @@ -741,6 +738,27 @@ void QSystemTrayIconPrivate::showMessage_sys_qpa(const QString &message, static_cast<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 0dda689c51..f05bf9e3f9 100644 --- a/src/widgets/util/qsystemtrayicon_p.h +++ b/src/widgets/util/qsystemtrayicon_p.h @@ -99,6 +99,7 @@ private: void updateMenu_sys_qpa(); QRect geometry_sys_qpa() const; void showMessage_sys_qpa(const QString &msg, const QString &title, QSystemTrayIcon::MessageIcon icon, int secs); + void addPlatformMenu(QMenu *menu) const; }; class QBalloonTip : public QWidget diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp index 72a556db7c..e56fd111e5 100644 --- a/src/widgets/widgets/qplaintextedit.cpp +++ b/src/widgets/widgets/qplaintextedit.cpp @@ -288,8 +288,7 @@ void QPlainTextDocumentLayout::documentChanged(int from, int charsRemoved, int c if (changeStartBlock == changeEndBlock && newBlockCount == d->blockCount) { QTextBlock block = changeStartBlock; - int blockLineCount = block.layout()->lineCount(); - if (block.isValid() && blockLineCount) { + if (block.isValid() && block.length()) { QRectF oldBr = blockBoundingRect(block); layoutBlock(block); QRectF newBr = blockBoundingRect(block); diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp index 7033eeea22..86a830a9f9 100644 --- a/src/widgets/widgets/qwidgetlinecontrol.cpp +++ b/src/widgets/widgets/qwidgetlinecontrol.cpp @@ -1879,7 +1879,10 @@ void QWidgetLineControl::processKeyEvent(QKeyEvent* event) unknown = false; } - if (unknown && !isReadOnly()) { + // QTBUG-35734: ignore Ctrl/Ctrl+Shift; accept only AltGr (Alt+Ctrl) on German keyboards + if (unknown && !isReadOnly() + && event->modifiers() != Qt::ControlModifier + && event->modifiers() != (Qt::ControlModifier | Qt::ShiftModifier)) { QString t = event->text(); if (!t.isEmpty() && t.at(0).isPrint()) { insert(t); diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp index 8c48533a03..2e1e87be72 100644 --- a/src/widgets/widgets/qwidgettextcontrol.cpp +++ b/src/widgets/widgets/qwidgettextcontrol.cpp @@ -1339,6 +1339,12 @@ void QWidgetTextControlPrivate::keyPressEvent(QKeyEvent *e) process: { + // QTBUG-35734: ignore Ctrl/Ctrl+Shift; accept only AltGr (Alt+Ctrl) on German keyboards + if (e->modifiers() == Qt::ControlModifier + || e->modifiers() == (Qt::ShiftModifier | Qt::ControlModifier)) { + e->ignore(); + return; + } QString text = e->text(); if (!text.isEmpty() && (text.at(0).isPrint() || text.at(0) == QLatin1Char('\t'))) { if (overwriteMode diff --git a/src/winmain/qtmain_win.cpp b/src/winmain/qtmain_win.cpp index 778ddee64b..25b79543ba 100644 --- a/src/winmain/qtmain_win.cpp +++ b/src/winmain/qtmain_win.cpp @@ -105,9 +105,10 @@ extern "C" int APIENTRY WinMain(HINSTANCE, HINSTANCE, LPSTR /*cmdParamarg*/, int wchar_t **argvW = CommandLineToArgvW(GetCommandLineW(), &argc); if (!argvW) return -1; - char **argv = new char *[argc]; + char **argv = new char *[argc + 1]; for (int i = 0; i < argc; ++i) argv[i] = wideToMulti(CP_ACP, argvW[i]); + argv[argc] = Q_NULLPTR; LocalFree(argvW); const int exitCode = main(argc, argv); for (int i = 0; i < argc; ++i) |