diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-12-16 16:59:33 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-12-16 16:59:33 +0100 |
commit | 3f3be55835427ea9f1bbcc046e05ee538ca214d7 (patch) | |
tree | 09d1f54d114855c2b06cc505dfbf74c5890c8419 /src | |
parent | ae293c1cb220847194fba6dcebdbb9194837bb56 (diff) | |
parent | 9764f8602719676d1fa15e6fd1e7980af16bfc63 (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
src/gui/kernel/qplatformtheme.h
tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp
tests/auto/widgets/widgets/qspinbox/tst_qspinbox.cpp
Change-Id: Iecd3343d6a050b8764f78d809c4a1532aeba69e5
Diffstat (limited to 'src')
68 files changed, 471 insertions, 246 deletions
diff --git a/src/android/java/res/values/libs.xml b/src/android/java/res/values/libs.xml index 231406d224..797e6bb8c4 100644 --- a/src/android/java/res/values/libs.xml +++ b/src/android/java/res/values/libs.xml @@ -1,7 +1,7 @@ <?xml version='1.0' encoding='utf-8'?> <resources> <array name="qt_sources"> - <item>https://download.qt-project.org/ministro/android/qt5/latest</item> + <item>https://download.qt-project.org/ministro/android/qt5/qt-5.2</item> </array> <!-- The following is handled automatically by the deployment tool. It should diff --git a/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java b/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java index 7c741edfda..a10e58bb87 100644 --- a/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java +++ b/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java @@ -150,7 +150,7 @@ public class QtActivity extends Activity private ActivityInfo m_activityInfo = null; // activity info object, used to access the libs and the strings private DexClassLoader m_classLoader = null; // loader object - private String[] m_sources = {"https://download.qt-project.org/ministro/android/qt5/latest"}; // Make sure you are using ONLY secure locations + private String[] m_sources = {"https://download.qt-project.org/ministro/android/qt5/qt-5.2"}; // Make sure you are using ONLY secure locations private String m_repository = "default"; // Overwrites the default Ministro repository // Possible values: // * default - Ministro default repository set with "Ministro configuration tool". diff --git a/src/angle/src/.gitignore b/src/angle/src/.gitignore new file mode 100644 index 0000000000..9cbadb59ef --- /dev/null +++ b/src/angle/src/.gitignore @@ -0,0 +1,6 @@ +/libGLESv2/renderer/ +/compiler/glslang_lex.cpp +/compiler/glslang_tab.cpp +/compiler/glslang_tab.h +/compiler/preprocessor/ExpressionParser.cpp +/compiler/preprocessor/Tokenizer.cpp diff --git a/src/concurrent/qtconcurrentmedian.h b/src/concurrent/qtconcurrentmedian.h index b39b3ed32b..ce2afb9c28 100644 --- a/src/concurrent/qtconcurrentmedian.h +++ b/src/concurrent/qtconcurrentmedian.h @@ -102,10 +102,19 @@ public: { if (dirty) { dirty = false; + +// This is a workaround for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58800 +// Avoid using std::nth_element for stdlibc++ <= 4.7.3 || (>= 4.8.0 && <= 4.8.2) +#if defined(__GLIBCXX__) && (__GLIBCXX__ <= 20130411 || (__GLIBCXX__ >= 20130322 && __GLIBCXX__ <= 20131016)) + QVector<T> sorted = values; + std::sort(sorted.begin(), sorted.end()); + currentMedian = sorted.at(bufferSize / 2); +#else QVector<T> copy = values; typename QVector<T>::iterator begin = copy.begin(), mid = copy.begin() + bufferSize/2, end = copy.end(); std::nth_element(begin, mid, end); currentMedian = *mid; +#endif } return currentMedian; } diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 041b522023..e0a78d8533 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -556,10 +556,8 @@ Q_STATIC_ASSERT_X(UCHAR_MAX == 255, "Qt assumes that char is 8 bits"); \typedef qreal \relates <QtGlobal> - Typedef for \c double on all platforms except for those using CPUs with - ARM architectures. - On ARM-based platforms, \c qreal is a typedef for \c float for performance - reasons. + Typedef for \c double unless Qt is configured with the + \c{-qreal float} option. */ /*! \typedef uchar diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp index dba9f62b98..fc2adb783e 100644 --- a/src/corelib/io/qprocess_win.cpp +++ b/src/corelib/io/qprocess_win.cpp @@ -73,10 +73,11 @@ static void qt_create_pipe(Q_PIPE *pipe, bool isInputPipe) // Anomymous pipes do not support asynchronous I/O. Thus we // create named pipes for redirecting stdout, stderr and stdin. + // The write handle must be non-inheritable for input pipes. + // The read handle must be non-inheritable for output pipes. SECURITY_ATTRIBUTES secAtt = { sizeof(SECURITY_ATTRIBUTES), 0, false }; - secAtt.bInheritHandle = isInputPipe; // The read handle must be non-inheritable for output pipes. - HANDLE hRead; + HANDLE hServer; wchar_t pipeName[256]; unsigned int attempts = 1000; forever { @@ -85,19 +86,29 @@ static void qt_create_pipe(Q_PIPE *pipe, bool isInputPipe) _snwprintf(pipeName, sizeof(pipeName) / sizeof(pipeName[0]), L"\\\\.\\pipe\\qt-%X", qrand()); + DWORD dwOpenMode = FILE_FLAG_OVERLAPPED; + DWORD dwOutputBufferSize = 0; + DWORD dwInputBufferSize = 0; + const DWORD dwPipeBufferSize = 1024 * 1024; + if (isInputPipe) { + dwOpenMode |= PIPE_ACCESS_OUTBOUND; + dwOutputBufferSize = dwPipeBufferSize; + } else { + dwOpenMode |= PIPE_ACCESS_INBOUND; + dwInputBufferSize = dwPipeBufferSize; + } DWORD dwPipeFlags = PIPE_TYPE_BYTE | PIPE_WAIT; if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA) dwPipeFlags |= PIPE_REJECT_REMOTE_CLIENTS; - const DWORD dwPipeBufferSize = 1024 * 1024; - hRead = CreateNamedPipe(pipeName, - PIPE_ACCESS_INBOUND | FILE_FLAG_OVERLAPPED, - dwPipeFlags, - 1, // only one pipe instance - 0, // output buffer size - dwPipeBufferSize, // input buffer size - 0, - &secAtt); - if (hRead != INVALID_HANDLE_VALUE) + hServer = CreateNamedPipe(pipeName, + dwOpenMode, + dwPipeFlags, + 1, // only one pipe instance + dwOutputBufferSize, + dwInputBufferSize, + 0, + &secAtt); + if (hServer != INVALID_HANDLE_VALUE) break; DWORD dwError = GetLastError(); if (dwError != ERROR_PIPE_BUSY || !--attempts) { @@ -106,28 +117,31 @@ static void qt_create_pipe(Q_PIPE *pipe, bool isInputPipe) } } - // The write handle must be non-inheritable for input pipes. - secAtt.bInheritHandle = !isInputPipe; - - HANDLE hWrite = INVALID_HANDLE_VALUE; - hWrite = CreateFile(pipeName, - GENERIC_WRITE, - 0, - &secAtt, - OPEN_EXISTING, - FILE_FLAG_OVERLAPPED, - NULL); - if (hWrite == INVALID_HANDLE_VALUE) { + secAtt.bInheritHandle = TRUE; + const HANDLE hClient = CreateFile(pipeName, + (isInputPipe ? (GENERIC_READ | FILE_WRITE_ATTRIBUTES) + : GENERIC_WRITE), + 0, + &secAtt, + OPEN_EXISTING, + FILE_FLAG_OVERLAPPED, + NULL); + if (hClient == INVALID_HANDLE_VALUE) { qErrnoWarning("QProcess: CreateFile failed."); - CloseHandle(hRead); + CloseHandle(hServer); return; } // Wait until connection is in place. - ConnectNamedPipe(hRead, NULL); + ConnectNamedPipe(hServer, NULL); - pipe[0] = hRead; - pipe[1] = hWrite; + if (isInputPipe) { + pipe[0] = hClient; + pipe[1] = hServer; + } else { + pipe[0] = hServer; + pipe[1] = hClient; + } } static void duplicateStdWriteChannel(Q_PIPE *pipe, DWORD nStdHandle) diff --git a/src/corelib/io/qtemporarydir.cpp b/src/corelib/io/qtemporarydir.cpp index 483a76fa82..2c526847b4 100644 --- a/src/corelib/io/qtemporarydir.cpp +++ b/src/corelib/io/qtemporarydir.cpp @@ -94,9 +94,19 @@ static QString defaultTemplateName() return QDir::tempPath() + QLatin1Char('/') + baseName + QLatin1String("-XXXXXX"); } +#if defined(Q_OS_QNX ) || defined(Q_OS_WIN) || defined(Q_OS_ANDROID) + +static int nextRand(int &v) +{ + int r = v % 62; + v /= 62; + if (v < 62) + v = qrand(); + return r; +} + static char *q_mkdtemp(char *templateName) { -#if defined(Q_OS_QNX ) || defined(Q_OS_WIN) || defined(Q_OS_ANDROID) static const char letters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; const size_t length = strlen(templateName); @@ -110,16 +120,11 @@ static char *q_mkdtemp(char *templateName) int v = qrand(); /* Fill in the random bits. */ - XXXXXX[0] = letters[v % 62]; - v /= 62; - XXXXXX[1] = letters[v % 62]; - v /= 62; - XXXXXX[2] = letters[v % 62]; - v /= 62; - XXXXXX[3] = letters[v % 62]; - v /= 62; - XXXXXX[4] = letters[v % 62]; - v /= 62; + XXXXXX[0] = letters[nextRand(v)]; + XXXXXX[1] = letters[nextRand(v)]; + XXXXXX[2] = letters[nextRand(v)]; + XXXXXX[3] = letters[nextRand(v)]; + XXXXXX[4] = letters[nextRand(v)]; XXXXXX[5] = letters[v % 62]; QString templateNameStr = QFile::decodeName(templateName); @@ -137,11 +142,17 @@ static char *q_mkdtemp(char *templateName) } } return 0; -#else - return mkdtemp(templateName); -#endif } +#else // defined(Q_OS_QNX ) || defined(Q_OS_WIN) || defined(Q_OS_ANDROID) + +static char *q_mkdtemp(char *templateName) +{ + return mkdtemp(templateName); +} + +#endif + void QTemporaryDirPrivate::create(const QString &templateName) { QByteArray buffer = QFile::encodeName(templateName); diff --git a/src/corelib/kernel/qjni.cpp b/src/corelib/kernel/qjni.cpp index 4e06d12aee..aaa75c0fb8 100644 --- a/src/corelib/kernel/qjni.cpp +++ b/src/corelib/kernel/qjni.cpp @@ -74,7 +74,8 @@ static jclass getCachedClass(JNIEnv *env, const char *className) if (!classLoader.isValid()) return 0; - QJNIObjectPrivate stringName = QJNIObjectPrivate::fromString(QLatin1String(className)); + QJNIObjectPrivate stringName = QJNIObjectPrivate::fromString(QString::fromLatin1(className).replace(QLatin1Char('/'), + QLatin1Char('.'))); QJNIObjectPrivate classObject = classLoader.callObjectMethod("loadClass", "(Ljava/lang/String;)Ljava/lang/Class;", stringName.object()); diff --git a/src/corelib/kernel/qmetaobjectbuilder.cpp b/src/corelib/kernel/qmetaobjectbuilder.cpp index 2a02df1186..09d8271413 100644 --- a/src/corelib/kernel/qmetaobjectbuilder.cpp +++ b/src/corelib/kernel/qmetaobjectbuilder.cpp @@ -1075,8 +1075,14 @@ int QMetaObjectBuilder::indexOfClassInfo(const QByteArray& name) \brief The QMetaStringTable class can generate a meta-object string table at runtime. */ -QMetaStringTable::QMetaStringTable() - : m_index(0) {} +QMetaStringTable::QMetaStringTable(const QByteArray &className) + : m_index(0) + , m_className(className) +{ + const int index = enter(m_className); + Q_ASSERT(index == 0); + Q_UNUSED(index); +} // Enters the given value into the string table (if it hasn't already been // entered). Returns the index of the string. @@ -1106,30 +1112,45 @@ int QMetaStringTable::blobSize() const return size; } +static void writeString(char *out, int i, const QByteArray &str, + const int offsetOfStringdataMember, int &stringdataOffset) +{ + int size = str.size(); + qptrdiff offset = offsetOfStringdataMember + stringdataOffset + - i * sizeof(QByteArrayData); + const QByteArrayData data = + Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(size, offset); + + memcpy(out + i * sizeof(QByteArrayData), &data, sizeof(QByteArrayData)); + + memcpy(out + offsetOfStringdataMember + stringdataOffset, str.constData(), size); + out[offsetOfStringdataMember + stringdataOffset + size] = '\0'; + + stringdataOffset += size + 1; +} + // Writes strings to string data struct. // The struct consists of an array of QByteArrayData, followed by a char array // containing the actual strings. This format must match the one produced by // moc (see generator.cpp). -void QMetaStringTable::writeBlob(char *out) +void QMetaStringTable::writeBlob(char *out) const { Q_ASSERT(!(reinterpret_cast<quintptr>(out) & (preferredAlignment()-1))); int offsetOfStringdataMember = m_entries.size() * sizeof(QByteArrayData); int stringdataOffset = 0; - for (int i = 0; i < m_entries.size(); ++i) { - const QByteArray &str = m_entries.key(i); - int size = str.size(); - qptrdiff offset = offsetOfStringdataMember + stringdataOffset - - i * sizeof(QByteArrayData); - const QByteArrayData data = - Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(size, offset); - memcpy(out + i * sizeof(QByteArrayData), &data, sizeof(QByteArrayData)); + // qt_metacast expects the first string in the string table to be the class name. + writeString(out, /*index*/0, m_className, offsetOfStringdataMember, stringdataOffset); - memcpy(out + offsetOfStringdataMember + stringdataOffset, str.constData(), size); - out[offsetOfStringdataMember + stringdataOffset + size] = '\0'; + for (Entries::ConstIterator it = m_entries.constBegin(), end = m_entries.constEnd(); + it != end; ++it) { + const int i = it.value(); + if (i == 0) + continue; + const QByteArray &str = it.key(); - stringdataOffset += size + 1; + writeString(out, i, str, offsetOfStringdataMember, stringdataOffset); } } @@ -1270,8 +1291,7 @@ static int buildMetaObject(QMetaObjectBuilderPrivate *d, char *buf, // Reset the current data position to just past the QMetaObjectPrivate. dataIndex = MetaObjectPrivateFieldCount; - QMetaStringTable strings; - strings.enter(d->className); + QMetaStringTable strings(d->className); // Output the class infos, Q_ASSERT(!buf || dataIndex == pmeta->classInfoData); diff --git a/src/corelib/kernel/qmetaobjectbuilder_p.h b/src/corelib/kernel/qmetaobjectbuilder_p.h index f79ce2f2f1..3a1b43c3ed 100644 --- a/src/corelib/kernel/qmetaobjectbuilder_p.h +++ b/src/corelib/kernel/qmetaobjectbuilder_p.h @@ -323,18 +323,19 @@ private: class Q_CORE_EXPORT QMetaStringTable { public: - QMetaStringTable(); + explicit QMetaStringTable(const QByteArray &className); int enter(const QByteArray &value); static int preferredAlignment(); int blobSize() const; - void writeBlob(char *out); + void writeBlob(char *out) const; private: typedef QHash<QByteArray, int> Entries; // string --> index mapping Entries m_entries; int m_index; + QByteArray m_className; }; Q_DECLARE_OPERATORS_FOR_FLAGS(QMetaObjectBuilder::AddMembers) diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index 4ccfc7b7f0..745487627e 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -783,6 +783,10 @@ struct IteratorOwner { *ptr = new const_iterator(iterator); } + static void assign(void **ptr, void * const * src) + { + *ptr = new const_iterator(*static_cast<const_iterator*>(*src)); + } static void advance(void **iterator, int step) { @@ -804,18 +808,27 @@ struct IteratorOwner { return &*it; } + + static bool equal(void * const *it, void * const *other) + { + return *static_cast<const_iterator*>(*it) == *static_cast<const_iterator*>(*other); + } }; -template<typename const_iterator> -struct IteratorOwner<const const_iterator*> +template<typename value_type> +struct IteratorOwner<const value_type*> { - static void assign(void **ptr, const const_iterator *iterator ) + static void assign(void **ptr, const value_type *iterator ) { - *ptr = const_cast<const_iterator*>(iterator); + *ptr = const_cast<value_type*>(iterator); + } + static void assign(void **ptr, void * const * src) + { + *ptr = static_cast<value_type*>(*src); } static void advance(void **iterator, int step) { - const_iterator *it = static_cast<const_iterator*>(*iterator); + value_type *it = static_cast<value_type*>(*iterator); std::advance(it, step); *iterator = it; } @@ -829,10 +842,15 @@ struct IteratorOwner<const const_iterator*> return *iterator; } - static const void *getData(const const_iterator *it) + static const void *getData(const value_type *it) { return it; } + + static bool equal(void * const *it, void * const *other) + { + return static_cast<value_type*>(*it) == static_cast<value_type*>(*other); + } }; enum IteratorCapability @@ -934,7 +952,7 @@ public: template<class T> static bool equalIterImpl(void * const *iterator, void * const *other) - { return *static_cast<typename T::const_iterator*>(*iterator) == *static_cast<typename T::const_iterator*>(*other); } + { return IteratorOwner<typename T::const_iterator>::equal(iterator, other); } template<class T> static VariantData getImpl(void * const *iterator, int metaTypeId, uint flags) @@ -942,7 +960,7 @@ public: template<class T> static void copyIterImpl(void **dest, void * const * src) - { IteratorOwner<typename T::const_iterator>::assign(dest, *static_cast<typename T::const_iterator*>(*src)); } + { IteratorOwner<typename T::const_iterator>::assign(dest, src); } public: template<class T> QSequentialIterableImpl(const T*p) @@ -1118,11 +1136,11 @@ public: template<class T> static bool equalIterImpl(void * const *iterator, void * const *other) - { return *static_cast<typename T::const_iterator*>(*iterator) == *static_cast<typename T::const_iterator*>(*other); } + { return IteratorOwner<typename T::const_iterator>::equal(iterator, other); } template<class T> static void copyIterImpl(void **dest, void * const * src) - { IteratorOwner<typename T::const_iterator>::assign(dest, *static_cast<typename T::const_iterator*>(*src)); } + { IteratorOwner<typename T::const_iterator>::assign(dest, src); } public: template<class T> QAssociativeIterableImpl(const T*p) @@ -1741,7 +1759,7 @@ struct QMetaTypeId< SINGLE_ARG_TEMPLATE<T> > \ return id; \ const char *tName = QMetaType::typeName(qMetaTypeId<T>()); \ Q_ASSERT(tName); \ - const int tNameLen = qstrlen(tName); \ + const int tNameLen = int(qstrlen(tName)); \ QByteArray typeName; \ typeName.reserve(int(sizeof(#SINGLE_ARG_TEMPLATE)) + 1 + tNameLen + 1 + 1); \ typeName.append(#SINGLE_ARG_TEMPLATE, int(sizeof(#SINGLE_ARG_TEMPLATE)) - 1) \ @@ -1782,8 +1800,8 @@ struct QMetaTypeId< DOUBLE_ARG_TEMPLATE<T, U> > \ const char *uName = QMetaType::typeName(qMetaTypeId<U>()); \ Q_ASSERT(tName); \ Q_ASSERT(uName); \ - const int tNameLen = qstrlen(tName); \ - const int uNameLen = qstrlen(uName); \ + const int tNameLen = int(qstrlen(tName)); \ + const int uNameLen = int(qstrlen(uName)); \ QByteArray typeName; \ typeName.reserve(int(sizeof(#DOUBLE_ARG_TEMPLATE)) + 1 + tNameLen + 1 + uNameLen + 1 + 1); \ typeName.append(#DOUBLE_ARG_TEMPLATE, int(sizeof(#DOUBLE_ARG_TEMPLATE)) - 1) \ diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 5880b96f32..8e0dc4dede 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -194,9 +194,15 @@ QMetaObject *QObjectData::dynamicMetaObject() const QObjectPrivate::QObjectPrivate(int version) : threadData(0), connectionLists(0), senders(0), currentSender(0), currentChildBeingDeleted(0) { +#ifdef QT_BUILD_INTERNAL + // Don't check the version parameter in internal builds. + // This allows incompatible versions to be loaded, possibly for testing. + Q_UNUSED(version); +#else if (version != QObjectPrivateVersion) qFatal("Cannot mix incompatible Qt library (version 0x%x) with this library (version 0x%x)", version, QObjectPrivateVersion); +#endif // QObjectData initialization q_ptr = 0; @@ -3090,6 +3096,10 @@ bool QObject::disconnect(const QObject *sender, const QMetaMethod &signal, expensive initialization only if something is connected to a signal. + \warning This function is called from the thread which performs the + connection, which may be a different thread from the thread in + which this object lives. + \sa connect(), disconnectNotify() */ @@ -3116,6 +3126,15 @@ void QObject::connectNotify(const QMetaMethod &signal) modularity. However, it might be useful for optimizing access to expensive resources. + \warning This function is called from the thread which performs the + disconnection, which may be a different thread from the thread in + which this object lives. This function may also be called with a QObject + internal mutex locked. It is therefore not allowed to re-enter any + of any QObject functions from your reimplementation and if you lock + a mutex in your reimplementation, make sure that you don't call QObject + functions with that mutex held in other places or it will result in + a deadlock. + \sa disconnect(), connectNotify() */ diff --git a/src/corelib/tools/qcommandlineoption.cpp b/src/corelib/tools/qcommandlineoption.cpp index 9827547c56..86f087674b 100644 --- a/src/corelib/tools/qcommandlineoption.cpp +++ b/src/corelib/tools/qcommandlineoption.cpp @@ -199,7 +199,8 @@ QStringList QCommandLineOption::names() const void QCommandLineOptionPrivate::setNames(const QStringList &nameList) { - names.clear(); + QStringList newNames; + newNames.reserve(nameList.size()); if (nameList.isEmpty()) qWarning("QCommandLineOption: Options must have at least one name"); foreach (const QString &name, nameList) { @@ -214,9 +215,11 @@ void QCommandLineOptionPrivate::setNames(const QStringList &nameList) else if (name.contains(QLatin1Char('='))) qWarning("QCommandLineOption: Option names cannot contain a '='"); else - names.append(name); + newNames.append(name); } } + // commit + names.swap(newNames); } /*! @@ -288,9 +291,13 @@ QString QCommandLineOption::description() const */ void QCommandLineOption::setDefaultValue(const QString &defaultValue) { - d->defaultValues.clear(); - if (!defaultValue.isEmpty()) - d->defaultValues << defaultValue; + QStringList newDefaultValues; + if (!defaultValue.isEmpty()) { + newDefaultValues.reserve(1); + newDefaultValues << defaultValue; + } + // commit: + d->defaultValues.swap(newDefaultValues); } /*! diff --git a/src/corelib/tools/qcommandlineparser.cpp b/src/corelib/tools/qcommandlineparser.cpp index 5463e4f0c1..db4c2961f0 100644 --- a/src/corelib/tools/qcommandlineparser.cpp +++ b/src/corelib/tools/qcommandlineparser.cpp @@ -280,9 +280,9 @@ bool QCommandLineParser::addOption(const QCommandLineOption &option) */ QCommandLineOption QCommandLineParser::addVersionOption() { - d->builtinVersionOption = true; QCommandLineOption opt(QStringList() << QStringLiteral("v") << QStringLiteral("version"), tr("Displays version information.")); addOption(opt); + d->builtinVersionOption = true; return opt; } @@ -300,7 +300,6 @@ QCommandLineOption QCommandLineParser::addVersionOption() */ QCommandLineOption QCommandLineParser::addHelpOption() { - d->builtinHelpOption = true; QCommandLineOption opt(QStringList() #ifdef Q_OS_WIN << QStringLiteral("?") @@ -308,6 +307,7 @@ QCommandLineOption QCommandLineParser::addHelpOption() << QStringLiteral("h") << QStringLiteral("help"), tr("Displays this help.")); addOption(opt); + d->builtinHelpOption = true; return opt; } diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index 98eb473da0..b01c47d4ce 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -239,11 +239,7 @@ static inline uint qCpuFeatures() return uint(features); } -static inline uint qCpuHasFeature(CPUFeatures feature) -{ - return qCompilerCpuFeatures & feature || qCpuFeatures() & feature; -} - +#define qCpuHasFeature(feature) ((qCompilerCpuFeatures & (feature)) || (qCpuFeatures() & (feature))) #define ALIGNMENT_PROLOGUE_16BYTES(ptr, i, length) \ for (; i < static_cast<int>(qMin(static_cast<quintptr>(length), ((4 - ((reinterpret_cast<quintptr>(ptr) >> 2) & 0x3)) & 0x3))); ++i) diff --git a/src/corelib/tools/qtimezoneprivate.cpp b/src/corelib/tools/qtimezoneprivate.cpp index ee34469c03..dffb20b7cf 100644 --- a/src/corelib/tools/qtimezoneprivate.cpp +++ b/src/corelib/tools/qtimezoneprivate.cpp @@ -453,9 +453,9 @@ bool QTimeZonePrivate::isValidId(const QByteArray &olsenId) // Aliases such as "Etc/GMT+7" and "SystemV/EST5EDT" are valid so we need to accept digits if (olsenId.contains(' ')) return false; - QList<QByteArray> parts = olsenId.split('\\'); + QList<QByteArray> parts = olsenId.split('/'); foreach (const QByteArray &part, parts) { - if (part.size() > 14) + if (part.size() > 14 || part.size() < 1) return false; if (part.at(0) == '-') return false; @@ -466,6 +466,8 @@ bool QTimeZonePrivate::isValidId(const QByteArray &olsenId) && !(ch == '_') && !(ch >= '0' && ch <= '9') && !(ch == '-') + && !(ch == '+') + && !(ch == ':') && !(ch == '.')) return false; } diff --git a/src/dbus/qdbusmetaobject.cpp b/src/dbus/qdbusmetaobject.cpp index 51c0b27668..13c538bb59 100644 --- a/src/dbus/qdbusmetaobject.cpp +++ b/src/dbus/qdbusmetaobject.cpp @@ -445,8 +445,7 @@ void QDBusMetaObjectGenerator::write(QDBusMetaObject *obj) data_size += 2 + mm.inputTypes.count() + mm.outputTypes.count(); idata.resize(data_size + 1); - QMetaStringTable strings; - strings.enter(className.toLatin1()); + QMetaStringTable strings(className.toLatin1()); int offset = header->methodData; int parametersOffset = offset + header->methodCount * 5; diff --git a/src/gui/image/qimagewriter.cpp b/src/gui/image/qimagewriter.cpp index 900093b51b..8dd5fdd111 100644 --- a/src/gui/image/qimagewriter.cpp +++ b/src/gui/image/qimagewriter.cpp @@ -245,6 +245,8 @@ class QImageWriterPrivate public: QImageWriterPrivate(QImageWriter *qq); + bool canWriteHelper(); + // device QByteArray format; QIODevice *device; @@ -282,6 +284,31 @@ QImageWriterPrivate::QImageWriterPrivate(QImageWriter *qq) q = qq; } +bool QImageWriterPrivate::canWriteHelper() +{ + if (!device) { + imageWriterError = QImageWriter::DeviceError; + errorString = QT_TRANSLATE_NOOP(QImageWriter, + QLatin1String("Device is not set")); + return false; + } + if (!device->isOpen()) + device->open(QIODevice::WriteOnly); + if (!device->isWritable()) { + imageWriterError = QImageWriter::DeviceError; + errorString = QT_TRANSLATE_NOOP(QImageWriter, + QLatin1String("Device not writable")); + return false; + } + if (!handler && (handler = createWriteHandlerHelper(device, format)) == 0) { + imageWriterError = QImageWriter::UnsupportedFormatError; + errorString = QT_TRANSLATE_NOOP(QImageWriter, + QLatin1String("Unsupported image format")); + return false; + } + return true; +} + /*! Constructs an empty QImageWriter object. Before writing, you must call setFormat() to set an image format, then setDevice() or @@ -561,21 +588,15 @@ void QImageWriter::setText(const QString &key, const QString &text) */ bool QImageWriter::canWrite() const { - if (d->device && !d->handler && (d->handler = createWriteHandlerHelper(d->device, d->format)) == 0) { - d->imageWriterError = QImageWriter::UnsupportedFormatError; - d->errorString = QT_TRANSLATE_NOOP(QImageWriter, - QLatin1String("Unsupported image format")); - return false; + if (QFile *file = qobject_cast<QFile *>(d->device)) { + const bool remove = !file->isOpen() && !file->exists(); + const bool result = d->canWriteHelper(); + if (!result && remove) + file->remove(); + return result; } - if (d->device && !d->device->isOpen()) - d->device->open(QIODevice::WriteOnly); - if (!d->device || !d->device->isWritable()) { - d->imageWriterError = QImageWriter::DeviceError; - d->errorString = QT_TRANSLATE_NOOP(QImageWriter, - QLatin1String("Device not writable")); - return false; - } - return true; + + return d->canWriteHelper(); } /*! diff --git a/src/gui/image/qjpeghandler.pri b/src/gui/image/qjpeghandler.pri index 3cb35c95ed..c8de33d8b4 100644 --- a/src/gui/image/qjpeghandler.pri +++ b/src/gui/image/qjpeghandler.pri @@ -3,8 +3,10 @@ INCLUDEPATH *= $$PWD HEADERS += $$PWD/qjpeghandler_p.h SOURCES += $$PWD/qjpeghandler.cpp contains(QT_CONFIG, system-jpeg) { - if(unix|win32-g++*): LIBS += -ljpeg - else:win32: LIBS += libjpeg.lib + msvc: \ + LIBS += libjpeg.lib + else: \ + LIBS += -ljpeg } else { include($$PWD/../../3rdparty/libjpeg.pri) } diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 9f95f2c234..ae956aaa19 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -2555,6 +2555,11 @@ void QGuiApplication::setFont(const QFont &font) void QGuiApplicationPrivate::notifyLayoutDirectionChange() { + const QWindowList list = QGuiApplication::topLevelWindows(); + for (int i = 0; i < list.size(); ++i) { + QEvent ev(QEvent::ApplicationLayoutDirectionChange); + QCoreApplication::sendEvent(list.at(i), &ev); + } } void QGuiApplicationPrivate::notifyActiveWindowChange(QWindow *) diff --git a/src/gui/kernel/qplatformtheme.cpp b/src/gui/kernel/qplatformtheme.cpp index 8b4b5c1812..628b2c9d12 100644 --- a/src/gui/kernel/qplatformtheme.cpp +++ b/src/gui/kernel/qplatformtheme.cpp @@ -145,6 +145,8 @@ QT_BEGIN_NAMESPACE \value DialogSnapToDefaultButton (bool) Whether the mouse should snap to the default button when a dialog becomes visible. + \value ContextMenuOnMouseRelease (bool) Whether the context menu should be shown on mouse release. + \sa themeHint(), QStyle::pixelMetric() */ @@ -492,6 +494,7 @@ QVariant QPlatformTheme::defaultThemeHint(ThemeHint hint) case IconPixmapSizes: return QVariant::fromValue(QList<int>()); case DialogSnapToDefaultButton: + case ContextMenuOnMouseRelease: return QVariant(false); case MousePressAndHoldInterval: return QVariant(800); diff --git a/src/gui/kernel/qplatformtheme.h b/src/gui/kernel/qplatformtheme.h index 6e27261922..2ab8cef760 100644 --- a/src/gui/kernel/qplatformtheme.h +++ b/src/gui/kernel/qplatformtheme.h @@ -107,6 +107,7 @@ public: IconPixmapSizes, PasswordMaskCharacter, DialogSnapToDefaultButton, + ContextMenuOnMouseRelease, MousePressAndHoldInterval }; diff --git a/src/gui/painting/qbezier.cpp b/src/gui/painting/qbezier.cpp index 2762560da7..33075b640d 100644 --- a/src/gui/painting/qbezier.cpp +++ b/src/gui/painting/qbezier.cpp @@ -119,37 +119,6 @@ QBezier QBezier::getSubRange(qreal t0, qreal t1) const return result; } -static inline int quadraticRoots(qreal a, qreal b, qreal c, - qreal *x1, qreal *x2) -{ - if (qFuzzyIsNull(a)) { - if (qFuzzyIsNull(b)) - return 0; - *x1 = *x2 = (-c / b); - return 1; - } else { - const qreal det = b * b - 4 * a * c; - if (qFuzzyIsNull(det)) { - *x1 = *x2 = -b / (2 * a); - return 1; - } - if (det > 0) { - if (qFuzzyIsNull(b)) { - *x2 = qSqrt(-c / a); - *x1 = -(*x2); - return 2; - } - const qreal stableA = b / (2 * a); - const qreal stableB = c / (a * stableA * stableA); - const qreal stableC = -1 - qSqrt(1 - stableB); - *x2 = stableA * stableC; - *x1 = (stableA * stableB) / stableC; - return 2; - } else - return 0; - } -} - void QBezier::addToPolygon(QPolygonF *polygon, qreal bezier_flattening_threshold) const { QBezier beziers[10]; diff --git a/src/gui/text/qtextdocument.h b/src/gui/text/qtextdocument.h index 24e93b7e63..854cb29ed9 100644 --- a/src/gui/text/qtextdocument.h +++ b/src/gui/text/qtextdocument.h @@ -71,6 +71,7 @@ class QTextCursor; template<typename T> class QVector; +#ifndef Q_QDOC // Workaround for QTBUG-35230 namespace Qt { Q_GUI_EXPORT bool mightBeRichText(const QString&); @@ -80,6 +81,7 @@ namespace Qt Q_GUI_EXPORT QTextCodec *codecForHtml(const QByteArray &ba); #endif } +#endif // Q_QDOC class Q_GUI_EXPORT QAbstractUndoItem { diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index 286a6fd668..b4c593fa73 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -1214,6 +1214,8 @@ static const char *certificate_blacklist[] = { "08:27", "*.EGO.GOV.TR", // Turktrust mis-issued intermediate certificate "08:64", "e-islem.kktcmerkezbankasi.org", // Turktrust mis-issued intermediate certificate + + "03:1d:a7", "AC DG Tr\xC3\xA9sor SSL", // intermediate certificate linking back to ANSSI French National Security Agency 0 }; diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm index 8af90b13bf..4b637a707d 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm @@ -192,8 +192,6 @@ bool QCocoaGLContext::makeCurrent(QPlatformSurface *surface) QWindow *window = static_cast<QCocoaWindow *>(surface)->window(); setActiveWindow(window); - if (![m_context view]) - return false; [m_context makeCurrentContext]; update(); return true; diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h index 4f5a208f43..c7ec315f04 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.h +++ b/src/plugins/platforms/cocoa/qcocoawindow.h @@ -159,8 +159,10 @@ public: void registerTouch(bool enable); qreal devicePixelRatio() const; + bool isWindowExposable(); void exposeWindow(); void obscureWindow(); + void updateExposedGeometry(); QWindow *childWindowAt(QPoint windowPoint); protected: // NSWindow handling. The QCocoaWindow/QNSView can either be displayed @@ -202,7 +204,9 @@ public: // for QNSView bool m_hasModalSession; bool m_frameStrutEventsEnabled; + bool m_geometryUpdateExposeAllowed; bool m_isExposed; + QRect m_exposedGeometry; int m_registerTouchCount; bool m_resizableTransientParent; bool m_overrideBecomeKey; diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 1aace958ed..a2ef43db67 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -213,6 +213,7 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw) , m_windowCursor(0) , m_hasModalSession(false) , m_frameStrutEventsEnabled(false) + , m_geometryUpdateExposeAllowed(false) , m_isExposed(false) , m_registerTouchCount(0) , m_resizableTransientParent(false) @@ -1084,22 +1085,61 @@ qreal QCocoaWindow::devicePixelRatio() const } } +// Returns whether the window can be expose, which it can +// if it is on screen and has a valid geometry. +bool QCocoaWindow::isWindowExposable() +{ + QSize size = geometry().size(); + bool validGeometry = (size.width() > 0 && size.height() > 0); + bool validScreen = ([[m_contentView window] screen] != 0); + bool nonHiddenSuperView = ![[m_contentView superview] isHidden]; + return (validGeometry && validScreen && nonHiddenSuperView); +} + +// Exposes the window by posting an expose event to QWindowSystemInterface void QCocoaWindow::exposeWindow() { - if (!m_isExposed && ![[m_contentView superview] isHidden]) { + m_geometryUpdateExposeAllowed = true; + + if (!isWindowExposable()) + return; + + if (!m_isExposed) { m_isExposed = true; + m_exposedGeometry = geometry(); QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry())); } } +// Obscures the window by posting an empty expose event to QWindowSystemInterface void QCocoaWindow::obscureWindow() { if (m_isExposed) { + m_geometryUpdateExposeAllowed = false; m_isExposed = false; QWindowSystemInterface::handleExposeEvent(window(), QRegion()); } } +// Updates window geometry by posting an expose event to QWindowSystemInterface +void QCocoaWindow::updateExposedGeometry() +{ + // updateExposedGeometry is not allowed to send the initial expose. If you want + // that call exposeWindow(); + if (!m_geometryUpdateExposeAllowed) + return; + + if (!isWindowExposable()) + return; + + if (m_exposedGeometry == geometry()) + return; + + m_isExposed = true; + m_exposedGeometry = geometry(); + QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry())); +} + QWindow *QCocoaWindow::childWindowAt(QPoint windowPoint) { QWindow *targetWindow = window(); diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h index ca2a15a1cc..403f8dc78a 100644 --- a/src/plugins/platforms/cocoa/qnsview.h +++ b/src/plugins/platforms/cocoa/qnsview.h @@ -93,6 +93,8 @@ QT_END_NAMESPACE - (BOOL)hasMask; - (BOOL)isOpaque; +- (void)convertFromScreen:(NSPoint)mouseLocation toWindowPoint:(QPointF *)qtWindowPoint andScreenPoint:(QPointF *)qtScreenPoint; + - (void)resetMouseButtons; - (void)handleMouseEvent:(NSEvent *)theEvent; diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 71c4de3b69..1c15c3b561 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -175,7 +175,7 @@ static QTouchDevice *touchDevice = 0; - (void) globalFrameChanged:(NSNotification*)notification { Q_UNUSED(notification); - QWindowSystemInterface::handleExposeEvent(m_window, m_window->geometry()); + m_platformWindow->updateExposedGeometry(); } - (void)viewDidMoveToSuperview @@ -186,7 +186,7 @@ static QTouchDevice *touchDevice = 0; if ([self superview]) { m_platformWindow->m_contentViewIsEmbedded = true; QWindowSystemInterface::handleGeometryChange(m_window, m_platformWindow->geometry()); - QWindowSystemInterface::handleExposeEvent(m_window, m_platformWindow->geometry()); + m_platformWindow->updateExposedGeometry(); QWindowSystemInterface::flushWindowSystemEvents(); } else { m_platformWindow->m_contentViewIsEmbedded = false; @@ -261,7 +261,7 @@ static QTouchDevice *touchDevice = 0; // Send a geometry change event to Qt, if it's ready to handle events if (!m_platformWindow->m_inConstructor) { QWindowSystemInterface::handleGeometryChange(m_window, geometry); - QWindowSystemInterface::handleExposeEvent(m_window, geometry); + m_platformWindow->updateExposedGeometry(); QWindowSystemInterface::flushWindowSystemEvents(); } } diff --git a/src/plugins/platforms/cocoa/qnswindowdelegate.h b/src/plugins/platforms/cocoa/qnswindowdelegate.h index 06e11fffbb..5717551cc3 100644 --- a/src/plugins/platforms/cocoa/qnswindowdelegate.h +++ b/src/plugins/platforms/cocoa/qnswindowdelegate.h @@ -53,6 +53,7 @@ - (id)initWithQCocoaWindow: (QCocoaWindow *) cocoaWindow; +- (void)windowDidBecomeKey:(NSNotification *)notification; - (void)windowDidResize:(NSNotification *)notification; - (void)windowDidMove:(NSNotification *)notification; - (void)windowWillMove:(NSNotification *)notification; diff --git a/src/plugins/platforms/cocoa/qnswindowdelegate.mm b/src/plugins/platforms/cocoa/qnswindowdelegate.mm index 10536bd5f4..c9b3d69381 100644 --- a/src/plugins/platforms/cocoa/qnswindowdelegate.mm +++ b/src/plugins/platforms/cocoa/qnswindowdelegate.mm @@ -56,6 +56,17 @@ return self; } +- (void)windowDidBecomeKey:(NSNotification *)notification +{ + Q_UNUSED(notification); + if (m_cocoaWindow->m_windowUnderMouse) { + QPointF windowPoint; + QPointF screenPoint; + [m_cocoaWindow->m_qtView convertFromScreen:[NSEvent mouseLocation] toWindowPoint:&windowPoint andScreenPoint:&screenPoint]; + QWindowSystemInterface::handleEnterEvent(m_cocoaWindow->m_enterLeaveTargetWindow, windowPoint, screenPoint); + } +} + - (void)windowDidResize:(NSNotification *)notification { Q_UNUSED(notification); diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp index 55a822b887..d6832493f1 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp @@ -87,6 +87,8 @@ QEglFSIntegration::QEglFSIntegration() , mScreen(0) , mInputContext(0) { + mDisableInputHandlers = qgetenv("QT_QPA_EGLFS_DISABLE_INPUT").toInt(); + initResources(); } @@ -176,7 +178,8 @@ void QEglFSIntegration::initialize() mInputContext = QPlatformInputContextFactory::create(); - createInputHandlers(); + if (!mDisableInputHandlers) + createInputHandlers(); } QEglFSScreen *QEglFSIntegration::createScreen() const diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.h b/src/plugins/platforms/eglfs/qeglfsintegration.h index f685eec2d4..12c8158bd1 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.h +++ b/src/plugins/platforms/eglfs/qeglfsintegration.h @@ -97,6 +97,7 @@ private: QScopedPointer<QPlatformServices> mServices; QEglFSScreen *mScreen; QPlatformInputContext *mInputContext; + bool mDisableInputHandlers; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/ios/qioseventdispatcher.mm b/src/plugins/platforms/ios/qioseventdispatcher.mm index 51eb10d385..f93c6cc3a7 100644 --- a/src/plugins/platforms/ios/qioseventdispatcher.mm +++ b/src/plugins/platforms/ios/qioseventdispatcher.mm @@ -206,13 +206,6 @@ namespace bool debugStackUsage = false; } -static int infoPlistValue(NSString* key, int defaultValue) -{ - static NSBundle *bundle = [NSBundle mainBundle]; - NSNumber* value = [bundle objectForInfoDictionaryKey:key]; - return value ? [value intValue] : defaultValue; -} - extern "C" int __attribute__((weak)) main(int argc, char *argv[]) { @autoreleasepool { diff --git a/src/plugins/platforms/ios/qiosglobal.h b/src/plugins/platforms/ios/qiosglobal.h index 1c76d29389..17184dc21d 100644 --- a/src/plugins/platforms/ios/qiosglobal.h +++ b/src/plugins/platforms/ios/qiosglobal.h @@ -61,6 +61,7 @@ QPointF fromCGPoint(const CGPoint &point); Qt::ScreenOrientation toQtScreenOrientation(UIDeviceOrientation uiDeviceOrientation); UIDeviceOrientation fromQtScreenOrientation(Qt::ScreenOrientation qtOrientation); QRect fromPortraitToPrimary(const QRect &rect, QPlatformScreen *screen); +int infoPlistValue(NSString* key, int defaultValue); QT_END_NAMESPACE diff --git a/src/plugins/platforms/ios/qiosglobal.mm b/src/plugins/platforms/ios/qiosglobal.mm index d749b8f514..8dd690f301 100644 --- a/src/plugins/platforms/ios/qiosglobal.mm +++ b/src/plugins/platforms/ios/qiosglobal.mm @@ -134,5 +134,12 @@ QRect fromPortraitToPrimary(const QRect &rect, QPlatformScreen *screen) : QRect(rect.y(), geometry.height() - rect.width() - rect.x(), rect.height(), rect.width()); } +int infoPlistValue(NSString* key, int defaultValue) +{ + static NSBundle *bundle = [NSBundle mainBundle]; + NSNumber* value = [bundle objectForInfoDictionaryKey:key]; + return value ? [value intValue] : defaultValue; +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/ios/qiosinputcontext.mm b/src/plugins/platforms/ios/qiosinputcontext.mm index 0e43429015..ea6a0bd4a6 100644 --- a/src/plugins/platforms/ios/qiosinputcontext.mm +++ b/src/plugins/platforms/ios/qiosinputcontext.mm @@ -270,7 +270,7 @@ void QIOSInputContext::scrollRootView() && m_keyboardListener->m_keyboardVisibleAndDocked && m_focusView.window == view.window) { QRectF cursorRect = qGuiApp->inputMethod()->cursorRectangle(); - cursorRect.translate(qGuiApp->focusWindow()->geometry().topLeft()); + cursorRect.translate(m_focusView.qwindow->geometry().topLeft()); qreal keyboardY = m_keyboardListener->m_keyboardEndRect.y(); int statusBarY = qGuiApp->primaryScreen()->availableGeometry().y(); const int margin = 20; diff --git a/src/plugins/platforms/ios/qiosintegration.h b/src/plugins/platforms/ios/qiosintegration.h index c655d8d3bf..fdecf70725 100644 --- a/src/plugins/platforms/ios/qiosintegration.h +++ b/src/plugins/platforms/ios/qiosintegration.h @@ -74,6 +74,8 @@ public: QStringList themeNames() const; QPlatformTheme *createPlatformTheme(const QString &name) const; + QPlatformDrag *drag() const Q_DECL_OVERRIDE { return 0; } + QAbstractEventDispatcher *createEventDispatcher() const; QPlatformNativeInterface *nativeInterface() const; diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm index 2e7e44d32c..0a6a00b753 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.mm +++ b/src/plugins/platforms/ios/qiosviewcontroller.mm @@ -101,12 +101,15 @@ - (BOOL)prefersStatusBarHidden { + static bool hiddenFromPlist = infoPlistValue(@"UIStatusBarHidden", false); + if (hiddenFromPlist) + return YES; QWindow *focusWindow = QGuiApplication::focusWindow(); - if (!focusWindow) + if (!focusWindow || !focusWindow->handle()) return [UIApplication sharedApplication].statusBarHidden; - QIOSWindow *topLevel = static_cast<QIOSWindow *>(focusWindow->handle())->topLevelWindow(); - return topLevel->window()->windowState() == Qt::WindowFullScreen; + QWindow *topLevel = static_cast<QIOSWindow *>(focusWindow->handle())->topLevelWindow(); + return topLevel->windowState() == Qt::WindowFullScreen; } @end diff --git a/src/plugins/platforms/ios/qioswindow.h b/src/plugins/platforms/ios/qioswindow.h index d36a81180c..8a5eb589d2 100644 --- a/src/plugins/platforms/ios/qioswindow.h +++ b/src/plugins/platforms/ios/qioswindow.h @@ -87,7 +87,7 @@ public: WId winId() const { return WId(m_view); }; - QIOSWindow *topLevelWindow() const; + QWindow *topLevelWindow() const; private: void applyGeometry(const QRect &rect); diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index 7ab136e8b9..7a0ff055ec 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -108,8 +108,6 @@ [NSNumber numberWithBool:YES], kEAGLDrawablePropertyRetainedBacking, kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, nil]; - [self updateTextInputTraits]; - if (isQtApplication()) self.hidden = YES; @@ -206,11 +204,12 @@ - (void)displayLayer:(CALayer *)layer { - QRect geometry = fromCGRect(layer.frame).toRect(); - Q_ASSERT(m_qioswindow->geometry() == geometry); + QSize bounds = fromCGRect(layer.bounds).toRect().size(); + + Q_ASSERT(m_qioswindow->geometry().size() == bounds); Q_ASSERT(self.hidden == !m_qioswindow->window()->isVisible()); - QRegion region = self.hidden ? QRegion() : QRect(QPoint(), geometry.size()); + QRegion region = self.hidden ? QRegion() : QRect(QPoint(), bounds); QWindowSystemInterface::handleExposeEvent(m_qioswindow->window(), region); QWindowSystemInterface::flushWindowSystemEvents(); } @@ -330,13 +329,9 @@ - (BOOL)becomeFirstResponder { - // On iOS, a QWindow should only have input focus when the input panel is - // open. This is to stop cursors and focus rects from being drawn when the - // user cannot type. And since the keyboard will open when a view becomes - // the first responder, it's now a good time to inform QPA that the QWindow - // this view backs became active: + // Note: QIOSInputContext controls our first responder status based on + // whether or not the keyboard should be open or closed. [self updateTextInputTraits]; - QWindowSystemInterface::handleWindowActivated(m_qioswindow->window()); return [super becomeFirstResponder]; } @@ -345,7 +340,8 @@ // Resigning first responed status means that the virtual keyboard was closed, or // some other view became first responder. In either case we clear the focus object to // avoid blinking cursors in line edits etc: - static_cast<QWindowPrivate *>(QObjectPrivate::get(m_qioswindow->window()))->clearFocusObject(); + if (m_qioswindow) + static_cast<QWindowPrivate *>(QObjectPrivate::get(m_qioswindow->window()))->clearFocusObject(); return [super resignFirstResponder]; } @@ -427,8 +423,10 @@ - (QWindow *)qwindow { - if ([self isKindOfClass:[QUIView class]]) - return static_cast<QUIView *>(self)->m_qioswindow->window(); + if ([self isKindOfClass:[QUIView class]]) { + if (QIOSWindow *w = static_cast<QUIView *>(self)->m_qioswindow) + return w->window(); + } return nil; } @@ -473,6 +471,7 @@ QIOSWindow::~QIOSWindow() // cancellation of all touch events. [m_view touchesCancelled:0 withEvent:0]; + m_view->m_qioswindow = 0; [m_view removeFromSuperview]; [m_view release]; } @@ -637,7 +636,7 @@ void QIOSWindow::setParent(const QPlatformWindow *parentWindow) } } -QIOSWindow *QIOSWindow::topLevelWindow() const +QWindow *QIOSWindow::topLevelWindow() const { QWindow *window = this->window(); while (window) { @@ -651,7 +650,7 @@ QIOSWindow *QIOSWindow::topLevelWindow() const window = parent; } - return static_cast<QIOSWindow *>(window->handle()); + return window; } void QIOSWindow::requestActivateWindow() diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp index d63149e4ce..281f54a9d9 100644 --- a/src/plugins/platforms/windows/qwindowsglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp @@ -586,15 +586,17 @@ static HGLRC createContext(const QOpenGLStaticContext &staticContext, attributes[attribIndex++] = WGL_CONTEXT_MINOR_VERSION_ARB; attributes[attribIndex++] = minorVersion; } + + int flags = 0; + if (format.testOption(QSurfaceFormat::DebugContext)) + flags |= WGL_CONTEXT_DEBUG_BIT_ARB; if (requestedVersion >= 0x0300) { - attributes[attribIndex++] = WGL_CONTEXT_FLAGS_ARB; - attributes[attribIndex] = 0; if (!format.testOption(QSurfaceFormat::DeprecatedFunctions)) - attributes[attribIndex] |= WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB; - if (format.testOption(QSurfaceFormat::DebugContext)) - attributes[attribIndex] |= WGL_CONTEXT_DEBUG_BIT_ARB; - attribIndex++; + flags |= WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB; } + attributes[attribIndex++] = WGL_CONTEXT_FLAGS_ARB; + attributes[attribIndex++] = flags; + if (requestedVersion >= 0x0302) { switch (format.profile()) { case QSurfaceFormat::NoProfile: diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp index eb1bbd1ab0..00a5da8f44 100644 --- a/src/plugins/platforms/windows/qwindowstheme.cpp +++ b/src/plugins/platforms/windows/qwindowstheme.cpp @@ -383,6 +383,8 @@ QVariant QWindowsTheme::themeHint(ThemeHint hint) const } case DialogSnapToDefaultButton: return QVariant(booleanSystemParametersInfo(SPI_GETSNAPTODEFBUTTON, false)); + case ContextMenuOnMouseRelease: + return QVariant(true); default: break; } diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 006a2802c1..d1d50eee73 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -1170,8 +1170,13 @@ void QWindowsWindow::show_sys() const if (type == Qt::Popup || type == Qt::ToolTip || type == Qt::Tool) sm = SW_SHOWNOACTIVATE; + if (w->windowState() & Qt::WindowMaximized) + setFlag(WithinMaximize); // QTBUG-8361 + ShowWindow(m_data.hwnd, sm); + clearFlag(WithinMaximize); + if (fakedMaximize) { setStyle(style() & ~WS_MAXIMIZEBOX); SetWindowPos(m_data.hwnd, 0, 0, 0, 0, 0, @@ -1582,8 +1587,11 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState) setFlag(FrameDirty); if ((oldState == Qt::WindowMaximized) != (newState == Qt::WindowMaximized)) { - if (visible && !(newState == Qt::WindowMinimized)) + if (visible && !(newState == Qt::WindowMinimized)) { + setFlag(WithinMaximize); ShowWindow(m_data.hwnd, (newState == Qt::WindowMaximized) ? SW_MAXIMIZE : SW_SHOWNOACTIVATE); + clearFlag(WithinMaximize); + } } if ((oldState == Qt::WindowFullScreen) != (newState == Qt::WindowFullScreen)) { @@ -1903,6 +1911,25 @@ void QWindowsWindow::getSizeHints(MINMAXINFO *mmi) const { const QWindowsGeometryHint hint(window(), m_data.customMargins); hint.applyToMinMaxInfo(m_data.hwnd, mmi); + + if ((testFlag(WithinMaximize) || (window()->windowState() == Qt::WindowMinimized)) + && (m_data.flags & Qt::FramelessWindowHint)) { + // This block fixes QTBUG-8361: Frameless windows shouldn't cover the + // taskbar when maximized + if (const QScreen *screen = effectiveScreen(window())) { + mmi->ptMaxSize.y = screen->availableGeometry().height(); + + // Width, because you can have the taskbar on the sides too. + mmi->ptMaxSize.x = screen->availableGeometry().width(); + + // If you have the taskbar on top, or on the left you don't want it at (0,0): + mmi->ptMaxPosition.x = screen->availableGeometry().x(); + mmi->ptMaxPosition.y = screen->availableGeometry().y(); + } else { + qWarning() << "Invalid screen"; + } + } + if (QWindowsContext::verboseWindows) qDebug() << __FUNCTION__ << window() << *mmi; } diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h index f055864482..61dc3e2dc2 100644 --- a/src/plugins/platforms/windows/qwindowswindow.h +++ b/src/plugins/platforms/windows/qwindowswindow.h @@ -136,7 +136,8 @@ public: TouchRegistered = 0x4000, AlertState = 0x8000, Exposed = 0x10000, - WithinCreate = 0x20000 + WithinCreate = 0x20000, + WithinMaximize = 0x40000 }; struct WindowData diff --git a/src/plugins/platforms/xcb/xcb-plugin.pro b/src/plugins/platforms/xcb/xcb-plugin.pro index 49a1c1b320..8968d020c4 100644 --- a/src/plugins/platforms/xcb/xcb-plugin.pro +++ b/src/plugins/platforms/xcb/xcb-plugin.pro @@ -81,7 +81,7 @@ contains(QT_CONFIG, xcb-sm) { } contains(QT_CONFIG, opengl) { - contains(QT_CONFIG, xcb-xlib):contains(QT_CONFIG, glx) { + contains(QT_CONFIG, xcb-xlib):!contains(QT_CONFIG, opengles2) { DEFINES += XCB_USE_GLX HEADERS += qglxintegration.h SOURCES += qglxintegration.cpp diff --git a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp index 8809b52751..c1b9828a23 100644 --- a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp +++ b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp @@ -457,9 +457,6 @@ void QPageSetupWidget::selectPrinter() unitChanged(widget.unit->currentIndex()); m_pagePreview->setMargins(m_leftMargin, m_topMargin, m_rightMargin, m_bottomMargin); - - // setup printer here the first time - setupPrinter(); } void QPageSetupWidget::selectPdfPsPrinter(const QPrinter *p) diff --git a/src/printsupport/dialogs/qprintdialog.h b/src/printsupport/dialogs/qprintdialog.h index c822aa0533..886cd1e08d 100644 --- a/src/printsupport/dialogs/qprintdialog.h +++ b/src/printsupport/dialogs/qprintdialog.h @@ -106,7 +106,6 @@ Q_SIGNALS: private: #if defined (Q_OS_UNIX) && !defined(Q_OS_MAC) - Q_PRIVATE_SLOT(d_func(), void _q_chbPrintLastFirstToggled(bool)) Q_PRIVATE_SLOT(d_func(), void _q_togglePageSetCombo(bool)) Q_PRIVATE_SLOT(d_func(), void _q_collapseOrExpandDialog()) # if !defined(QT_NO_MESSAGEBOX) diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp index fe7e43814c..a903d170f2 100644 --- a/src/printsupport/dialogs/qprintdialog_unix.cpp +++ b/src/printsupport/dialogs/qprintdialog_unix.cpp @@ -203,7 +203,6 @@ public: void selectPrinter(const QPrinter::OutputFormat outputFormat); - void _q_chbPrintLastFirstToggled(bool); void _q_togglePageSetCombo(bool); #ifndef QT_NO_MESSAGEBOX void _q_checkFields(); @@ -363,9 +362,6 @@ void QPrintDialogPrivate::init() #endif QObject::connect(buttons, SIGNAL(rejected()), q, SLOT(reject())); - QObject::connect(options.reverse, SIGNAL(toggled(bool)), - q, SLOT(_q_chbPrintLastFirstToggled(bool))); - QObject::connect(options.printSelection, SIGNAL(toggled(bool)), q, SLOT(_q_togglePageSetCombo(bool))); @@ -416,6 +412,10 @@ void QPrintDialogPrivate::applyPrinterProperties() void QPrintDialogPrivate::setupPrinter() { + // First setup the requested OutputFormat, Printer and Page Size first + top->d->setupPrinter(); + + // Then setup Print Job options Q_Q(QPrintDialog); QPrinter* p = q->printer(); @@ -429,6 +429,7 @@ void QPrintDialogPrivate::setupPrinter() } p->setColorMode(options.color->isChecked() ? QPrinter::Color : QPrinter::GrayScale); + p->setPageOrder(options.reverse->isChecked() ? QPrinter::LastPageFirst : QPrinter::FirstPageFirst); // print range if (options.printAll->isChecked()) { @@ -482,17 +483,6 @@ void QPrintDialogPrivate::setupPrinter() // copies p->setCopyCount(options.copies->value()); p->setCollateCopies(options.collate->isChecked()); - - top->d->setupPrinter(); -} - -void QPrintDialogPrivate::_q_chbPrintLastFirstToggled(bool checked) -{ - Q_Q(QPrintDialog); - if (checked) - q->printer()->setPageOrder(QPrinter::LastPageFirst); - else - q->printer()->setPageOrder(QPrinter::FirstPageFirst); } void QPrintDialogPrivate::_q_togglePageSetCombo(bool checked) diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp index e4c4fd25e3..0b338c535f 100644 --- a/src/printsupport/kernel/qprintengine_win.cpp +++ b/src/printsupport/kernel/qprintengine_win.cpp @@ -1448,6 +1448,7 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant & d->devMode->dmPaperLength = qRound(sizeMM.height() * 10.0); d->devMode->dmPaperWidth = qRound(sizeMM.width() * 10.0); } + d->doReinit(); break; } @@ -1941,8 +1942,9 @@ static void draw_text_item_win(const QPointF &pos, const QTextItemInt &ti, HDC h void QWin32PrintEnginePrivate::updateCustomPaperSize() { const uint paperSize = devMode->dmPaperSize; - has_custom_paper_size = true; + has_custom_paper_size = false; if (paperSize > 0 && mapDevmodePaperSize(paperSize) == QPrinter::Custom) { + has_custom_paper_size = true; const QList<QPair<QSizeF, int> > paperSizes = printerPaperSizes(name); for (int i=0; i<paperSizes.size(); i++) { if ((uint)paperSizes.at(i).second == paperSize) { diff --git a/src/tools/qdoc/generator.cpp b/src/tools/qdoc/generator.cpp index 97a980a3fa..3cbba788c8 100644 --- a/src/tools/qdoc/generator.cpp +++ b/src/tools/qdoc/generator.cpp @@ -334,14 +334,14 @@ QString Generator::fileBase(const Node *node) const if (node->isQmlNode()) { if (!node->qmlModuleName().isEmpty()) { base.prepend(node->qmlModuleName() + QLatin1Char('-')); - /* - To avoid file name conflicts in the html directory, - we prepend a prefix (by default, "qml-") to the file name of QML - element doc files. - */ - if ((node->subType() == Node::QmlClass) || (node->subType() == Node::QmlBasicType)) { - base.prepend(outputPrefix(QLatin1String("QML"))); - } + } + /* + To avoid file name conflicts in the html directory, + we prepend a prefix (by default, "qml-") to the file name of QML + element doc files. + */ + if ((node->subType() == Node::QmlClass) || (node->subType() == Node::QmlBasicType)) { + base.prepend(outputPrefix(QLatin1String("QML"))); } } else if (node->subType() == Node::QmlModule) { diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp index 986b4ae261..511dc3240f 100644 --- a/src/tools/qdoc/htmlgenerator.cpp +++ b/src/tools/qdoc/htmlgenerator.cpp @@ -269,6 +269,9 @@ QString HtmlGenerator::format() void HtmlGenerator::generateTree() { qdb_->buildCollections(); + Node* qflags = qdb_->findNodeByNameAndType(QStringList("QFlags"), Node::Class, Node::NoSubType); + if (qflags) + qflagsHref_ = linkForNode(qflags,0); if (!runPrepareOnly()) { Generator::generateTree(); generateCollisionPages(); @@ -3660,7 +3663,7 @@ void HtmlGenerator::generateDetailedMember(const Node *node, if (enume->flagsType()) { out() << "<p>The " << protectEnc(enume->flagsType()->name()) << " type is a typedef for " - << "<a href=\"qflags.html\">QFlags</a><" + << "<a href=\"" << qflagsHref_ << "\">QFlags</a><" << protectEnc(enume->name()) << ">. It stores an OR combination of " << protectEnc(enume->name()) diff --git a/src/tools/qdoc/htmlgenerator.h b/src/tools/qdoc/htmlgenerator.h index f2525327e8..ae16f3c54f 100644 --- a/src/tools/qdoc/htmlgenerator.h +++ b/src/tools/qdoc/htmlgenerator.h @@ -262,6 +262,7 @@ private: QString cppclassespage; QString qmltypespage; QString buildversion; + QString qflagsHref_; public: static bool debugging_on; diff --git a/src/widgets/doc/snippets/code/doc_src_stylesheet.qdoc b/src/widgets/doc/snippets/code/doc_src_stylesheet.qdoc index 7f6f1a3d8b..36d3dc6af4 100644 --- a/src/widgets/doc/snippets/code/doc_src_stylesheet.qdoc +++ b/src/widgets/doc/snippets/code/doc_src_stylesheet.qdoc @@ -874,7 +874,7 @@ QGroupBox::title { subcontrol-position: top center; /* position at the top center */ padding: 0 3px; background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, - stop: 0 #FFOECE, stop: 1 #FFFFFF); + stop: 0 #FF0ECE, stop: 1 #FFFFFF); } //! [114] diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp index 04047d8d0a..2d07e545c8 100644 --- a/src/widgets/graphicsview/qgraphicsitem.cpp +++ b/src/widgets/graphicsview/qgraphicsitem.cpp @@ -7634,7 +7634,10 @@ QGraphicsObject::~QGraphicsObject() bool QGraphicsObject::event(QEvent *ev) { if (ev->type() == QEvent::StyleAnimationUpdate) { - update(); + if (isVisible()) { + ev->accept(); + update(); + } return true; } return QObject::event(ev); diff --git a/src/widgets/graphicsview/qgraphicswidget.cpp b/src/widgets/graphicsview/qgraphicswidget.cpp index 4abb5e39e5..ccc51120a9 100644 --- a/src/widgets/graphicsview/qgraphicswidget.cpp +++ b/src/widgets/graphicsview/qgraphicswidget.cpp @@ -1409,9 +1409,14 @@ bool QGraphicsWidget::event(QEvent *event) break; case QEvent::WindowActivate: case QEvent::WindowDeactivate: - case QEvent::StyleAnimationUpdate: update(); break; + case QEvent::StyleAnimationUpdate: + if (isVisible()) { + event->accept(); + update(); + } + break; // Taken from QWidget::event case QEvent::ActivationChange: case QEvent::EnabledChange: diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 57a2063b78..be349bfced 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -1888,14 +1888,29 @@ bool QApplication::event(QEvent *e) \obsolete */ +// ### FIXME: topLevelWindows does not contain QWidgets without a parent +// until create_sys is called. So we have to override the +// QGuiApplication::notifyLayoutDirectionChange +// to do the right thing. void QApplicationPrivate::notifyLayoutDirectionChange() { - QWidgetList list = QApplication::topLevelWidgets(); + const QWidgetList list = QApplication::topLevelWidgets(); + QWindowList windowList = QGuiApplication::topLevelWindows(); + + // send to all top-level QWidgets for (int i = 0; i < list.size(); ++i) { QWidget *w = list.at(i); + windowList.removeAll(w->windowHandle()); QEvent ev(QEvent::ApplicationLayoutDirectionChange); QCoreApplication::sendEvent(w, &ev); } + + // in case there are any plain QWindows in this QApplication-using + // application, also send the notification to them + for (int i = 0; i < windowList.size(); ++i) { + QEvent ev(QEvent::ApplicationLayoutDirectionChange); + QCoreApplication::sendEvent(windowList.at(i), &ev); + } } /*! diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index fc7bade9f7..7a86b6affe 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -8249,7 +8249,10 @@ bool QWidget::event(QEvent *event) update(static_cast<QUpdateLaterEvent*>(event)->region()); break; case QEvent::StyleAnimationUpdate: - update(); + if (isVisible() && !window()->isMinimized()) { + event->accept(); + update(); + } break; case QEvent::WindowBlocked: diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp index 93234f3958..3b6127e4e7 100644 --- a/src/widgets/kernel/qwidget_qpa.cpp +++ b/src/widgets/kernel/qwidget_qpa.cpp @@ -148,10 +148,12 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO QBackingStore *store = q->backingStore(); if (!store) { - if (win && q->windowType() != Qt::Desktop) - q->setBackingStore(new QBackingStore(win)); - else + if (win && q->windowType() != Qt::Desktop) { + if (q->isTopLevel()) + q->setBackingStore(new QBackingStore(win)); + } else { q->setAttribute(Qt::WA_PaintOnScreen, true); + } } setWindowModified_helper(); diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index 2e96247873..167102c633 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -49,6 +49,7 @@ #endif #include <private/qwidgetbackingstore_p.h> #include <qpa/qwindowsysteminterface_p.h> +#include <qpa/qplatformtheme.h> #include <private/qgesturemanager_p.h> QT_BEGIN_NAMESPACE @@ -354,6 +355,9 @@ void QWidgetWindow::handleNonClientAreaMouseEvent(QMouseEvent *e) void QWidgetWindow::handleMouseEvent(QMouseEvent *event) { + static const QEvent::Type contextMenuTrigger = + QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::ContextMenuOnMouseRelease).toBool() ? + QEvent::MouseButtonRelease : QEvent::MouseButtonPress; if (qApp->d_func()->inPopupMode()) { QWidget *activePopupWidget = qApp->activePopupWidget(); QWidget *popup = activePopupWidget; @@ -438,7 +442,7 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event) } qt_replay_popup_mouse_event = false; #ifndef QT_NO_CONTEXTMENU - } else if (event->type() == QEvent::MouseButtonPress + } else if (event->type() == contextMenuTrigger && event->button() == Qt::RightButton && (openPopupCount == oldOpenPopupCount)) { QWidget *popupEvent = popup; @@ -487,7 +491,7 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event) qt_last_mouse_receiver); #ifndef QT_NO_CONTEXTMENU - if (event->type() == QEvent::MouseButtonPress && event->button() == Qt::RightButton) { + if (event->type() == contextMenuTrigger && event->button() == Qt::RightButton) { QContextMenuEvent e(QContextMenuEvent::Mouse, mapped, event->globalPos(), event->modifiers()); QGuiApplication::sendSpontaneousEvent(receiver, &e); } diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp index 77f869f036..da9b5da2a5 100644 --- a/src/widgets/styles/qstyle.cpp +++ b/src/widgets/styles/qstyle.cpp @@ -619,7 +619,7 @@ void QStyle::drawItemText(QPainter *painter, const QRect &rect, int alignment, c void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const { - int scale = pixmap.devicePixelRatio(); + qreal scale = pixmap.devicePixelRatio(); QRect aligned = alignedRect(QApplication::layoutDirection(), QFlag(alignment), pixmap.size() / scale, rect); QRect inter = aligned.intersected(rect); diff --git a/src/widgets/styles/qstyleanimation.cpp b/src/widgets/styles/qstyleanimation.cpp index 4fb67d90c0..90fb371982 100644 --- a/src/widgets/styles/qstyleanimation.cpp +++ b/src/widgets/styles/qstyleanimation.cpp @@ -93,7 +93,10 @@ void QStyleAnimation::setStartTime(const QTime &time) void QStyleAnimation::updateTarget() { QEvent event(QEvent::StyleAnimationUpdate); + event.setAccepted(false); QCoreApplication::sendEvent(target(), &event); + if (!event.isAccepted()) + stop(); } bool QStyleAnimation::isUpdateNeeded() const @@ -103,16 +106,8 @@ bool QStyleAnimation::isUpdateNeeded() const void QStyleAnimation::updateCurrentTime(int) { - if (QObject *tgt = target()) { - if (tgt->isWidgetType()) { - QWidget *widget = static_cast<QWidget *>(tgt); - if (!widget->isVisible() || widget->window()->isMinimized()) - stop(); - } - - if (isUpdateNeeded()) - updateTarget(); - } + if (target() && isUpdateNeeded()) + updateTarget(); } QProgressStyleAnimation::QProgressStyleAnimation(int speed, QObject *target) : diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index ab98dfbdcf..2f36e0e53c 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -5271,7 +5271,7 @@ QRect QStyleSheetStyle::subControlRect(ComplexControl cc, const QStyleOptionComp QRenderRule downRule = renderRule(w, opt, PseudoElement_SpinBoxDownButton); bool ruleMatch = rule.hasBox() || !rule.hasNativeBorder(); bool upRuleMatch = upRule.hasGeometry() || upRule.hasPosition(); - bool downRuleMatch = downRule.hasGeometry() || upRule.hasPosition(); + bool downRuleMatch = downRule.hasGeometry() || downRule.hasPosition(); if (ruleMatch || upRuleMatch || downRuleMatch) { switch (sc) { case SC_SpinBoxFrame: diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index fd74ab7595..17a6ededfe 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -3073,7 +3073,7 @@ void QComboBox::wheelEvent(QWheelEvent *e) newIndex--; while ((newIndex >= 0) && !(d->model->flags(d->model->index(newIndex,d->modelColumn,d->root)) & Qt::ItemIsEnabled)) newIndex--; - } else { + } else if (e->delta() < 0) { newIndex++; while ((newIndex < count()) && !(d->model->flags(d->model->index(newIndex,d->modelColumn,d->root)) & Qt::ItemIsEnabled)) newIndex++; diff --git a/src/widgets/widgets/qspinbox.cpp b/src/widgets/widgets/qspinbox.cpp index a43b937951..e198dae168 100644 --- a/src/widgets/widgets/qspinbox.cpp +++ b/src/widgets/widgets/qspinbox.cpp @@ -1042,7 +1042,7 @@ QVariant QSpinBoxPrivate::validateAndInterpret(QString &input, int &pos, if (max != min && (copy.isEmpty() || (min < 0 && copy == QLatin1String("-")) - || (min >= 0 && copy == QLatin1String("+")))) { + || (max >= 0 && copy == QLatin1String("+")))) { state = QValidator::Intermediate; QSBDEBUG() << __FILE__ << __LINE__<< "num is set to" << num; } else if (copy.startsWith(QLatin1Char('-')) && min >= 0) { diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp index 0255183c87..b8f8762240 100644 --- a/src/widgets/widgets/qwidgettextcontrol.cpp +++ b/src/widgets/widgets/qwidgettextcontrol.cpp @@ -2158,11 +2158,14 @@ QMenu *QWidgetTextControl::createStandardContextMenu(const QPointF &pos, QWidget setActionIcon(a, QStringLiteral("edit-redo")); menu->addSeparator(); +#ifndef QT_NO_CLIPBOARD a = menu->addAction(tr("Cu&t") + ACCEL_KEY(QKeySequence::Cut), this, SLOT(cut())); a->setEnabled(d->cursor.hasSelection()); setActionIcon(a, QStringLiteral("edit-cut")); +#endif } +#ifndef QT_NO_CLIPBOARD if (showTextSelectionActions) { a = menu->addAction(tr("&Copy") + ACCEL_KEY(QKeySequence::Copy), this, SLOT(copy())); a->setEnabled(d->cursor.hasSelection()); @@ -2175,9 +2178,10 @@ QMenu *QWidgetTextControl::createStandardContextMenu(const QPointF &pos, QWidget a = menu->addAction(tr("Copy &Link Location"), this, SLOT(_q_copyLink())); a->setEnabled(!d->linkToCopy.isEmpty()); } +#endif // QT_NO_CLIPBOARD if (d->interactionFlags & Qt::TextEditable) { -#if !defined(QT_NO_CLIPBOARD) +#ifndef QT_NO_CLIPBOARD a = menu->addAction(tr("&Paste") + ACCEL_KEY(QKeySequence::Paste), this, SLOT(paste())); a->setEnabled(canPaste()); setActionIcon(a, QStringLiteral("edit-paste")); diff --git a/src/winmain/winmain.pro b/src/winmain/winmain.pro index 4303c3bc12..b0771caa55 100644 --- a/src/winmain/winmain.pro +++ b/src/winmain/winmain.pro @@ -31,8 +31,7 @@ load(qt_targets) wince*:QMAKE_POST_LINK = -unix|win32-g++* { - lib_replace.match = $$[QT_INSTALL_LIBS/get] - lib_replace.replace = $$[QT_INSTALL_LIBS/raw] - QMAKE_PRL_INSTALL_REPLACE += lib_replace -} +lib_replace.match = $$[QT_INSTALL_LIBS/get] +lib_replace.replace = $$[QT_INSTALL_LIBS/raw] +lib_replace.CONFIG = path +QMAKE_PRL_INSTALL_REPLACE += lib_replace |