diff --git a/examples/opengl/qopenglwindow/background_renderer.cpp b/examples/opengl/qopenglwindow/background_renderer.cpp index cba4ae1f2f..9da1b9bf99 100644 --- a/examples/opengl/qopenglwindow/background_renderer.cpp +++ b/examples/opengl/qopenglwindow/background_renderer.cpp @@ -84,7 +84,7 @@ FragmentToy::FragmentToy(const QString &fragmentSource, QObject *parent) QFileInfo info(fragmentSource); m_fragment_file_last_modified = info.lastModified(); m_fragment_file = fragmentSource; -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) m_watcher.addPath(info.canonicalPath()); QObject::connect(&m_watcher, &QFileSystemWatcher::directoryChanged, this, &FragmentToy::fileChanged); #endif diff --git a/examples/opengl/qopenglwindow/background_renderer.h b/examples/opengl/qopenglwindow/background_renderer.h index f7683db3d6..d99b7ddbeb 100644 --- a/examples/opengl/qopenglwindow/background_renderer.h +++ b/examples/opengl/qopenglwindow/background_renderer.h @@ -54,7 +54,9 @@ #include #include #include +#if QT_CONFIG(filesystemwatcher) #include +#endif #include #include #include @@ -71,7 +73,7 @@ public: private: void fileChanged(const QString &path); bool m_recompile_shaders; -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) QFileSystemWatcher m_watcher; #endif QString m_fragment_file; diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index 0406da584b..4f0cee65e1 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -112,7 +112,6 @@ const char _Culture[] = "Culture"; const char _DLLDataFileName[] = "DLLDataFileName"; const char _DataExecutionPrevention[] = "DataExecutionPrevention"; const char _DebugInformationFormat[] = "DebugInformationFormat"; -const char _DefaultCharIsUnsigned[] = "DefaultCharIsUnsigned"; const char _DefaultCharType[] = "DefaultCharType"; const char _DelayLoadDLLs[] = "DelayLoadDLLs"; const char _DeleteExtensionsOnClean[] = "DeleteExtensionsOnClean"; @@ -358,7 +357,6 @@ VCCLCompilerTool::VCCLCompilerTool() CompileAsWinRT(unset), CompileOnly(unset), DebugInformationFormat(debugDisabled), - DefaultCharIsUnsigned(unset), Detect64BitPortabilityProblems(unset), DisableLanguageExtensions(unset), EnableEnhancedInstructionSet(archNotSet), @@ -668,7 +666,7 @@ bool VCCLCompilerTool::parseOption(const char* option) AdditionalIncludeDirectories += option+2; break; case 'J': - DefaultCharIsUnsigned = _True; + AdditionalOptions += option; break; case 'L': if(second == 'D') { @@ -2646,7 +2644,6 @@ void VCProjectWriter::write(XmlOutput &xml, const VCCLCompilerTool &tool) << attrE(_CompileAsManaged, tool.CompileAsManaged, /*ifNot*/ managedDefault) << attrT(_CompileOnly, tool.CompileOnly) << attrE(_DebugInformationFormat, tool.DebugInformationFormat, /*ifNot*/ debugUnknown) - << attrT(_DefaultCharIsUnsigned, tool.DefaultCharIsUnsigned) << attrT(_Detect64BitPortabilityProblems, tool.Detect64BitPortabilityProblems) << attrT(_DisableLanguageExtensions, tool.DisableLanguageExtensions) << attrX(_DisableSpecificWarnings, tool.DisableSpecificWarnings) diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 9f47b8eb98..a9c5d17aad 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -1672,9 +1672,7 @@ static bool android_default_message_handler(QtMsgType type, case QtFatalMsg: priority = ANDROID_LOG_FATAL; break; }; - __android_log_print(priority, qPrintable(QCoreApplication::applicationName()), - "%s:%d (%s): %s\n", context.file, context.line, - context.function, qPrintable(formattedMessage)); + __android_log_print(priority, qPrintable(QCoreApplication::applicationName()), "%s\n", qPrintable(formattedMessage)); return true; // Prevent further output to stderr } diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri index d138ab2f00..c6a5407e51 100644 --- a/src/corelib/io/io.pri +++ b/src/corelib/io/io.pri @@ -38,9 +38,6 @@ HEADERS += \ io/qsettings_p.h \ io/qfsfileengine_p.h \ io/qfsfileengine_iterator_p.h \ - io/qfilesystemwatcher.h \ - io/qfilesystemwatcher_p.h \ - io/qfilesystemwatcher_polling_p.h \ io/qfilesystementry_p.h \ io/qfilesystemengine_p.h \ io/qfilesystemmetadata_p.h \ @@ -79,14 +76,38 @@ SOURCES += \ io/qsettings.cpp \ io/qfsfileengine.cpp \ io/qfsfileengine_iterator.cpp \ - io/qfilesystemwatcher.cpp \ - io/qfilesystemwatcher_polling.cpp \ io/qfilesystementry.cpp \ io/qfilesystemengine.cpp \ io/qfileselector.cpp \ io/qloggingcategory.cpp \ io/qloggingregistry.cpp +qtConfig(filesystemwatcher) { + HEADERS += \ + io/qfilesystemwatcher.h \ + io/qfilesystemwatcher_p.h \ + io/qfilesystemwatcher_polling_p.h + SOURCES += \ + io/qfilesystemwatcher.cpp \ + io/qfilesystemwatcher_polling.cpp + + win32 { + SOURCES += io/qfilesystemwatcher_win.cpp + HEADERS += io/qfilesystemwatcher_win_p.h + } else:macos { + OBJECTIVE_SOURCES += io/qfilesystemwatcher_fsevents.mm + HEADERS += io/qfilesystemwatcher_fsevents_p.h + } else:qtConfig(inotify) { + SOURCES += io/qfilesystemwatcher_inotify.cpp + HEADERS += io/qfilesystemwatcher_inotify_p.h + } else { + freebsd|darwin|openbsd|netbsd { + SOURCES += io/qfilesystemwatcher_kqueue.cpp + HEADERS += io/qfilesystemwatcher_kqueue_p.h + } + } +} + qtConfig(processenvironment) { SOURCES += \ io/qprocess.cpp @@ -103,9 +124,6 @@ qtConfig(processenvironment) { win32 { SOURCES += io/qfsfileengine_win.cpp SOURCES += io/qlockfile_win.cpp - - SOURCES += io/qfilesystemwatcher_win.cpp - HEADERS += io/qfilesystemwatcher_win_p.h SOURCES += io/qfilesystemengine_win.cpp qtConfig(filesystemiterator) { @@ -153,8 +171,6 @@ win32 { OBJECTIVE_SOURCES += io/qprocess_darwin.mm OBJECTIVE_SOURCES += io/qstandardpaths_mac.mm osx { - OBJECTIVE_SOURCES += io/qfilesystemwatcher_fsevents.mm - HEADERS += io/qfilesystemwatcher_fsevents_p.h LIBS += -framework DiskArbitration -framework IOKit } else { LIBS += -framework MobileCoreServices @@ -173,17 +189,5 @@ win32 { io/qstandardpaths_unix.cpp \ io/qstorageinfo_unix.cpp } - - linux|if(qnx:qtConfig(inotify)) { - SOURCES += io/qfilesystemwatcher_inotify.cpp - HEADERS += io/qfilesystemwatcher_inotify_p.h - } - - !nacl { - freebsd-*|mac|darwin-*|openbsd-*|netbsd-*:{ - SOURCES += io/qfilesystemwatcher_kqueue.cpp - HEADERS += io/qfilesystemwatcher_kqueue_p.h - } - } } diff --git a/src/corelib/io/qfilesystemwatcher.cpp b/src/corelib/io/qfilesystemwatcher.cpp index ed597c415b..f40e166d9f 100644 --- a/src/corelib/io/qfilesystemwatcher.cpp +++ b/src/corelib/io/qfilesystemwatcher.cpp @@ -40,8 +40,6 @@ #include "qfilesystemwatcher.h" #include "qfilesystemwatcher_p.h" -#ifndef QT_NO_FILESYSTEMWATCHER - #include #include #include @@ -499,5 +497,3 @@ QT_END_NAMESPACE #include "moc_qfilesystemwatcher.cpp" #include "moc_qfilesystemwatcher_p.cpp" -#endif // QT_NO_FILESYSTEMWATCHER - diff --git a/src/corelib/io/qfilesystemwatcher.h b/src/corelib/io/qfilesystemwatcher.h index 057a20672c..cd64115f8f 100644 --- a/src/corelib/io/qfilesystemwatcher.h +++ b/src/corelib/io/qfilesystemwatcher.h @@ -42,7 +42,7 @@ #include -#ifndef QT_NO_FILESYSTEMWATCHER +QT_REQUIRE_CONFIG(filesystemwatcher); QT_BEGIN_NAMESPACE @@ -78,5 +78,4 @@ private: QT_END_NAMESPACE -#endif // QT_NO_FILESYSTEMWATCHER #endif // QFILESYSTEMWATCHER_H diff --git a/src/corelib/io/qfilesystemwatcher_fsevents.mm b/src/corelib/io/qfilesystemwatcher_fsevents.mm index f68fb67d79..f594fad803 100644 --- a/src/corelib/io/qfilesystemwatcher_fsevents.mm +++ b/src/corelib/io/qfilesystemwatcher_fsevents.mm @@ -45,8 +45,6 @@ #include "private/qcore_unix_p.h" #include "kernel/qcore_mac_p.h" -#ifndef QT_NO_FILESYSTEMWATCHER - #include #include #include @@ -585,6 +583,4 @@ bool QFseventsFileSystemWatcherEngine::derefPath(const QString &watchedPath) return false; } -#endif //QT_NO_FILESYSTEMWATCHER - QT_END_NAMESPACE diff --git a/src/corelib/io/qfilesystemwatcher_fsevents_p.h b/src/corelib/io/qfilesystemwatcher_fsevents_p.h index 1b0b8ae15c..6e8e7d4567 100644 --- a/src/corelib/io/qfilesystemwatcher_fsevents_p.h +++ b/src/corelib/io/qfilesystemwatcher_fsevents_p.h @@ -62,7 +62,7 @@ #include #include -#ifndef QT_NO_FILESYSTEMWATCHER +QT_REQUIRE_CONFIG(filesystemwatcher); QT_BEGIN_NAMESPACE @@ -150,5 +150,4 @@ private: QT_END_NAMESPACE -#endif //QT_NO_FILESYSTEMWATCHER #endif // QFILESYSTEMWATCHER_FSEVENTS_P_H diff --git a/src/corelib/io/qfilesystemwatcher_inotify.cpp b/src/corelib/io/qfilesystemwatcher_inotify.cpp index c0c5f9d744..3b7135e582 100644 --- a/src/corelib/io/qfilesystemwatcher_inotify.cpp +++ b/src/corelib/io/qfilesystemwatcher_inotify.cpp @@ -40,8 +40,6 @@ #include "qfilesystemwatcher.h" #include "qfilesystemwatcher_inotify_p.h" -#ifndef QT_NO_FILESYSTEMWATCHER - #include "private/qcore_unix_p.h" #include "private/qsystemerror_p.h" @@ -427,5 +425,3 @@ QString QInotifyFileSystemWatcherEngine::getPathFromID(int id) const QT_END_NAMESPACE #include "moc_qfilesystemwatcher_inotify_p.cpp" - -#endif // QT_NO_FILESYSTEMWATCHER diff --git a/src/corelib/io/qfilesystemwatcher_inotify_p.h b/src/corelib/io/qfilesystemwatcher_inotify_p.h index 0c873466c8..b63729cde4 100644 --- a/src/corelib/io/qfilesystemwatcher_inotify_p.h +++ b/src/corelib/io/qfilesystemwatcher_inotify_p.h @@ -53,7 +53,7 @@ #include "qfilesystemwatcher_p.h" -#ifndef QT_NO_FILESYSTEMWATCHER +QT_REQUIRE_CONFIG(filesystemwatcher); #include #include @@ -89,5 +89,4 @@ private: QT_END_NAMESPACE -#endif // QT_NO_FILESYSTEMWATCHER #endif // QFILESYSTEMWATCHER_INOTIFY_P_H diff --git a/src/corelib/io/qfilesystemwatcher_kqueue.cpp b/src/corelib/io/qfilesystemwatcher_kqueue.cpp index c33fba2d1f..423b88cb7f 100644 --- a/src/corelib/io/qfilesystemwatcher_kqueue.cpp +++ b/src/corelib/io/qfilesystemwatcher_kqueue.cpp @@ -43,8 +43,6 @@ #include "qfilesystemwatcher_kqueue_p.h" #include "private/qcore_unix_p.h" -#ifndef QT_NO_FILESYSTEMWATCHER - #include #include #include @@ -254,6 +252,4 @@ void QKqueueFileSystemWatcherEngine::readFromKqueue() } } -#endif //QT_NO_FILESYSTEMWATCHER - QT_END_NAMESPACE diff --git a/src/corelib/io/qfilesystemwatcher_kqueue_p.h b/src/corelib/io/qfilesystemwatcher_kqueue_p.h index 9d4b6d1fe6..8e11e4b7da 100644 --- a/src/corelib/io/qfilesystemwatcher_kqueue_p.h +++ b/src/corelib/io/qfilesystemwatcher_kqueue_p.h @@ -59,7 +59,7 @@ #include #include -#ifndef QT_NO_FILESYSTEMWATCHER +QT_REQUIRE_CONFIG(filesystemwatcher); struct kevent; QT_BEGIN_NAMESPACE @@ -90,5 +90,4 @@ private: QT_END_NAMESPACE -#endif //QT_NO_FILESYSTEMWATCHER #endif // QFILESYSTEMWATCHER_KQUEUE_P_H diff --git a/src/corelib/io/qfilesystemwatcher_p.h b/src/corelib/io/qfilesystemwatcher_p.h index 4220c1db28..1997ff6c86 100644 --- a/src/corelib/io/qfilesystemwatcher_p.h +++ b/src/corelib/io/qfilesystemwatcher_p.h @@ -53,7 +53,7 @@ #include "qfilesystemwatcher.h" -#ifndef QT_NO_FILESYSTEMWATCHER +QT_REQUIRE_CONFIG(filesystemwatcher); #include @@ -120,5 +120,4 @@ private: QT_END_NAMESPACE -#endif // QT_NO_FILESYSTEMWATCHER #endif // QFILESYSTEMWATCHER_P_H diff --git a/src/corelib/io/qfilesystemwatcher_polling.cpp b/src/corelib/io/qfilesystemwatcher_polling.cpp index 5bef8127f7..903c15f4a9 100644 --- a/src/corelib/io/qfilesystemwatcher_polling.cpp +++ b/src/corelib/io/qfilesystemwatcher_polling.cpp @@ -40,8 +40,6 @@ #include "qfilesystemwatcher_polling_p.h" #include -#ifndef QT_NO_FILESYSTEMWATCHER - QT_BEGIN_NAMESPACE QPollingFileSystemWatcherEngine::QPollingFileSystemWatcherEngine(QObject *parent) @@ -153,5 +151,3 @@ void QPollingFileSystemWatcherEngine::timeout() QT_END_NAMESPACE #include "moc_qfilesystemwatcher_polling_p.cpp" - -#endif // !QT_NO_FILESYSTEMWATCHER diff --git a/src/corelib/io/qfilesystemwatcher_polling_p.h b/src/corelib/io/qfilesystemwatcher_polling_p.h index 4c46633fdf..e60132381b 100644 --- a/src/corelib/io/qfilesystemwatcher_polling_p.h +++ b/src/corelib/io/qfilesystemwatcher_polling_p.h @@ -60,7 +60,7 @@ #include "qfilesystemwatcher_p.h" -#ifndef QT_NO_FILESYSTEMWATCHER +QT_REQUIRE_CONFIG(filesystemwatcher); QT_BEGIN_NAMESPACE enum { PollingInterval = 1000 }; @@ -121,6 +121,5 @@ private: }; QT_END_NAMESPACE -#endif // !QT_NO_FILESYSTEMWATCHER #endif // QFILESYSTEMWATCHER_POLLING_P_H diff --git a/src/corelib/io/qfilesystemwatcher_win.cpp b/src/corelib/io/qfilesystemwatcher_win.cpp index 91d0f7a228..66985f8982 100644 --- a/src/corelib/io/qfilesystemwatcher_win.cpp +++ b/src/corelib/io/qfilesystemwatcher_win.cpp @@ -40,8 +40,6 @@ #include "qfilesystemwatcher.h" #include "qfilesystemwatcher_win_p.h" -#ifndef QT_NO_FILESYSTEMWATCHER - #include #include #include @@ -760,5 +758,3 @@ QT_END_NAMESPACE #ifndef Q_OS_WINRT # include "qfilesystemwatcher_win.moc" #endif - -#endif // QT_NO_FILESYSTEMWATCHER diff --git a/src/corelib/io/qfilesystemwatcher_win_p.h b/src/corelib/io/qfilesystemwatcher_win_p.h index 8322fc170a..1d3224614c 100644 --- a/src/corelib/io/qfilesystemwatcher_win_p.h +++ b/src/corelib/io/qfilesystemwatcher_win_p.h @@ -53,8 +53,6 @@ #include "qfilesystemwatcher_p.h" -#ifndef QT_NO_FILESYSTEMWATCHER - #include #include #include @@ -175,6 +173,4 @@ Q_SIGNALS: QT_END_NAMESPACE -#endif // QT_NO_FILESYSTEMWATCHER - #endif // QFILESYSTEMWATCHER_WIN_P_H diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index c1b8f00b4a..19cc3e6402 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -545,23 +545,33 @@ QString QFSFileEngine::tempPath() return QFileSystemEngine::tempPath(); } +#if !defined(Q_OS_WINRT) +// cf QStorageInfo::isReady +static inline bool isDriveReady(const wchar_t *path) +{ + DWORD fileSystemFlags; + const UINT driveType = GetDriveType(path); + return (driveType != DRIVE_REMOVABLE && driveType != DRIVE_CDROM) + || GetVolumeInformation(path, nullptr, 0, nullptr, nullptr, + &fileSystemFlags, nullptr, 0) == TRUE; +} +#endif // !Q_OS_WINRT + QFileInfoList QFSFileEngine::drives() { QFileInfoList ret; #if !defined(Q_OS_WINRT) -# if defined(Q_OS_WIN32) const UINT oldErrorMode = ::SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); quint32 driveBits = (quint32) GetLogicalDrives() & 0x3ffffff; - ::SetErrorMode(oldErrorMode); -# endif - char driveName[] = "A:/"; + wchar_t driveName[] = L"A:\\"; while (driveBits) { - if (driveBits & 1) - ret.append(QFileInfo(QLatin1String(driveName))); + if ((driveBits & 1) && isDriveReady(driveName)) + ret.append(QFileInfo(QString::fromWCharArray(driveName))); driveName[0]++; driveBits = driveBits >> 1; } + ::SetErrorMode(oldErrorMode); return ret; #else // !Q_OS_WINRT ret.append(QFileInfo(QLatin1String("/"))); diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index e531505877..15785b48e0 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -3726,37 +3726,37 @@ bool QUrl::matches(const QUrl &url, FormattingOptions options) const if (isLocalFile()) mask &= ~QUrlPrivate::Host; - if (options & QUrl::RemoveScheme) + if (options.testFlag(QUrl::RemoveScheme)) mask &= ~QUrlPrivate::Scheme; else if (d->scheme != url.d->scheme) return false; - if (options & QUrl::RemovePassword) + if (options.testFlag(QUrl::RemovePassword)) mask &= ~QUrlPrivate::Password; else if (d->password != url.d->password) return false; - if (options & QUrl::RemoveUserInfo) + if (options.testFlag(QUrl::RemoveUserInfo)) mask &= ~QUrlPrivate::UserName; else if (d->userName != url.d->userName) return false; - if (options & QUrl::RemovePort) + if (options.testFlag(QUrl::RemovePort)) mask &= ~QUrlPrivate::Port; else if (d->port != url.d->port) return false; - if (options & QUrl::RemoveAuthority) + if (options.testFlag(QUrl::RemoveAuthority)) mask &= ~QUrlPrivate::Host; else if (d->host != url.d->host) return false; - if (options & QUrl::RemoveQuery) + if (options.testFlag(QUrl::RemoveQuery)) mask &= ~QUrlPrivate::Query; else if (d->query != url.d->query) return false; - if (options & QUrl::RemoveFragment) + if (options.testFlag(QUrl::RemoveFragment)) mask &= ~QUrlPrivate::Fragment; else if (d->fragment != url.d->fragment) return false; @@ -3764,7 +3764,7 @@ bool QUrl::matches(const QUrl &url, FormattingOptions options) const if ((d->sectionIsPresent & mask) != (url.d->sectionIsPresent & mask)) return false; - if (options & QUrl::RemovePath) + if (options.testFlag(QUrl::RemovePath)) return true; // Compare paths, after applying path-related options diff --git a/src/corelib/tools/qcommandlineparser.cpp b/src/corelib/tools/qcommandlineparser.cpp index 4c55880915..279d6565da 100644 --- a/src/corelib/tools/qcommandlineparser.cpp +++ b/src/corelib/tools/qcommandlineparser.cpp @@ -1049,7 +1049,11 @@ QString QCommandLineParser::helpText() const static QString wrapText(const QString &names, int longestOptionNameString, const QString &description) { const QLatin1Char nl('\n'); - QString text = QLatin1String(" ") + names.leftJustified(longestOptionNameString) + QLatin1Char(' '); + const QLatin1String indentation(" "); + if (description.isEmpty()) + return indentation + names + nl; + + QString text = indentation + names.leftJustified(longestOptionNameString) + QLatin1Char(' '); const int indent = text.length(); int lineStart = 0; int lastBreakable = -1; diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 9bf2a33e2a..34f453341f 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -84,6 +84,7 @@ #include "private/qcursor_p.h" #include "private/qopenglcontext_p.h" #include "private/qinputdevicemanager_p.h" +#include "private/qinputmethod_p.h" #include "private/qtouchdevice_p.h" #include @@ -4030,18 +4031,7 @@ void QGuiApplicationPrivate::_q_updateFocusObject(QObject *object) Q_Q(QGuiApplication); QPlatformInputContext *inputContext = platformIntegration()->inputContext(); - bool enabled = false; - if (object && inputContext) { - QInputMethodQueryEvent query(Qt::ImEnabled | Qt::ImHints); - QGuiApplication::sendEvent(object, &query); - enabled = query.value(Qt::ImEnabled).toBool(); - if (enabled) { - static const bool supportsHiddenText = inputContext->hasCapability(QPlatformInputContext::HiddenTextCapability); - const Qt::InputMethodHints hints = static_cast(query.value(Qt::ImHints).toInt()); - if ((hints & Qt::ImhHiddenText) && !supportsHiddenText) - enabled = false; - } - } + const bool enabled = inputContext && QInputMethodPrivate::objectAcceptsInputMethod(object); QPlatformInputContextPrivate::setInputMethodAccepted(enabled); if (inputContext) diff --git a/src/gui/kernel/qinputmethod.cpp b/src/gui/kernel/qinputmethod.cpp index 365b088840..a319529442 100644 --- a/src/gui/kernel/qinputmethod.cpp +++ b/src/gui/kernel/qinputmethod.cpp @@ -390,15 +390,29 @@ void QInputMethod::invokeAction(Action a, int cursorPosition) ic->invokeAction(a, cursorPosition); } +static inline bool platformSupportsHiddenText() +{ + const QPlatformInputContext *inputContext = QGuiApplicationPrivate::platformIntegration()->inputContext(); + return inputContext && inputContext->hasCapability(QPlatformInputContext::HiddenTextCapability); +} + bool QInputMethodPrivate::objectAcceptsInputMethod(QObject *object) { bool enabled = false; if (object) { - QInputMethodQueryEvent query(Qt::ImEnabled); + // If the platform does not support hidden text, query the hints + // in addition and disable in case of ImhHiddenText. + static const bool supportsHiddenText = platformSupportsHiddenText(); + QInputMethodQueryEvent query(supportsHiddenText + ? Qt::InputMethodQueries(Qt::ImEnabled) + : Qt::InputMethodQueries(Qt::ImEnabled | Qt::ImHints)); QGuiApplication::sendEvent(object, &query); enabled = query.value(Qt::ImEnabled).toBool(); + if (enabled && !supportsHiddenText + && Qt::InputMethodHints(query.value(Qt::ImHints).toInt()).testFlag(Qt::ImhHiddenText)) { + enabled = false; + } } - return enabled; } diff --git a/src/gui/kernel/qinputmethod_p.h b/src/gui/kernel/qinputmethod_p.h index 81723bbe30..0c2b739d92 100644 --- a/src/gui/kernel/qinputmethod_p.h +++ b/src/gui/kernel/qinputmethod_p.h @@ -80,7 +80,7 @@ public: void _q_connectFocusObject(); void _q_checkFocusObject(QObject *object); - bool objectAcceptsInputMethod(QObject *object); + static bool objectAcceptsInputMethod(QObject *object); QTransform inputItemTransform; QRectF inputRectangle; diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index ba02d13863..64501a75e8 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -712,7 +712,8 @@ void QSslSocketBackendPrivate::transmit() // Check if we've got any data to be written to the socket. QVarLengthArray data; int pendingBytes; - while (plainSocket->isValid() && (pendingBytes = q_BIO_pending(writeBio)) > 0) { + while (plainSocket->isValid() && (pendingBytes = q_BIO_pending(writeBio)) > 0 + && plainSocket->openMode() != QIODevice::NotOpen) { // Read encrypted data from the write BIO into a buffer. data.resize(pendingBytes); int encryptedBytesRead = q_BIO_read(writeBio, data.data(), pendingBytes); @@ -799,6 +800,10 @@ void QSslSocketBackendPrivate::transmit() int readBytes = 0; const int bytesToRead = 4096; do { + if (readChannelCount == 0) { + // The read buffer is deallocated, don't try resize or write to it. + break; + } // Don't use SSL_pending(). It's very unreliable. readBytes = q_SSL_read(ssl, buffer.reserve(bytesToRead), bytesToRead); if (readBytes > 0) { diff --git a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp index 0e587965ca..3a54f33832 100644 --- a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp +++ b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp @@ -112,7 +112,7 @@ QIBusPlatformInputContext::QIBusPlatformInputContext () QString socketPath = QIBusPlatformInputContextPrivate::getSocketPath(); QFile file(socketPath); if (file.open(QFile::ReadOnly)) { -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) qCDebug(qtQpaInputMethods) << "socketWatcher.addPath" << socketPath; // If KDE session save is used or restart ibus-daemon, // the applications could run before ibus-daemon runs. @@ -564,7 +564,7 @@ void QIBusPlatformInputContext::connectToBus() d->initBus(); connectToContextSignals(); -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) if (!d->usePortal && m_socketWatcher.files().size() == 0) m_socketWatcher.addPath(QIBusPlatformInputContextPrivate::getSocketPath()); #endif diff --git a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h index f37552b937..d4daea2eb3 100644 --- a/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h +++ b/src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h @@ -44,7 +44,9 @@ #include #include #include +#if QT_CONFIG(filesystemwatcher) #include +#endif #include #include @@ -116,7 +118,7 @@ public Q_SLOTS: private: QIBusPlatformInputContextPrivate *d; bool m_eventFilterUseSynchronousMode; -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) QFileSystemWatcher m_socketWatcher; #endif QTimer m_timer; diff --git a/src/plugins/platforms/ios/qiosmessagedialog.h b/src/plugins/platforms/ios/qiosmessagedialog.h index 92a4db8319..913fe0c2e9 100644 --- a/src/plugins/platforms/ios/qiosmessagedialog.h +++ b/src/plugins/platforms/ios/qiosmessagedialog.h @@ -63,6 +63,7 @@ private: UIAlertController *m_alertController; QString messageTextPlain(); UIAlertAction *createAction(StandardButton button); + UIAlertAction *createAction(const QMessageDialogOptions::CustomButton &customButton); }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/ios/qiosmessagedialog.mm b/src/plugins/platforms/ios/qiosmessagedialog.mm index a7de9b473a..254922701a 100644 --- a/src/plugins/platforms/ios/qiosmessagedialog.mm +++ b/src/plugins/platforms/ios/qiosmessagedialog.mm @@ -79,6 +79,18 @@ inline QString QIOSMessageDialog::messageTextPlain() return text; } +inline UIAlertAction *QIOSMessageDialog::createAction( + const QMessageDialogOptions::CustomButton &customButton) +{ + const QString label = QPlatformTheme::removeMnemonics(customButton.label); + const UIAlertActionStyle style = UIAlertActionStyleDefault; + + return [UIAlertAction actionWithTitle:label.toNSString() style:style handler:^(UIAlertAction *) { + hide(); + emit clicked(static_cast(customButton.id), customButton.role); + }]; +} + inline UIAlertAction *QIOSMessageDialog::createAction(StandardButton button) { const StandardButton labelButton = button == NoButton ? Ok : button; @@ -118,12 +130,18 @@ bool QIOSMessageDialog::show(Qt::WindowFlags windowFlags, Qt::WindowModality win message:messageTextPlain().toNSString() preferredStyle:UIAlertControllerStyleAlert] retain]; + const QVector customButtons = options()->customButtons(); + for (const QMessageDialogOptions::CustomButton &button : customButtons) { + UIAlertAction *act = createAction(button); + [m_alertController addAction:act]; + } + if (StandardButtons buttons = options()->standardButtons()) { for (int i = FirstButton; i < LastButton; i<<=1) { if (i & buttons) [m_alertController addAction:createAction(StandardButton(i))]; } - } else { + } else if (customButtons.isEmpty()) { // We need at least one button to allow the user close the dialog [m_alertController addAction:createAction(NoButton)]; } diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 48715e0812..6dda6487c8 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -654,34 +654,6 @@ QXcbConnection::QXcbConnection(xcb_connection_t *c, int primaryScreenNumber, if (!m_startupId.isNull()) qunsetenv("DESKTOP_STARTUP_ID"); - - QStringList glIntegrationNames; - glIntegrationNames << QStringLiteral("xcb_glx") << QStringLiteral("xcb_egl"); - QString glIntegrationName = QString::fromLocal8Bit(qgetenv("QT_XCB_GL_INTEGRATION")); - if (!glIntegrationName.isEmpty()) { - qCDebug(lcQpaGl) << "QT_XCB_GL_INTEGRATION is set to" << glIntegrationName; - if (glIntegrationName != QLatin1String("none")) { - glIntegrationNames.removeAll(glIntegrationName); - glIntegrationNames.prepend(glIntegrationName); - } else { - glIntegrationNames.clear(); - } - } - - if (!glIntegrationNames.isEmpty()) { - qCDebug(lcQpaGl) << "Choosing xcb gl-integration based on following priority\n" << glIntegrationNames; - for (int i = 0; i < glIntegrationNames.size() && !m_glIntegration; i++) { - m_glIntegration = QXcbGlIntegrationFactory::create(glIntegrationNames.at(i)); - if (m_glIntegration && !m_glIntegration->initialize(this)) { - qCDebug(lcQpaGl) << "Failed to initialize xcb gl-integration" << glIntegrationNames.at(i); - delete m_glIntegration; - m_glIntegration = nullptr; - } - } - if (!m_glIntegration) - qCDebug(lcQpaGl) << "Failed to create xcb gl-integration"; - } - sync(); } @@ -2304,6 +2276,42 @@ Qt::KeyboardModifiers QXcbConnection::queryKeyboardModifiers() const return keyboard()->translateModifiers(stateMask); } +QXcbGlIntegration *QXcbConnection::glIntegration() const +{ + if (m_glIntegrationInitialized) + return m_glIntegration; + + QStringList glIntegrationNames; + glIntegrationNames << QStringLiteral("xcb_glx") << QStringLiteral("xcb_egl"); + QString glIntegrationName = QString::fromLocal8Bit(qgetenv("QT_XCB_GL_INTEGRATION")); + if (!glIntegrationName.isEmpty()) { + qCDebug(lcQpaGl) << "QT_XCB_GL_INTEGRATION is set to" << glIntegrationName; + if (glIntegrationName != QLatin1String("none")) { + glIntegrationNames.removeAll(glIntegrationName); + glIntegrationNames.prepend(glIntegrationName); + } else { + glIntegrationNames.clear(); + } + } + + if (!glIntegrationNames.isEmpty()) { + qCDebug(lcQpaGl) << "Choosing xcb gl-integration based on following priority\n" << glIntegrationNames; + for (int i = 0; i < glIntegrationNames.size() && !m_glIntegration; i++) { + m_glIntegration = QXcbGlIntegrationFactory::create(glIntegrationNames.at(i)); + if (m_glIntegration && !m_glIntegration->initialize(const_cast(this))) { + qCDebug(lcQpaGl) << "Failed to initialize xcb gl-integration" << glIntegrationNames.at(i); + delete m_glIntegration; + m_glIntegration = nullptr; + } + } + if (!m_glIntegration) + qCDebug(lcQpaGl) << "Failed to create xcb gl-integration"; + } + + m_glIntegrationInitialized = true; + return m_glIntegration; +} + bool QXcbConnection::event(QEvent *e) { if (e->type() == QEvent::User + 1) { diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 94f8a8876a..1e28ef8fac 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -546,7 +546,7 @@ public: bool canGrab() const { return m_canGrabServer; } - QXcbGlIntegration *glIntegration() const { return m_glIntegration; } + QXcbGlIntegration *glIntegration() const; protected: bool event(QEvent *e) override; @@ -727,7 +727,8 @@ private: xcb_window_t m_clientLeader = 0; QByteArray m_startupId; QXcbSystemTrayTracker *m_systemTrayTracker = nullptr; - QXcbGlIntegration *m_glIntegration = nullptr; + mutable QXcbGlIntegration *m_glIntegration = nullptr; + mutable bool m_glIntegrationInitialized = false; bool m_xiGrab = false; QVector m_xiMasterPointerIds; diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 1ac5445035..9fc1189181 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -231,11 +231,11 @@ QPlatformPixmap *QXcbIntegration::createPlatformPixmap(QPlatformPixmap::PixelTyp QPlatformWindow *QXcbIntegration::createPlatformWindow(QWindow *window) const { - QXcbScreen *screen = static_cast(window->screen()->handle()); - QXcbGlIntegration *glIntegration = screen->connection()->glIntegration(); - const bool isTrayIconWindow = window->objectName() == QLatin1String("QSystemTrayIconSysWindow"); + QXcbGlIntegration *glIntegration = nullptr; + const bool isTrayIconWindow = QXcbWindow::isTrayIconWindow(window);; if (window->type() != Qt::Desktop && !isTrayIconWindow) { if (window->supportsOpenGL()) { + glIntegration = defaultConnection()->glIntegration(); if (glIntegration) { QXcbWindow *xcbWindow = glIntegration->createWindow(window); xcbWindow->create(); @@ -277,7 +277,7 @@ QPlatformOpenGLContext *QXcbIntegration::createPlatformOpenGLContext(QOpenGLCont QPlatformBackingStore *QXcbIntegration::createPlatformBackingStore(QWindow *window) const { - const bool isTrayIconWindow = window->objectName() == QLatin1String("QSystemTrayIconSysWindow"); + const bool isTrayIconWindow = QXcbWindow::isTrayIconWindow(window); if (isTrayIconWindow) return new QXcbSystemTrayBackingStore(window); diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 52c87ee8a4..69fc6c2951 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -297,7 +297,7 @@ void QXcbWindow::create() destroy(); m_windowState = Qt::WindowNoState; - m_trayIconWindow = window()->objectName() == QLatin1String("QSystemTrayIconSysWindow"); + m_trayIconWindow = isTrayIconWindow(window()); Qt::WindowType type = window()->type(); @@ -397,9 +397,12 @@ void QXcbWindow::create() | XCB_CW_SAVE_UNDER | XCB_CW_EVENT_MASK; - static const bool haveOpenGL = QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL); + static auto haveOpenGL = []() { + static const bool result = QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL); + return result; + }; - if ((window()->supportsOpenGL() && haveOpenGL) || m_format.hasAlpha()) { + if ((window()->supportsOpenGL() && haveOpenGL()) || m_format.hasAlpha()) { m_cmap = xcb_generate_id(xcb_connection()); xcb_create_colormap(xcb_connection(), XCB_COLORMAP_ALLOC_NONE, diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index 99e8e40725..f7d76ed3b2 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -173,7 +173,10 @@ public: bool startSystemMoveResize(const QPoint &pos, int corner); void doStartSystemMoveResize(const QPoint &globalPos, int corner); - bool isTrayIconWindow() const { return m_trayIconWindow; } + static bool isTrayIconWindow(QWindow *window) + { + return window->objectName() == QLatin1String("QSystemTrayIconSysWindow"); + } virtual void create(); virtual void destroy(); diff --git a/src/widgets/dialogs/qfileinfogatherer.cpp b/src/widgets/dialogs/qfileinfogatherer.cpp index aef13a563f..1e03ad8b06 100644 --- a/src/widgets/dialogs/qfileinfogatherer.cpp +++ b/src/widgets/dialogs/qfileinfogatherer.cpp @@ -80,7 +80,7 @@ static QString translateDriveName(const QFileInfo &drive) */ QFileInfoGatherer::QFileInfoGatherer(QObject *parent) : QThread(parent), abort(false), -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) watcher(0), #endif #ifdef Q_OS_WIN @@ -88,7 +88,7 @@ QFileInfoGatherer::QFileInfoGatherer(QObject *parent) #endif m_iconProvider(&defaultProvider) { -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) watcher = new QFileSystemWatcher(this); connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(list(QString))); connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(updateFile(QString))); @@ -179,7 +179,7 @@ void QFileInfoGatherer::fetchExtendedInformation(const QString &path, const QStr this->files.push(files); condition.wakeAll(); -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) if (files.isEmpty() && !path.isEmpty() && !path.startsWith(QLatin1String("//")) /*don't watch UNC path*/) { @@ -208,7 +208,7 @@ void QFileInfoGatherer::updateFile(const QString &filePath) */ void QFileInfoGatherer::clear() { -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) QMutexLocker locker(&mutex); watcher->removePaths(watcher->files()); watcher->removePaths(watcher->directories()); @@ -222,7 +222,7 @@ void QFileInfoGatherer::clear() */ void QFileInfoGatherer::removePath(const QString &path) { -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) QMutexLocker locker(&mutex); watcher->removePath(path); #else @@ -266,7 +266,7 @@ QExtendedInformation QFileInfoGatherer::getInfo(const QFileInfo &fileInfo) const QExtendedInformation info(fileInfo); info.icon = m_iconProvider->icon(fileInfo); info.displayType = m_iconProvider->type(fileInfo); -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) // ### Not ready to listen all modifications by default static const bool watchFiles = qEnvironmentVariableIsSet("QT_FILESYSTEMMODEL_WATCH_FILES"); if (watchFiles) { @@ -280,7 +280,7 @@ QExtendedInformation QFileInfoGatherer::getInfo(const QFileInfo &fileInfo) const } } } -#endif +#endif // filesystemwatcher #ifdef Q_OS_WIN if (m_resolveSymlinks && info.isSymLink(/* ignoreNtfsSymLinks = */ true)) { diff --git a/src/widgets/dialogs/qfileinfogatherer_p.h b/src/widgets/dialogs/qfileinfogatherer_p.h index cc82f42850..134a14b7ce 100644 --- a/src/widgets/dialogs/qfileinfogatherer_p.h +++ b/src/widgets/dialogs/qfileinfogatherer_p.h @@ -56,7 +56,9 @@ #include #include #include +#if QT_CONFIG(filesystemwatcher) #include +#endif #include #include #include @@ -207,7 +209,7 @@ private: // end protected by mutex QAtomicInt abort; -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) QFileSystemWatcher *watcher; #endif #ifdef Q_OS_WIN diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp index e54fdc97d4..8b3549c3f5 100644 --- a/src/widgets/dialogs/qfilesystemmodel.cpp +++ b/src/widgets/dialogs/qfilesystemmodel.cpp @@ -475,7 +475,7 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS return const_cast(&root); QFileSystemModelPrivate *p = const_cast(this); node = p->addNode(parent, element,info); -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) node->populate(fileInfoGatherer.getInfo(info)); #endif } else { @@ -513,7 +513,7 @@ void QFileSystemModel::timerEvent(QTimerEvent *event) Q_D(QFileSystemModel); if (event->timerId() == d->fetchingTimer.timerId()) { d->fetchingTimer.stop(); -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) for (int i = 0; i < d->toFetch.count(); ++i) { const QFileSystemModelPrivate::QFileSystemNode *node = d->toFetch.at(i).node; if (!node->hasInformation()) { @@ -661,7 +661,7 @@ void QFileSystemModel::fetchMore(const QModelIndex &parent) if (indexNode->populatedChildren) return; indexNode->populatedChildren = true; -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) d->fileInfoGatherer.list(filePath(parent)); #endif } @@ -697,13 +697,13 @@ int QFileSystemModel::columnCount(const QModelIndex &parent) const */ QVariant QFileSystemModel::myComputer(int role) const { -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) Q_D(const QFileSystemModel); #endif switch (role) { case Qt::DisplayRole: return QFileSystemModelPrivate::myComputer(); -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) case Qt::DecorationRole: return d->fileInfoGatherer.iconProvider()->icon(QFileIconProvider::Computer); #endif @@ -740,14 +740,14 @@ QVariant QFileSystemModel::data(const QModelIndex &index, int role) const case Qt::DecorationRole: if (index.column() == 0) { QIcon icon = d->icon(index); -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) if (icon.isNull()) { if (d->node(index)->isDir()) icon = d->fileInfoGatherer.iconProvider()->icon(QFileIconProvider::Folder); else icon = d->fileInfoGatherer.iconProvider()->icon(QFileIconProvider::File); } -#endif // QT_NO_FILESYSTEMWATCHER +#endif // filesystemwatcher return icon; } break; @@ -824,7 +824,7 @@ QString QFileSystemModelPrivate::name(const QModelIndex &index) const return QString(); QFileSystemNode *dirNode = node(index); if ( -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) fileInfoGatherer.resolveSymlinks() && #endif !resolvedSymLinks.isEmpty() && dirNode->isSymLink(/* ignoreNtfsSymLinks = */ true)) { @@ -926,7 +926,7 @@ bool QFileSystemModel::setData(const QModelIndex &idx, const QVariant &value, in QScopedPointer nodeToRename(parentNode->children.take(oldName)); nodeToRename->fileName = newName; nodeToRename->parent = parentNode; -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) nodeToRename->populate(d->fileInfoGatherer.getInfo(QFileInfo(parentPath, newName))); #endif nodeToRename->isVisible = true; @@ -1277,7 +1277,7 @@ QString QFileSystemModel::filePath(const QModelIndex &index) const QString fullPath = d->filePath(index); QFileSystemModelPrivate::QFileSystemNode *dirNode = d->node(index); if (dirNode->isSymLink() -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) && d->fileInfoGatherer.resolveSymlinks() #endif && d->resolvedSymLinks.contains(fullPath) @@ -1333,7 +1333,7 @@ QModelIndex QFileSystemModel::mkdir(const QModelIndex &parent, const QString &na d->addNode(parentNode, name, QFileInfo()); Q_ASSERT(parentNode->children.contains(name)); QFileSystemModelPrivate::QFileSystemNode *node = parentNode->children[name]; -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) node->populate(d->fileInfoGatherer.getInfo(QFileInfo(dir.absolutePath() + QDir::separator() + name))); #endif d->addVisibleFiles(parentNode, QStringList(name)); @@ -1397,7 +1397,7 @@ QModelIndex QFileSystemModel::setRootPath(const QString &newPath) //We remove the watcher on the previous path if (!rootPath().isEmpty() && rootPath() != QLatin1String(".")) { //This remove the watcher for the old rootPath -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) d->fileInfoGatherer.removePath(rootPath()); #endif //This line "marks" the node as dirty, so the next fetchMore @@ -1453,7 +1453,7 @@ QDir QFileSystemModel::rootDirectory() const void QFileSystemModel::setIconProvider(QFileIconProvider *provider) { Q_D(QFileSystemModel); -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) d->fileInfoGatherer.setIconProvider(provider); #endif d->root.updateIcon(provider, QString()); @@ -1464,7 +1464,7 @@ void QFileSystemModel::setIconProvider(QFileIconProvider *provider) */ QFileIconProvider *QFileSystemModel::iconProvider() const { -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) Q_D(const QFileSystemModel); return d->fileInfoGatherer.iconProvider(); #else @@ -1516,7 +1516,7 @@ QDir::Filters QFileSystemModel::filter() const */ void QFileSystemModel::setResolveSymlinks(bool enable) { -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) Q_D(QFileSystemModel); d->fileInfoGatherer.setResolveSymlinks(enable); #else @@ -1526,7 +1526,7 @@ void QFileSystemModel::setResolveSymlinks(bool enable) bool QFileSystemModel::resolveSymlinks() const { -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) Q_D(const QFileSystemModel); return d->fileInfoGatherer.resolveSymlinks(); #else @@ -1628,7 +1628,7 @@ QStringList QFileSystemModel::nameFilters() const */ bool QFileSystemModel::event(QEvent *event) { -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) Q_D(QFileSystemModel); if (event->type() == QEvent::LanguageChange) { d->root.retranslateStrings(d->fileInfoGatherer.iconProvider(), QString()); @@ -1642,7 +1642,7 @@ bool QFileSystemModel::rmdir(const QModelIndex &aindex) { QString path = filePath(aindex); const bool success = QDir().rmdir(path); -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) if (success) { QFileSystemModelPrivate * d = const_cast(d_func()); d->fileInfoGatherer.removePath(path); @@ -1685,7 +1685,7 @@ QFileSystemModelPrivate::QFileSystemNode* QFileSystemModelPrivate::addNode(QFile { // In the common case, itemLocation == count() so check there first QFileSystemModelPrivate::QFileSystemNode *node = new QFileSystemModelPrivate::QFileSystemNode(fileName, parentNode); -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) node->populate(info); #else Q_UNUSED(info) @@ -1793,7 +1793,7 @@ void QFileSystemModelPrivate::removeVisibleFile(QFileSystemNode *parentNode, int */ void QFileSystemModelPrivate::_q_fileSystemChanged(const QString &path, const QVector > &updates) { -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) Q_Q(QFileSystemModel); QVector rowsToUpdate; QStringList newFiles; @@ -1889,7 +1889,7 @@ void QFileSystemModelPrivate::_q_fileSystemChanged(const QString &path, const QV #else Q_UNUSED(path) Q_UNUSED(updates) -#endif // !QT_NO_FILESYSTEMWATCHER +#endif // filesystemwatcher } /*! @@ -1947,7 +1947,7 @@ void QFileSystemModelPrivate::init() { Q_Q(QFileSystemModel); qRegisterMetaType > >(); -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) q->connect(&fileInfoGatherer, SIGNAL(newListOfFiles(QString,QStringList)), q, SLOT(_q_directoryChanged(QString,QStringList))); q->connect(&fileInfoGatherer, SIGNAL(updates(QString,QVector >)), @@ -1956,7 +1956,7 @@ void QFileSystemModelPrivate::init() q, SLOT(_q_resolvedName(QString,QString))); q->connect(&fileInfoGatherer, SIGNAL(directoryLoaded(QString)), q, SIGNAL(directoryLoaded(QString))); -#endif // !QT_NO_FILESYSTEMWATCHER +#endif // filesystemwatcher q->connect(&delayedSortTimer, SIGNAL(timeout()), q, SLOT(_q_performDelayedSort()), Qt::QueuedConnection); roleNames.insertMulti(QFileSystemModel::FileIconRole, QByteArrayLiteral("fileIcon")); // == Qt::decoration diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index c9f72da060..41a21e6086 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -1075,7 +1075,7 @@ void QMessageBoxPrivate::detectEscapeButton() or 0 if the user hit the \uicontrol Esc key and no \l{setEscapeButton()}{escape button} was set. - If exec() hasn't been called yet, returns 0. + If exec() hasn't been called yet, returns nullptr. Example: @@ -1093,7 +1093,7 @@ QAbstractButton *QMessageBox::clickedButton() const \since 4.2 Returns the button that should be the message box's - \l{QPushButton::setDefault()}{default button}. Returns 0 + \l{QPushButton::setDefault()}{default button}. Returns nullptr if no default button was set. \sa addButton(), QPushButton::setDefault() @@ -2745,7 +2745,7 @@ QPixmap QMessageBox::standardIcon(Icon icon) Shows the message box as a \l{QDialog#Modal Dialogs}{modal dialog}, blocking until the user closes it. - When using a QMessageBox with standard buttons, this functions returns a + When using a QMessageBox with standard buttons, this function returns a \l StandardButton value indicating the standard button that was clicked. When using QMessageBox with custom buttons, this function returns an opaque value; use clickedButton() to determine which button was clicked. diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp index 84cb78a474..0b2eee7180 100644 --- a/src/widgets/widgets/qdockwidget.cpp +++ b/src/widgets/widgets/qdockwidget.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -166,6 +167,10 @@ static inline bool isWindowsStyle(const QStyle *style) if (style->inherits("QStyleSheetStyle")) effectiveStyle = static_cast(style)->baseStyle(); #endif +#if !defined(QT_NO_STYLE_PROXY) + if (style->inherits("QProxyStyle")) + effectiveStyle = static_cast(style)->baseStyle(); +#endif return effectiveStyle->inherits("QWindowsStyle"); } diff --git a/tests/auto/corelib/io/io.pro b/tests/auto/corelib/io/io.pro index 5eab944fe4..3c93fd5e1f 100644 --- a/tests/auto/corelib/io/io.pro +++ b/tests/auto/corelib/io/io.pro @@ -55,6 +55,9 @@ SUBDIRS=\ win32:!qtConfig(private_tests): SUBDIRS -= \ qfilesystementry +!qtConfig(filesystemwatcher): SUBDIRS -= \ + qfilesystemwatcher + !qtConfig(processenvironment): SUBDIRS -= \ qprocessenvironment diff --git a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp index 72cad92edb..67ffa91e57 100644 --- a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp +++ b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp @@ -45,7 +45,6 @@ class tst_QFileSystemWatcher : public QObject public: tst_QFileSystemWatcher(); -#ifndef QT_NO_FILESYSTEMWATCHER private slots: void basicTest_data(); void basicTest(); @@ -77,24 +76,20 @@ private slots: private: QString m_tempDirPattern; -#endif // QT_NO_FILESYSTEMWATCHER }; tst_QFileSystemWatcher::tst_QFileSystemWatcher() { -#ifndef QT_NO_FILESYSTEMWATCHER m_tempDirPattern = QDir::tempPath(); if (!m_tempDirPattern.endsWith(QLatin1Char('/'))) m_tempDirPattern += QLatin1Char('/'); m_tempDirPattern += QStringLiteral("tst_qfilesystemwatcherXXXXXX"); -#endif // QT_NO_FILESYSTEMWATCHER #if defined(Q_OS_ANDROID) && !defined(Q_OS_ANDROID_EMBEDDED) QDir::setCurrent(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)); #endif } -#ifndef QT_NO_FILESYSTEMWATCHER void tst_QFileSystemWatcher::basicTest_data() { QTest::addColumn("backend"); @@ -805,7 +800,6 @@ void tst_QFileSystemWatcher::watchUnicodeCharacters() QVERIFY(testDir.mkdir("creme")); QTRY_COMPARE(changedSpy.count(), 1); } -#endif // QT_NO_FILESYSTEMWATCHER QTEST_MAIN(tst_QFileSystemWatcher) #include "tst_qfilesystemwatcher.moc" diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index 1aa8984b70..84af1c255a 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -4143,6 +4143,18 @@ void tst_QUrl::matches_data() << "http://user:pass@www.website.com/directory" << "http://otheruser:otherpass@www.website.com/directory" << uint(QUrl::RemovePath | QUrl::RemoveAuthority) << true; + QTest::newRow("matchingHost-removePort") << "http://example.com" << "http://example.com" + << uint(QUrl::RemovePort) << true; + QTest::newRow("nonMatchingHost-removePort") << "http://example.com" << "http://example.net" + << uint(QUrl::RemovePort) << false; + QTest::newRow("matchingHost-removePassword") << "http://example.com" << "http://example.com" + << uint(QUrl::RemovePassword) << true; + QTest::newRow("nonMatchingHost-removePassword") << "http://example.com" << "http://example.net" + << uint(QUrl::RemovePassword) << false; + QTest::newRow("matchingUserName-removePassword") << "http://user@example.com" << "http://user@example.com" + << uint(QUrl::RemovePassword) << true; + QTest::newRow("nonMatchingUserName-removePassword") << "http://user@example.com" << "http://user2@example.com" + << uint(QUrl::RemovePassword) << false; } void tst_QUrl::matches() diff --git a/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp b/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp index 30c7b1bf69..b9bcecd607 100644 --- a/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp +++ b/tests/auto/corelib/tools/qcommandlineparser/testhelper/qcommandlineparser_test_helper.cpp @@ -53,6 +53,7 @@ int main(int argc, char *argv[]) parser.addOption(QCommandLineOption("load", "Load file from URL.", "url")); parser.addOption(QCommandLineOption(QStringList() << "o" << "output", "Set output file.", "file")); parser.addOption(QCommandLineOption("D", "Define macro.", "key=value")); + parser.addOption(QCommandLineOption("long-option")); // An option with a longer description, to test wrapping QCommandLineOption noImplicitIncludesOption(QStringList() << QStringLiteral("n") << QStringLiteral("no-implicit-includes")); diff --git a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp index ce3bdc2d9d..62c29229e1 100644 --- a/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp +++ b/tests/auto/corelib/tools/qcommandlineparser/tst_qcommandlineparser.cpp @@ -536,6 +536,7 @@ static const char expectedOptionsHelp[] = " --load Load file from URL.\n" " -o, --output Set output file.\n" " -D Define macro.\n" + " --long-option\n" " -n, --no-implicit-includes Disable magic generation of implicit\n" " #include-directives.\n" " --newline This is an option with a rather long\n" diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp index 67e46ad1b3..d2a244b762 100644 --- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp +++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp @@ -2249,7 +2249,7 @@ Q_GLOBAL_STATIC(QLocale, tst_qapp_locale); #if QT_CONFIG(process) Q_GLOBAL_STATIC(QProcess, tst_qapp_process); #endif -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) Q_GLOBAL_STATIC(QFileSystemWatcher, tst_qapp_fileSystemWatcher); #endif #ifndef QT_NO_SHAREDMEMORY @@ -2274,7 +2274,7 @@ void tst_QApplication::globalStaticObjectDestruction() #if QT_CONFIG(process) QVERIFY(tst_qapp_process()); #endif -#ifndef QT_NO_FILESYSTEMWATCHER +#if QT_CONFIG(filesystemwatcher) QVERIFY(tst_qapp_fileSystemWatcher()); #endif #ifndef QT_NO_SHAREDMEMORY