diff options
Diffstat (limited to 'src/corelib')
70 files changed, 327 insertions, 120 deletions
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp index 8c189e9288..2041b8816e 100644 --- a/src/corelib/animation/qabstractanimation.cpp +++ b/src/corelib/animation/qabstractanimation.cpp @@ -1484,5 +1484,6 @@ void QAbstractAnimation::updateDirection(QAbstractAnimation::Direction direction QT_END_NAMESPACE #include "moc_qabstractanimation.cpp" +#include "moc_qabstractanimation_p.cpp" #endif //QT_NO_ANIMATION diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h index 5fc7ac9c7e..173ada89de 100644 --- a/src/corelib/global/qcompilerdetection.h +++ b/src/corelib/global/qcompilerdetection.h @@ -1345,7 +1345,7 @@ #endif #endif #ifndef Q_FALLTHROUGH -# if defined(Q_CC_GNU) && Q_CC_GNU >= 700 +# if (defined(Q_CC_GNU) && Q_CC_GNU >= 700) && !defined(Q_CC_INTEL) # define Q_FALLTHROUGH() __attribute__((fallthrough)) # else # define Q_FALLTHROUGH() (void)0 diff --git a/src/corelib/global/qconfig-bootstrapped.h b/src/corelib/global/qconfig-bootstrapped.h index 5b8fee630a..374b53a9b5 100644 --- a/src/corelib/global/qconfig-bootstrapped.h +++ b/src/corelib/global/qconfig-bootstrapped.h @@ -68,6 +68,13 @@ #define QT_CRYPTOGRAPHICHASH_ONLY_SHA1 #define QT_NO_DATASTREAM +#define QT_FEATURE_alloca 1 +#define QT_FEATURE_alloca_h -1 +#ifdef _WIN32 +# define QT_FEATURE_alloca_malloc_h 1 +#else +# define QT_FEATURE_alloca_malloc_h -1 +#endif #define QT_FEATURE_iconv -1 #define QT_FEATURE_icu -1 #define QT_FEATURE_journald -1 diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index bb944c4d8e..ea9d207177 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -4035,8 +4035,10 @@ bool QInternal::registerCallback(Callback cb, qInternalCallback callback) bool QInternal::unregisterCallback(Callback cb, qInternalCallback callback) { if (cb >= 0 && cb < QInternal::LastCallback) { - QInternal_CallBackTable *cbt = global_callback_table(); - return (bool) cbt->callbacks[cb].removeAll(callback); + if (global_callback_table.exists()) { + QInternal_CallBackTable *cbt = global_callback_table(); + return (bool) cbt->callbacks[cb].removeAll(callback); + } } return false; } diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 51dad31bba..cfc6ef8b16 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -465,7 +465,7 @@ using qssize_t = QIntegerForSizeof<std::size_t>::Signed; #endif #ifdef QT_ASCII_CAST_WARNINGS -# define QT_ASCII_CAST_WARN Q_DECL_DEPRECATED +# define QT_ASCII_CAST_WARN Q_DECL_DEPRECATED_X("Use fromUtf8, QStringLiteral, or QLatin1String") #else # define QT_ASCII_CAST_WARN #endif diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index cb78732526..a52f0de9f0 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -1226,7 +1226,7 @@ void QMessagePattern::setPattern(const QString &pattern) // make sure the function has "Message" in the name so the function is removed #if ((defined(Q_CC_GNU) && defined(QT_COMPILER_SUPPORTS_SIMD_ALWAYS)) || QT_HAS_ATTRIBUTE(optimize)) \ - && !defined(Q_CC_INTEL) + && !defined(Q_CC_INTEL) && !defined(Q_CC_CLANG) // force skipping the frame pointer, to save the backtrace() function some work __attribute__((optimize("omit-frame-pointer"))) #endif diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 65ed11c651..89847e4b51 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -208,7 +208,7 @@ \value AA_SetPalette Indicates whether a palette was explicitly set on the QApplication/QGuiApplication. This value has been added in Qt 5.5. - \value AA_EnableHighDpiScaling. Enables high-DPI scaling in Qt on supported + \value AA_EnableHighDpiScaling Enables high-DPI scaling in Qt on supported platforms (see also \l{High DPI Displays}). Supported platforms are X11, Windows and Android. Enabling makes Qt scale the main (device independent) coordinate system according to display scale factors diff --git a/src/corelib/global/qsysinfo.h b/src/corelib/global/qsysinfo.h index f443ab4b93..6b73a17dc5 100644 --- a/src/corelib/global/qsysinfo.h +++ b/src/corelib/global/qsysinfo.h @@ -211,11 +211,7 @@ public: }; QT_WARNING_PUSH -QT_WARNING_DISABLE_GCC("-Wdeprecated-declarations") -QT_WARNING_DISABLE_CLANG("-Wdeprecated-declarations") -QT_WARNING_DISABLE_INTEL(1478) -QT_WARNING_DISABLE_INTEL(1786) -QT_WARNING_DISABLE_MSVC(4996) +QT_WARNING_DISABLE_DEPRECATED #if defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) QT_SYSINFO_DEPRECATED_X("Use QOperatingSystemVersion::current()") static const WinVersion WindowsVersion; QT_SYSINFO_DEPRECATED_X("Use QOperatingSystemVersion::current()") static WinVersion windowsVersion(); diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp index c19cb92715..ddd343b515 100644 --- a/src/corelib/io/qfile.cpp +++ b/src/corelib/io/qfile.cpp @@ -1113,3 +1113,7 @@ qint64 QFile::size() const } QT_END_NAMESPACE + +#ifndef QT_NO_QOBJECT +#include "moc_qfile.cpp" +#endif diff --git a/src/corelib/io/qfiledevice.cpp b/src/corelib/io/qfiledevice.cpp index 9e2e3fe741..8533602d63 100644 --- a/src/corelib/io/qfiledevice.cpp +++ b/src/corelib/io/qfiledevice.cpp @@ -815,3 +815,7 @@ bool QFileDevice::setFileTime(const QDateTime &newDate, QFileDevice::FileTime fi } QT_END_NAMESPACE + +#ifndef QT_NO_QOBJECT +#include "moc_qfiledevice.cpp" +#endif diff --git a/src/corelib/io/qfilesystemwatcher.cpp b/src/corelib/io/qfilesystemwatcher.cpp index 612b3fa57c..ed597c415b 100644 --- a/src/corelib/io/qfilesystemwatcher.cpp +++ b/src/corelib/io/qfilesystemwatcher.cpp @@ -497,6 +497,7 @@ QStringList QFileSystemWatcher::files() const QT_END_NAMESPACE #include "moc_qfilesystemwatcher.cpp" +#include "moc_qfilesystemwatcher_p.cpp" #endif // QT_NO_FILESYSTEMWATCHER diff --git a/src/corelib/io/qfilesystemwatcher_inotify.cpp b/src/corelib/io/qfilesystemwatcher_inotify.cpp index 5564bc7dca..3cfc6a254f 100644 --- a/src/corelib/io/qfilesystemwatcher_inotify.cpp +++ b/src/corelib/io/qfilesystemwatcher_inotify.cpp @@ -417,4 +417,6 @@ 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_polling.cpp b/src/corelib/io/qfilesystemwatcher_polling.cpp index cbcb68e7d2..5bef8127f7 100644 --- a/src/corelib/io/qfilesystemwatcher_polling.cpp +++ b/src/corelib/io/qfilesystemwatcher_polling.cpp @@ -151,4 +151,7 @@ void QPollingFileSystemWatcherEngine::timeout() } QT_END_NAMESPACE + +#include "moc_qfilesystemwatcher_polling_p.cpp" + #endif // !QT_NO_FILESYSTEMWATCHER diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp index 41a4d7a1ba..80122eac5e 100644 --- a/src/corelib/io/qiodevice.cpp +++ b/src/corelib/io/qiodevice.cpp @@ -2059,3 +2059,7 @@ QDebug operator<<(QDebug debug, QIODevice::OpenMode modes) #endif QT_END_NAMESPACE + +#ifndef QT_NO_QOBJECT +#include "moc_qiodevice.cpp" +#endif diff --git a/src/corelib/io/qloggingregistry.cpp b/src/corelib/io/qloggingregistry.cpp index 47fb1fb6b8..0e7eaeea76 100644 --- a/src/corelib/io/qloggingregistry.cpp +++ b/src/corelib/io/qloggingregistry.cpp @@ -317,13 +317,12 @@ void QLoggingRegistry::init() const QMutexLocker locker(®istryMutex); - envRules = std::move(er); - qtConfigRules = std::move(qr); - configRules = std::move(cr); + ruleSets[EnvironmentRules] = std::move(er); + ruleSets[QtConfigRules] = std::move(qr); + ruleSets[ConfigRules] = std::move(cr); - if (!envRules.isEmpty() || !qtConfigRules.isEmpty() || !configRules.isEmpty()) { + if (!ruleSets[EnvironmentRules].isEmpty() || !ruleSets[QtConfigRules].isEmpty() || !ruleSets[ConfigRules].isEmpty()) updateRules(); - } } /*! @@ -367,7 +366,7 @@ void QLoggingRegistry::setApiRules(const QString &content) const QMutexLocker locker(®istryMutex); - apiRules = parser.rules(); + ruleSets[ApiRules] = parser.rules(); updateRules(); } @@ -380,13 +379,6 @@ void QLoggingRegistry::setApiRules(const QString &content) */ void QLoggingRegistry::updateRules() { - rules.clear(); - rules.reserve(qtConfigRules.size() + configRules.size() + apiRules.size() + envRules.size()), - rules += qtConfigRules; - rules += configRules; - rules += apiRules; - rules += envRules; - for (auto it = categories.keyBegin(), end = categories.keyEnd(); it != end; ++it) (*categoryFilter)(*it); } @@ -406,8 +398,7 @@ QLoggingRegistry::installFilter(QLoggingCategory::CategoryFilter filter) QLoggingCategory::CategoryFilter old = categoryFilter; categoryFilter = filter; - for (auto it = categories.keyBegin(), end = categories.keyEnd(); it != end; ++it) - (*categoryFilter)(*it); + updateRules(); return old; } @@ -446,19 +437,22 @@ void QLoggingRegistry::defaultCategoryFilter(QLoggingCategory *cat) } QString categoryName = QLatin1String(cat->categoryName()); - for (const QLoggingRule &item : reg->rules) { - int filterpass = item.pass(categoryName, QtDebugMsg); - if (filterpass != 0) - debug = (filterpass > 0); - filterpass = item.pass(categoryName, QtInfoMsg); - if (filterpass != 0) - info = (filterpass > 0); - filterpass = item.pass(categoryName, QtWarningMsg); - if (filterpass != 0) - warning = (filterpass > 0); - filterpass = item.pass(categoryName, QtCriticalMsg); - if (filterpass != 0) - critical = (filterpass > 0); + + for (const auto &ruleSet : reg->ruleSets) { + for (const auto &rule : ruleSet) { + int filterpass = rule.pass(categoryName, QtDebugMsg); + if (filterpass != 0) + debug = (filterpass > 0); + filterpass = rule.pass(categoryName, QtInfoMsg); + if (filterpass != 0) + info = (filterpass > 0); + filterpass = rule.pass(categoryName, QtWarningMsg); + if (filterpass != 0) + warning = (filterpass > 0); + filterpass = rule.pass(categoryName, QtCriticalMsg); + if (filterpass != 0) + critical = (filterpass > 0); + } } cat->setEnabled(QtDebugMsg, debug); diff --git a/src/corelib/io/qloggingregistry_p.h b/src/corelib/io/qloggingregistry_p.h index 69fc6ea4ec..a68b993cca 100644 --- a/src/corelib/io/qloggingregistry_p.h +++ b/src/corelib/io/qloggingregistry_p.h @@ -130,14 +130,20 @@ private: static void defaultCategoryFilter(QLoggingCategory *category); + enum RuleSet { + // sorted by order in which defaultCategoryFilter considers them: + QtConfigRules, + ConfigRules, + ApiRules, + EnvironmentRules, + + NumRuleSets + }; + QMutex registryMutex; // protected by mutex: - QVector<QLoggingRule> qtConfigRules; - QVector<QLoggingRule> configRules; - QVector<QLoggingRule> envRules; - QVector<QLoggingRule> apiRules; - QVector<QLoggingRule> rules; + QVector<QLoggingRule> ruleSets[NumRuleSets]; QHash<QLoggingCategory*,QtMsgType> categories; QLoggingCategory::CategoryFilter categoryFilter; diff --git a/src/corelib/io/qnoncontiguousbytedevice.cpp b/src/corelib/io/qnoncontiguousbytedevice.cpp index 61299b8aa8..beca6ccbf7 100644 --- a/src/corelib/io/qnoncontiguousbytedevice.cpp +++ b/src/corelib/io/qnoncontiguousbytedevice.cpp @@ -578,3 +578,4 @@ QIODevice* QNonContiguousByteDeviceFactory::wrap(QNonContiguousByteDevice* byteD QT_END_NAMESPACE +#include "moc_qnoncontiguousbytedevice_p.cpp" diff --git a/src/corelib/io/qsavefile.cpp b/src/corelib/io/qsavefile.cpp index d8166014db..0283c5f31f 100644 --- a/src/corelib/io/qsavefile.cpp +++ b/src/corelib/io/qsavefile.cpp @@ -412,4 +412,8 @@ bool QSaveFile::directWriteFallback() const QT_END_NAMESPACE +#ifndef QT_NO_QOBJECT +#include "moc_qsavefile.cpp" +#endif + #endif // QT_NO_TEMPORARYFILE diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 24fa00c4d9..850e729987 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -3515,4 +3515,8 @@ QSettings::Format QSettings::registerFormat(const QString &extension, ReadFunc r QT_END_NAMESPACE +#ifndef QT_BOOTSTRAPPED +#include "moc_qsettings.cpp" +#endif + #endif // QT_NO_SETTINGS diff --git a/src/corelib/io/qstandardpaths.cpp b/src/corelib/io/qstandardpaths.cpp index 4cf3a3e9bd..f2368c3b23 100644 --- a/src/corelib/io/qstandardpaths.cpp +++ b/src/corelib/io/qstandardpaths.cpp @@ -645,4 +645,8 @@ bool QStandardPaths::isTestModeEnabled() QT_END_NAMESPACE +#ifndef QT_NO_QOBJECT +#include "moc_qstandardpaths.cpp" +#endif + #endif // QT_NO_STANDARDPATHS diff --git a/src/corelib/io/qtemporarydir.cpp b/src/corelib/io/qtemporarydir.cpp index b2bf9fce97..ffaee9c683 100644 --- a/src/corelib/io/qtemporarydir.cpp +++ b/src/corelib/io/qtemporarydir.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2017 The Qt Company Ltd. ** Copyright (C) 2016 Intel Corporation. ** Contact: https://www.qt.io/licensing/ ** @@ -198,10 +198,10 @@ void QTemporaryDirPrivate::create(const QString &templateName) \ingroup io - QTemporaryDir is used to create unique temporary dirs safely. - The dir itself is created by the constructor. The name of the + QTemporaryDir is used to create unique temporary directories safely. + The directory itself is created by the constructor. The name of the temporary directory is guaranteed to be unique (i.e., you are - guaranteed to not overwrite an existing dir), and the directory will + guaranteed to not overwrite an existing directory), and the directory will subsequently be removed upon destruction of the QTemporaryDir object. The directory name is either auto-generated, or created based on a template, which is passed to QTemporaryDir's constructor. @@ -214,7 +214,7 @@ void QTemporaryDirPrivate::create(const QString &templateName) created, using isValid(). Do not use \l {QDir::exists()}{exists()}, since a default-constructed QDir represents the current directory, which exists. - The path to the temporary dir can be found by calling path(). + The path to the temporary directory can be found by calling path(). A temporary directory will have some static part of the name and some part that is calculated to be unique. The default path will be diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index 7aae128796..8a99873fee 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -796,4 +796,6 @@ QT_END_NAMESPACE #endif // QT_NO_TEMPORARYFILE - +#ifndef QT_NO_QOBJECT +#include "moc_qtemporaryfile.cpp" +#endif diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp index 76664a4ade..ee3cb4efcb 100644 --- a/src/corelib/io/qtextstream.cpp +++ b/src/corelib/io/qtextstream.cpp @@ -3187,3 +3187,6 @@ QLocale QTextStream::locale() const QT_END_NAMESPACE +#ifndef QT_NO_QOBJECT +#include "moc_qtextstream_p.cpp" +#endif diff --git a/src/corelib/io/qurlidna.cpp b/src/corelib/io/qurlidna.cpp index 16bb924b17..226bc8ba28 100644 --- a/src/corelib/io/qurlidna.cpp +++ b/src/corelib/io/qurlidna.cpp @@ -2120,31 +2120,52 @@ Q_AUTOTEST_EXPORT void qt_nameprep(QString *source, int from) } } -Q_AUTOTEST_EXPORT bool qt_check_std3rules(const QChar *uc, int len) +static const QChar *qt_find_nonstd3(const QChar *uc, int len, Qt::CaseSensitivity cs) { if (len > 63) - return false; + return uc; for (int i = 0; i < len; ++i) { ushort c = uc[i].unicode(); if (c == '-' && (i == 0 || i == len - 1)) - return false; + return uc + i; // verifying the absence of non-LDH is the same as verifying that // only LDH is present + if (cs == Qt::CaseInsensitive && (c >= 'A' && c <= 'Z')) + continue; if (c == '-' || (c >= '0' && c <= '9') - || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') //underscore is not supposed to be allowed, but other browser accept it (QTBUG-7434) || c == '_') continue; - return false; + return uc + i; } - return true; + return nullptr; +} + +Q_AUTOTEST_EXPORT bool qt_check_std3rules(const QChar *uc, int len) +{ + return qt_find_nonstd3(uc, len, Qt::CaseInsensitive) == nullptr; } +static bool qt_check_nameprepped_std3(const QChar *in, int len) +{ + // fast path: check for lowercase ASCII + const QChar *firstNonAscii = qt_find_nonstd3(in, len, Qt::CaseSensitive); + if (firstNonAscii == nullptr) { + // everything was lowercase ASCII, digits or hyphen + return true; + } + + const QChar *e = in + len; + QString origin = QString::fromRawData(firstNonAscii, e - firstNonAscii); + QString copy = origin; + qt_nameprep(©, 0); + return origin == copy; +} static inline uint encodeDigit(uint digit) { @@ -2422,8 +2443,8 @@ static bool qt_is_idn_enabled(const QString &domain) return false; int len = domain.size() - idx - 1; - QString tldString(domain.constData() + idx + 1, len); - qt_nameprep(&tldString, 0); + QString tldString = qt_ACE_do(QString::fromRawData(domain.constData() + idx + 1, len), ToAceOnly, ForbidLeadingDot); + len = tldString.size(); const QChar *tld = tldString.constData(); @@ -2546,13 +2567,19 @@ QString qt_ACE_do(const QString &domain, AceOperation op, AceLeadingDot dot) qt_punycodeEncoder(result.constData() + prevLen, result.size() - prevLen, &aceForm); // We use resize()+memcpy() here because we're overwriting the data we've copied + bool appended = false; if (isIdnEnabled) { QString tmp = qt_punycodeDecoder(aceForm); if (tmp.isEmpty()) return QString(); // shouldn't happen, since we've just punycode-encoded it - result.resize(prevLen + tmp.size()); - memcpy(result.data() + prevLen, tmp.constData(), tmp.size() * sizeof(QChar)); - } else { + if (qt_check_nameprepped_std3(tmp.constData(), tmp.size())) { + result.resize(prevLen + tmp.size()); + memcpy(result.data() + prevLen, tmp.constData(), tmp.size() * sizeof(QChar)); + appended = true; + } + } + + if (!appended) { result.resize(prevLen + aceForm.size()); memcpy(result.data() + prevLen, aceForm.constData(), aceForm.size() * sizeof(QChar)); } diff --git a/src/corelib/io/qwindowspipereader.cpp b/src/corelib/io/qwindowspipereader.cpp index 8bd8af3f34..b68e9e6d4b 100644 --- a/src/corelib/io/qwindowspipereader.cpp +++ b/src/corelib/io/qwindowspipereader.cpp @@ -206,13 +206,13 @@ void QWindowsPipeReader::notified(DWORD errorCode, DWORD numberOfBytesRead) void QWindowsPipeReader::startAsyncRead() { const DWORD minReadBufferSize = 4096; - DWORD bytesToRead = qMax(checkPipeState(), minReadBufferSize); + qint64 bytesToRead = qMax(checkPipeState(), minReadBufferSize); if (pipeBroken) return; if (readBufferMaxSize && bytesToRead > (readBufferMaxSize - readBuffer.size())) { bytesToRead = readBufferMaxSize - readBuffer.size(); - if (bytesToRead == 0) { + if (bytesToRead <= 0) { // Buffer is full. User must read data from the buffer // before we can read more from the pipe. return; diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp index 0c87dd5659..c0737ffb36 100644 --- a/src/corelib/itemmodels/qabstractitemmodel.cpp +++ b/src/corelib/itemmodels/qabstractitemmodel.cpp @@ -3804,3 +3804,5 @@ void QAbstractItemModelPrivate::Persistent::insertMultiAtEnd(const QModelIndex& } QT_END_NAMESPACE + +#include "moc_qabstractitemmodel.cpp" diff --git a/src/corelib/itemmodels/qstringlistmodel.cpp b/src/corelib/itemmodels/qstringlistmodel.cpp index da232cc142..bcfd88fb19 100644 --- a/src/corelib/itemmodels/qstringlistmodel.cpp +++ b/src/corelib/itemmodels/qstringlistmodel.cpp @@ -328,4 +328,6 @@ Qt::DropActions QStringListModel::supportedDropActions() const QT_END_NAMESPACE +#include "moc_qstringlistmodel.cpp" + #endif // QT_NO_STRINGLISTMODEL diff --git a/src/corelib/kernel/qabstracteventdispatcher.cpp b/src/corelib/kernel/qabstracteventdispatcher.cpp index 907b3ccf1f..d234949d14 100644 --- a/src/corelib/kernel/qabstracteventdispatcher.cpp +++ b/src/corelib/kernel/qabstracteventdispatcher.cpp @@ -320,9 +320,10 @@ int QAbstractEventDispatcher::registerTimer(int interval, Qt::TimerType timerTyp */ /*! \fn void QAbstractEventDispatcher::flush() + \deprecated - Flushes the event queue. This normally returns almost - immediately. Does nothing on platforms other than X11. + Depending from the event dispatcher implementation does nothing or + calls QApplication::sendPostedEvents(). */ // ### DOC: Are these called when the _application_ starts/stops or just @@ -520,3 +521,5 @@ bool QAbstractEventDispatcher::filterNativeEvent(const QByteArray &eventType, vo */ QT_END_NAMESPACE + +#include "moc_qabstracteventdispatcher.cpp" diff --git a/src/corelib/kernel/qabstracteventdispatcher.h b/src/corelib/kernel/qabstracteventdispatcher.h index 961148d9ec..3a530cf1de 100644 --- a/src/corelib/kernel/qabstracteventdispatcher.h +++ b/src/corelib/kernel/qabstracteventdispatcher.h @@ -102,7 +102,7 @@ public: virtual void wakeUp() = 0; virtual void interrupt() = 0; - virtual void flush() = 0; + virtual void flush() = 0; // ### Qt6: remove, mark final or make protected virtual void startingUp(); virtual void closingDown(); diff --git a/src/corelib/kernel/qcfsocketnotifier.cpp b/src/corelib/kernel/qcfsocketnotifier.cpp index a079031e96..1fee2aa5fc 100644 --- a/src/corelib/kernel/qcfsocketnotifier.cpp +++ b/src/corelib/kernel/qcfsocketnotifier.cpp @@ -292,10 +292,19 @@ void QCFSocketNotifier::enableSocketNotifiers(CFRunLoopObserverRef ref, CFRunLoo continue; } - if (!socketInfo->readNotifier) + // Apple docs say: "If a callback is automatically re-enabled, + // it is called every time the condition becomes true ... If a + // callback is not automatically re-enabled, then it gets called + // exactly once, and is not called again until you manually + // re-enable that callback by calling CFSocketEnableCallBacks()". + // So, we don't need to enable callbacks on registering. + socketInfo->readEnabled = (socketInfo->readNotifier != nullptr); + if (!socketInfo->readEnabled) CFSocketDisableCallBacks(socketInfo->socket, kCFSocketReadCallBack); - if (!socketInfo->writeNotifier) + socketInfo->writeEnabled = (socketInfo->writeNotifier != nullptr); + if (!socketInfo->writeEnabled) CFSocketDisableCallBacks(socketInfo->socket, kCFSocketWriteCallBack); + continue; } if (socketInfo->readNotifier && !socketInfo->readEnabled) { diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index e4b1562b8b..39e7c71a9c 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -634,9 +634,9 @@ void QCoreApplicationPrivate::initLocale() Several static convenience functions are also provided. The QCoreApplication object is available from instance(). Events can - be sent or posted using sendEvent(), postEvent(), and - sendPostedEvents(). Pending events can be removed with - removePostedEvents() or flushed with flush(). + be sent with sendEvent() or posted to an event queue with postEvent(). + Pending events can be removed with removePostedEvents() or dispatched + with sendPostedEvents(). The class provides a quit() slot and an aboutToQuit() signal. @@ -705,22 +705,23 @@ QCoreApplication::QCoreApplication(QCoreApplicationPrivate &p) #ifndef QT_NO_QOBJECT /*! - Flushes the platform-specific event queues. + \deprecated + This function is equivalent to calling \c {QCoreApplication::eventDispatcher()->flush()}, + which also is deprecated, see QAbstractEventDispatcher::flush(). Use sendPostedEvents() + and processEvents() for more fine-grained control of the event loop instead. - If you are doing graphical changes inside a loop that does not - return to the event loop on asynchronous window systems like X11 - or double buffered window systems like Quartz (\macos and iOS), and you want to - visualize these changes immediately (e.g. Splash Screens), call - this function. + Historically this functions was used to flush the platform-specific native event queues. - \sa sendPostedEvents() + \sa sendPostedEvents(), processEvents(), QAbstractEventDispatcher::flush() */ +#if QT_DEPRECATED_SINCE(5, 9) void QCoreApplication::flush() { if (self && self->d_func()->eventDispatcher) self->d_func()->eventDispatcher->flush(); } #endif +#endif /*! Constructs a Qt core application. Core applications are applications without @@ -757,6 +758,10 @@ QCoreApplication::QCoreApplication(int &argc, char **argv void QCoreApplicationPrivate::init() { +#if defined(Q_OS_MACOS) + QMacAutoReleasePool pool; +#endif + Q_Q(QCoreApplication); initLocale(); @@ -2909,3 +2914,7 @@ void QCoreApplication::setEventDispatcher(QAbstractEventDispatcher *eventDispatc */ QT_END_NAMESPACE + +#ifndef QT_NO_QOBJECT +#include "moc_qcoreapplication.cpp" +#endif diff --git a/src/corelib/kernel/qcoreapplication.h b/src/corelib/kernel/qcoreapplication.h index 5e10136dc5..0fee7b3de8 100644 --- a/src/corelib/kernel/qcoreapplication.h +++ b/src/corelib/kernel/qcoreapplication.h @@ -165,7 +165,9 @@ public: #endif #ifndef QT_NO_QOBJECT - static void flush(); +# if QT_DEPRECATED_SINCE(5, 9) + QT_DEPRECATED static void flush(); +# endif void installNativeEventFilter(QAbstractNativeEventFilter *filterObj); void removeNativeEventFilter(QAbstractNativeEventFilter *filterObj); diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp index 4efc38ac89..e90cd842ab 100644 --- a/src/corelib/kernel/qcoreevent.cpp +++ b/src/corelib/kernel/qcoreevent.cpp @@ -652,3 +652,5 @@ QDeferredDeleteEvent::~QDeferredDeleteEvent() */ QT_END_NAMESPACE + +#include "moc_qcoreevent.cpp" diff --git a/src/corelib/kernel/qeventdispatcher_glib.cpp b/src/corelib/kernel/qeventdispatcher_glib.cpp index 8ca2ac1c39..8cefa7a118 100644 --- a/src/corelib/kernel/qeventdispatcher_glib.cpp +++ b/src/corelib/kernel/qeventdispatcher_glib.cpp @@ -611,3 +611,5 @@ QEventDispatcherGlib::QEventDispatcherGlib(QEventDispatcherGlibPrivate &dd, QObj } QT_END_NAMESPACE + +#include "moc_qeventdispatcher_glib_p.cpp" diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp index 802962d77d..a28f2e3f0a 100644 --- a/src/corelib/kernel/qeventdispatcher_unix.cpp +++ b/src/corelib/kernel/qeventdispatcher_unix.cpp @@ -553,3 +553,5 @@ void QEventDispatcherUNIX::flush() { } QT_END_NAMESPACE + +#include "moc_qeventdispatcher_unix_p.cpp" diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index 74fa2d8d50..40db5020ab 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -177,15 +177,24 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA QSNDict *dict = sn_vec[type]; QSockNot *sn = dict ? dict->value(wp) : 0; - if (sn) { - d->doWsaAsyncSelect(sn->fd, 0); - d->active_fd[sn->fd].selected = false; + if (sn == nullptr) { d->postActivateSocketNotifiers(); - if (type < 3) { - QEvent event(QEvent::SockAct); - QCoreApplication::sendEvent(sn->obj, &event); - } else { - QEvent event(QEvent::SockClose); + } else { + Q_ASSERT(d->active_fd.contains(sn->fd)); + QSockFd &sd = d->active_fd[sn->fd]; + if (sd.selected) { + Q_ASSERT(sd.mask == 0); + d->doWsaAsyncSelect(sn->fd, 0); + sd.selected = false; + } + d->postActivateSocketNotifiers(); + + // Ignore the message if a notification with the same type was + // received previously. Suppressed message is definitely spurious. + const long eventCode = WSAGETSELECTEVENT(lp); + if ((sd.mask & eventCode) != eventCode) { + sd.mask |= eventCode; + QEvent event(type < 3 ? QEvent::SockAct : QEvent::SockClose); QCoreApplication::sendEvent(sn->obj, &event); } } @@ -194,13 +203,22 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA } else if (message == WM_QT_ACTIVATENOTIFIERS) { Q_ASSERT(d != 0); - // register all socket notifiers - for (QSFDict::iterator it = d->active_fd.begin(), end = d->active_fd.end(); - it != end; ++it) { - QSockFd &sd = it.value(); - if (!sd.selected) { - d->doWsaAsyncSelect(it.key(), sd.event); - sd.selected = true; + // Postpone activation if we have unhandled socket notifier messages + // in the queue. WM_QT_ACTIVATENOTIFIERS will be posted again as a result of + // event processing. + MSG msg; + if (!PeekMessage(&msg, 0, WM_QT_SOCKETNOTIFIER, WM_QT_SOCKETNOTIFIER, PM_NOREMOVE) + && d->queuedSocketEvents.isEmpty()) { + // register all socket notifiers + for (QSFDict::iterator it = d->active_fd.begin(), end = d->active_fd.end(); + it != end; ++it) { + QSockFd &sd = it.value(); + if (!sd.selected) { + d->doWsaAsyncSelect(it.key(), sd.event); + // allow any event to be accepted + sd.mask = 0; + sd.selected = true; + } } } d->activateNotifiersPosted = false; @@ -706,7 +724,9 @@ void QEventDispatcherWin32::registerSocketNotifier(QSocketNotifier *notifier) } sd.event |= event; } else { - d->active_fd.insert(sockfd, QSockFd(event)); + // Disable the events which could be implicitly re-enabled. Next activation + // of socket notifiers will reset the mask. + d->active_fd.insert(sockfd, QSockFd(event, FD_READ | FD_ACCEPT | FD_WRITE | FD_OOB)); } d->postActivateSocketNotifiers(); diff --git a/src/corelib/kernel/qeventdispatcher_win_p.h b/src/corelib/kernel/qeventdispatcher_win_p.h index 423dc5b169..f6d1bffdf5 100644 --- a/src/corelib/kernel/qeventdispatcher_win_p.h +++ b/src/corelib/kernel/qeventdispatcher_win_p.h @@ -126,9 +126,10 @@ typedef QHash<int, QSockNot *> QSNDict; struct QSockFd { long event; + long mask; bool selected; - explicit inline QSockFd(long ev = 0) : event(ev), selected(false) { } + explicit inline QSockFd(long ev = 0, long ma = 0) : event(ev), mask(ma), selected(false) { } }; typedef QHash<int, QSockFd> QSFDict; diff --git a/src/corelib/kernel/qeventloop.cpp b/src/corelib/kernel/qeventloop.cpp index e4b819d9d2..8974ff7709 100644 --- a/src/corelib/kernel/qeventloop.cpp +++ b/src/corelib/kernel/qeventloop.cpp @@ -441,3 +441,5 @@ QEventLoopLocker::~QEventLoopLocker() } QT_END_NAMESPACE + +#include "moc_qeventloop.cpp" diff --git a/src/corelib/kernel/qjnionload.cpp b/src/corelib/kernel/qjnionload.cpp index c936bf42fd..8f60800dba 100644 --- a/src/corelib/kernel/qjnionload.cpp +++ b/src/corelib/kernel/qjnionload.cpp @@ -39,6 +39,10 @@ #include <jni.h> #include "qjnihelpers_p.h" +#include <android/log.h> + +static const char logTag[] = "QtCore"; + Q_CORE_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) { @@ -54,16 +58,24 @@ Q_CORE_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) void *venv; } _JNIEnv; + __android_log_print(ANDROID_LOG_INFO, logTag, "Start"); + _JNIEnv uenv; uenv.venv = Q_NULLPTR; if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_6) != JNI_OK) + { + __android_log_print(ANDROID_LOG_FATAL, logTag, "GetEnv failed"); return JNI_ERR; + } JNIEnv *env = uenv.nenv; const jint ret = QT_PREPEND_NAMESPACE(QtAndroidPrivate::initJNI(vm, env)); if (ret != 0) + { + __android_log_print(ANDROID_LOG_FATAL, logTag, "initJNI failed"); return ret; + } return JNI_VERSION_1_6; } diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index 68ee2bb241..cdc605d33b 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -2324,12 +2324,10 @@ bool QMetaMethod::invoke(QObject *object, for (int i = 1; i < paramCount; ++i) { types[i] = QMetaType::type(typeNames[i]); - if (types[i] != QMetaType::UnknownType) { - args[i] = QMetaType::create(types[i], param[i]); - ++nargs; - } else if (param[i]) { + if (types[i] == QMetaType::UnknownType && param[i]) { // Try to register the type and try again before reporting an error. - void *argv[] = { &types[i], &i }; + int index = nargs - 1; + void *argv[] = { &types[i], &index }; QMetaObject::metacall(object, QMetaObject::RegisterMethodArgumentMetaType, idx_relative + idx_offset, argv); if (types[i] == -1) { @@ -2344,6 +2342,10 @@ bool QMetaMethod::invoke(QObject *object, return false; } } + if (types[i] != QMetaType::UnknownType) { + args[i] = QMetaType::create(types[i], param[i]); + ++nargs; + } } QCoreApplication::postEvent(object, new QMetaCallEvent(idx_offset, idx_relative, callFunction, diff --git a/src/corelib/kernel/qmimedata.cpp b/src/corelib/kernel/qmimedata.cpp index a550ca6ca1..73307e925a 100644 --- a/src/corelib/kernel/qmimedata.cpp +++ b/src/corelib/kernel/qmimedata.cpp @@ -678,3 +678,5 @@ void QMimeData::removeFormat(const QString &mimeType) } QT_END_NAMESPACE + +#include "moc_qmimedata.cpp" diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 24ad9d140c..3b0f7ead09 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -4292,7 +4292,7 @@ QDebug operator<<(QDebug dbg, const QObject *o) This macro registers an enum type with the meta-object system. It must be placed after the enum declaration in a class that has the Q_OBJECT or the - Q_GADGET macro. For namespaces use \l Q_ENUM_NS instead. + Q_GADGET macro. For namespaces use \l Q_ENUM_NS() instead. For example: @@ -4319,7 +4319,7 @@ QDebug operator<<(QDebug dbg, const QObject *o) This macro registers a single \l{QFlags}{flags type} with the meta-object system. It is typically used in a class definition to declare that values of a given enum can be used as flags and combined using the - bitwise OR operator. For namespaces use \l Q_FLAG_NS instead. + bitwise OR operator. For namespaces use \l Q_FLAG_NS() instead. The macro must be placed after the enum declaration. @@ -4340,6 +4340,7 @@ QDebug operator<<(QDebug dbg, const QObject *o) /*! \macro Q_ENUM_NS(...) + \relates QObject \since 5.8 This macro registers an enum type with the meta-object system. @@ -4363,6 +4364,7 @@ QDebug operator<<(QDebug dbg, const QObject *o) /*! \macro Q_FLAG_NS(...) + \relates QObject \since 5.8 This macro registers a single \l{QFlags}{flags type} with the @@ -5079,4 +5081,5 @@ bool QMetaObject::Connection::isConnected_helper() const QT_END_NAMESPACE +#include "moc_qnamespace.cpp" #include "moc_qobject.cpp" diff --git a/src/corelib/kernel/qobjectcleanuphandler.cpp b/src/corelib/kernel/qobjectcleanuphandler.cpp index f3d23c4b44..b6c62af4b3 100644 --- a/src/corelib/kernel/qobjectcleanuphandler.cpp +++ b/src/corelib/kernel/qobjectcleanuphandler.cpp @@ -145,3 +145,5 @@ void QObjectCleanupHandler::objectDestroyed(QObject *object) } QT_END_NAMESPACE + +#include "moc_qobjectcleanuphandler.cpp" diff --git a/src/corelib/kernel/qobjectdefs_impl.h b/src/corelib/kernel/qobjectdefs_impl.h index 876742ab6c..da356095af 100644 --- a/src/corelib/kernel/qobjectdefs_impl.h +++ b/src/corelib/kernel/qobjectdefs_impl.h @@ -300,7 +300,7 @@ namespace QtPrivate { static const typename RemoveRef<A1>::Type &dummy(); enum { value = sizeof(test(dummy())) == sizeof(int) }; #ifdef QT_NO_NARROWING_CONVERSIONS_IN_CONNECT - struct AreArgumentsNarrowed : AreArgumentsNarrowedBase<typename RemoveRef<A1>::Type, typename RemoveRef<A2>::Type> {}; + using AreArgumentsNarrowed = AreArgumentsNarrowedBase<typename RemoveRef<A1>::Type, typename RemoveRef<A2>::Type>; Q_STATIC_ASSERT_X(!AreArgumentsNarrowed::value, "Signal and slot arguments are not compatible (narrowing)"); #endif }; diff --git a/src/corelib/kernel/qsharedmemory.cpp b/src/corelib/kernel/qsharedmemory.cpp index 29b3e87076..7f185ee9dc 100644 --- a/src/corelib/kernel/qsharedmemory.cpp +++ b/src/corelib/kernel/qsharedmemory.cpp @@ -598,3 +598,5 @@ QString QSharedMemory::errorString() const #endif // QT_NO_SHAREDMEMORY QT_END_NAMESPACE + +#include "moc_qsharedmemory.cpp" diff --git a/src/corelib/kernel/qsocketnotifier.cpp b/src/corelib/kernel/qsocketnotifier.cpp index 933eac19ab..2268cb83bb 100644 --- a/src/corelib/kernel/qsocketnotifier.cpp +++ b/src/corelib/kernel/qsocketnotifier.cpp @@ -270,3 +270,5 @@ bool QSocketNotifier::event(QEvent *e) } QT_END_NAMESPACE + +#include "moc_qsocketnotifier.cpp" diff --git a/src/corelib/kernel/qtimer.cpp b/src/corelib/kernel/qtimer.cpp index 4a5738a6dc..55f75ab17e 100644 --- a/src/corelib/kernel/qtimer.cpp +++ b/src/corelib/kernel/qtimer.cpp @@ -148,6 +148,7 @@ static const int INV_TIMER = -1; // invalid timer id QTimer::QTimer(QObject *parent) : QObject(parent), id(INV_TIMER), inter(0), del(0), single(0), nulltimer(0), type(Qt::CoarseTimer) { + Q_UNUSED(del); // ### Qt 6: remove field } @@ -669,3 +670,4 @@ int QTimer::remainingTime() const QT_END_NAMESPACE #include "qtimer.moc" +#include "moc_qtimer.cpp" diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp index 04a5e7ed7a..2232e24a25 100644 --- a/src/corelib/kernel/qtranslator.cpp +++ b/src/corelib/kernel/qtranslator.cpp @@ -1143,4 +1143,6 @@ bool QTranslator::isEmpty() const QT_END_NAMESPACE +#include "moc_qtranslator.cpp" + #endif // QT_NO_TRANSLATION diff --git a/src/corelib/plugin/qfactoryloader.cpp b/src/corelib/plugin/qfactoryloader.cpp index 05f9c68a7b..0cc193c325 100644 --- a/src/corelib/plugin/qfactoryloader.cpp +++ b/src/corelib/plugin/qfactoryloader.cpp @@ -346,4 +346,6 @@ int QFactoryLoader::indexOf(const QString &needle) const QT_END_NAMESPACE +#include "moc_qfactoryloader_p.cpp" + #endif // QT_NO_QOBJECT diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp index 6421e7c5d8..3d04d0802d 100644 --- a/src/corelib/plugin/qlibrary.cpp +++ b/src/corelib/plugin/qlibrary.cpp @@ -1129,3 +1129,5 @@ bool qt_debug_component() } QT_END_NAMESPACE + +#include "moc_qlibrary.cpp" diff --git a/src/corelib/plugin/qpluginloader.cpp b/src/corelib/plugin/qpluginloader.cpp index dbd3bee556..aab00cc7eb 100644 --- a/src/corelib/plugin/qpluginloader.cpp +++ b/src/corelib/plugin/qpluginloader.cpp @@ -479,3 +479,4 @@ QJsonObject QStaticPlugin::metaData() const QT_END_NAMESPACE +#include "moc_qpluginloader.cpp" diff --git a/src/corelib/statemachine/qabstractstate.cpp b/src/corelib/statemachine/qabstractstate.cpp index 13bf41faa9..1a9ad4601d 100644 --- a/src/corelib/statemachine/qabstractstate.cpp +++ b/src/corelib/statemachine/qabstractstate.cpp @@ -234,3 +234,5 @@ bool QAbstractState::event(QEvent *e) } QT_END_NAMESPACE + +#include "moc_qabstractstate.cpp" diff --git a/src/corelib/statemachine/qabstracttransition.cpp b/src/corelib/statemachine/qabstracttransition.cpp index 8c30d5f11c..53c713d6a8 100644 --- a/src/corelib/statemachine/qabstracttransition.cpp +++ b/src/corelib/statemachine/qabstracttransition.cpp @@ -431,3 +431,5 @@ bool QAbstractTransition::event(QEvent *e) } QT_END_NAMESPACE + +#include "moc_qabstracttransition.cpp" diff --git a/src/corelib/statemachine/qeventtransition.cpp b/src/corelib/statemachine/qeventtransition.cpp index cd0cfe2f85..a90f147773 100644 --- a/src/corelib/statemachine/qeventtransition.cpp +++ b/src/corelib/statemachine/qeventtransition.cpp @@ -252,3 +252,5 @@ bool QEventTransition::event(QEvent *e) } QT_END_NAMESPACE + +#include "moc_qeventtransition.cpp" diff --git a/src/corelib/statemachine/qfinalstate.cpp b/src/corelib/statemachine/qfinalstate.cpp index bef9fc4239..d8bfd30974 100644 --- a/src/corelib/statemachine/qfinalstate.cpp +++ b/src/corelib/statemachine/qfinalstate.cpp @@ -137,3 +137,5 @@ bool QFinalState::event(QEvent *e) } QT_END_NAMESPACE + +#include "moc_qfinalstate.cpp" diff --git a/src/corelib/statemachine/qhistorystate.cpp b/src/corelib/statemachine/qhistorystate.cpp index b1c5a92d00..a179d7c75b 100644 --- a/src/corelib/statemachine/qhistorystate.cpp +++ b/src/corelib/statemachine/qhistorystate.cpp @@ -310,3 +310,6 @@ bool QHistoryState::event(QEvent *e) */ QT_END_NAMESPACE + +#include "moc_qhistorystate.cpp" +#include "moc_qhistorystate_p.cpp" diff --git a/src/corelib/statemachine/qsignaltransition.cpp b/src/corelib/statemachine/qsignaltransition.cpp index 3b219bda53..c05b4617b2 100644 --- a/src/corelib/statemachine/qsignaltransition.cpp +++ b/src/corelib/statemachine/qsignaltransition.cpp @@ -284,3 +284,5 @@ void QSignalTransitionPrivate::callOnTransition(QEvent *e) QT_END_NAMESPACE + +#include "moc_qsignaltransition.cpp" diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp index 48456424cf..76dcbf784b 100644 --- a/src/corelib/statemachine/qstate.cpp +++ b/src/corelib/statemachine/qstate.cpp @@ -599,3 +599,5 @@ bool QState::event(QEvent *e) */ QT_END_NAMESPACE + +#include "moc_qstate.cpp" diff --git a/src/corelib/thread/qfuturewatcher.cpp b/src/corelib/thread/qfuturewatcher.cpp index aa6f00c317..d2ec18850f 100644 --- a/src/corelib/thread/qfuturewatcher.cpp +++ b/src/corelib/thread/qfuturewatcher.cpp @@ -592,4 +592,6 @@ void QFutureWatcherBasePrivate::sendCallOutEvent(QFutureCallOutEvent *event) QT_END_NAMESPACE +#include "moc_qfuturewatcher.cpp" + #endif // QT_NO_QFUTURE diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index c42e120978..b662475003 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -946,3 +946,5 @@ QDaemonThread::~QDaemonThread() } QT_END_NAMESPACE + +#include "moc_qthread.cpp" diff --git a/src/corelib/thread/qthreadpool.cpp b/src/corelib/thread/qthreadpool.cpp index e45aaec103..f3ce1f258f 100644 --- a/src/corelib/thread/qthreadpool.cpp +++ b/src/corelib/thread/qthreadpool.cpp @@ -679,4 +679,6 @@ void QThreadPool::cancel(QRunnable *runnable) QT_END_NAMESPACE +#include "moc_qthreadpool.cpp" + #endif diff --git a/src/corelib/tools/qcryptographichash.cpp b/src/corelib/tools/qcryptographichash.cpp index 963a91b9a9..5410adc737 100644 --- a/src/corelib/tools/qcryptographichash.cpp +++ b/src/corelib/tools/qcryptographichash.cpp @@ -494,3 +494,7 @@ QByteArray QCryptographicHash::hash(const QByteArray &data, Algorithm method) } QT_END_NAMESPACE + +#ifndef QT_NO_QOBJECT +#include "moc_qcryptographichash.cpp" +#endif diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp index 4b5f5e7830..03bb1a1411 100644 --- a/src/corelib/tools/qeasingcurve.cpp +++ b/src/corelib/tools/qeasingcurve.cpp @@ -1501,3 +1501,5 @@ QDataStream &operator>>(QDataStream &stream, QEasingCurve &easing) #endif // QT_NO_DATASTREAM QT_END_NAMESPACE + +#include "moc_qeasingcurve.cpp" diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index 353dc834aa..59aab32347 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -2609,7 +2609,7 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW /*! \fn QMultiHash::QMultiHash(std::initializer_list<std::pair<Key,T> > list) \since 5.1 - Constructs a multi hash with a copy of each of the elements in the + Constructs a multi-hash with a copy of each of the elements in the initializer list \a list. This function is only available if the program is being diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index bcaaec0ec6..8689243a98 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -51,6 +51,8 @@ #include <initializer_list> #endif +#include <algorithm> + #if defined(Q_CC_MSVC) #pragma warning( push ) #pragma warning( disable : 4311 ) // disable pointer truncation warning @@ -945,18 +947,24 @@ Q_OUTOFLINE_TEMPLATE bool QHash<Key, T>::operator==(const QHash &other) const const_iterator it = begin(); while (it != end()) { - const Key &akey = it.key(); + // Build two equal ranges for i.key(); one for *this and one for other. + // For *this we can avoid a lookup via equal_range, as we know the beginning of the range. + auto thisEqualRangeEnd = it; + while (thisEqualRangeEnd != end() && it.key() == thisEqualRangeEnd.key()) + ++thisEqualRangeEnd; - const_iterator it2 = other.find(akey); - do { - if (it2 == other.end() || !(it2.key() == akey)) - return false; - if (!(it.value() == it2.value())) - return false; - ++it; - ++it2; - } while (it != end() && it.key() == akey); + const auto otherEqualRange = other.equal_range(it.key()); + + if (std::distance(it, thisEqualRangeEnd) != std::distance(otherEqualRange.first, otherEqualRange.second)) + return false; + + // Keys in the ranges are equal by construction; this checks only the values. + if (!std::is_permutation(it, thisEqualRangeEnd, otherEqualRange.first)) + return false; + + it = thisEqualRangeEnd; } + return true; } diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index 0a573e77dc..5557b5af2d 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -3226,14 +3226,18 @@ QString QLocaleData::unsLongLongToString(const QChar zero, const QChar group, int base, int width, unsigned flags) { + const QChar resultZero = base == 10 ? zero : QChar(QLatin1Char('0')); + QString num_str = l ? qulltoa(l, base, zero) : QString(resultZero); + bool precision_not_specified = false; if (precision == -1) { + if (flags == NoFlags) + return num_str; // fast-path: nothing below applies, so we're done. + precision_not_specified = true; precision = 1; } - QString num_str = qulltoa(l, base, zero); - uint cnt_thousand_sep = 0; if (flags & ThousandsGroup && base == 10) { for (int i = num_str.length() - 3; i > 0; i -=3) { @@ -3242,7 +3246,6 @@ QString QLocaleData::unsLongLongToString(const QChar zero, const QChar group, } } - const QChar resultZero = base == 10 ? zero : QChar(QLatin1Char('0')); const int zeroPadding = precision - num_str.length()/* + cnt_thousand_sep*/; if (zeroPadding > 0) num_str.prepend(QString(zeroPadding, resultZero)); @@ -3873,3 +3876,7 @@ QDebug operator<<(QDebug dbg, const QLocale &l) } #endif QT_END_NAMESPACE + +#ifndef QT_NO_QOBJECT +#include "moc_qlocale.cpp" +#endif diff --git a/src/corelib/tools/qmap.cpp b/src/corelib/tools/qmap.cpp index 9738e2ed18..afdd30e5c8 100644 --- a/src/corelib/tools/qmap.cpp +++ b/src/corelib/tools/qmap.cpp @@ -1934,7 +1934,7 @@ void QMapDataBase::freeData(QMapDataBase *d) /*! \fn QMultiMap::QMultiMap(std::initializer_list<std::pair<Key,T> > list) \since 5.1 - Constructs a multi map with a copy of each of the elements in the + Constructs a multi-map with a copy of each of the elements in the initializer list \a list. This function is only available if the program is being diff --git a/src/corelib/tools/qset.qdoc b/src/corelib/tools/qset.qdoc index 48dcc9eec0..93f157fdc5 100644 --- a/src/corelib/tools/qset.qdoc +++ b/src/corelib/tools/qset.qdoc @@ -530,7 +530,7 @@ */ /*! - \fn QSet::const_iterator QSet::insert(const T &value) + \fn QSet::insert(const T &value) Inserts item \a value into the set, if \a value isn't already in the set, and returns an iterator pointing at the inserted diff --git a/src/corelib/tools/qstringbuilder.cpp b/src/corelib/tools/qstringbuilder.cpp index 70152a9202..56ba909e2f 100644 --- a/src/corelib/tools/qstringbuilder.cpp +++ b/src/corelib/tools/qstringbuilder.cpp @@ -72,17 +72,21 @@ QT_BEGIN_NAMESPACE For building QStrings: + \list \li QString, QStringRef, \li QChar, QCharRef, QLatin1Char, \li QLatin1String, \li QByteArray, \c char, \c{const char[]}. + \endlist The types in the last list point are only available when QT_NO_CAST_FROM_ASCII is not defined. For building QByteArrays: + \list \li QByteArray, \c char, \c{const char[]}. + \endlist Concatenating strings with operator%() generally yields better performance than using \c QString::operator+() on the same chunks diff --git a/src/corelib/tools/qtimeline.cpp b/src/corelib/tools/qtimeline.cpp index adbc2900e3..e70e7f8e16 100644 --- a/src/corelib/tools/qtimeline.cpp +++ b/src/corelib/tools/qtimeline.cpp @@ -784,3 +784,5 @@ void QTimeLine::timerEvent(QTimerEvent *event) } QT_END_NAMESPACE + +#include "moc_qtimeline.cpp" |