diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-09-25 14:02:04 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-09-25 14:02:04 +0200 |
commit | a1ad9a74ebb3c556c5f70f7e03be68b09598ac53 (patch) | |
tree | 615a96db418219a57a745a5899e39a9ac90744ec /src/corelib/kernel | |
parent | 6d78b7a0c46ea04f4bb771d960e2f7dff1362341 (diff) | |
parent | 462f355e4fb16cc7a1838fa2dda0f763eee58c84 (diff) |
Merge remote-tracking branch 'origin/5.6' into dev
Conflicts:
src/corelib/io/io.pri
src/corelib/io/qdatastream.cpp
src/corelib/io/qdatastream.h
src/network/socket/qabstractsocket.cpp
src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.cpp
src/plugins/platforms/cocoa/qcocoaaccessibilityelement.h
src/widgets/styles/qgtkstyle.cpp
tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/qmimedatabase-cache.pro
tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/qmimedatabase-xml.pro
tests/auto/dbus/qdbusconnection/qdbusconnection.pro
tests/auto/dbus/qdbuspendingcall/tst_qdbuspendingcall.cpp
tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
Change-Id: I347549a024eb5bfa986699e0a11f96cc55c797a7
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r-- | src/corelib/kernel/qcore_mac_p.h | 4 | ||||
-rw-r--r-- | src/corelib/kernel/qcoreapplication.cpp | 47 | ||||
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_winrt.cpp | 3 | ||||
-rw-r--r-- | src/corelib/kernel/qmetatype.cpp | 25 | ||||
-rw-r--r-- | src/corelib/kernel/qmetatype.h | 17 | ||||
-rw-r--r-- | src/corelib/kernel/qobject.cpp | 13 | ||||
-rw-r--r-- | src/corelib/kernel/qpointer.h | 5 | ||||
-rw-r--r-- | src/corelib/kernel/qvariant.h | 6 | ||||
-rw-r--r-- | src/corelib/kernel/qvariant_p.h | 2 |
9 files changed, 49 insertions, 73 deletions
diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h index 4834c14ca8..16156d0f2c 100644 --- a/src/corelib/kernel/qcore_mac_p.h +++ b/src/corelib/kernel/qcore_mac_p.h @@ -57,10 +57,6 @@ #include "qglobal.h" -#ifdef Q_OS_MACX -#include <CoreServices/CoreServices.h> -#endif - #ifdef __OBJC__ #include <Foundation/Foundation.h> #endif diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index f06537923f..3013db8b2e 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -937,18 +937,14 @@ bool QCoreApplication::testAttribute(Qt::ApplicationAttribute attribute) /*! \property QCoreApplication::quitLockEnabled - Returns \c true if the use of the QEventLoopLocker feature can cause the - application to quit, otherwise returns \c false. + \brief Whether the use of the QEventLoopLocker feature can cause the + application to quit. + + The default is \c true. \sa QEventLoopLocker */ -/*! - Returns \c true if the use of the QEventLoopLocker feature can cause the - application to quit, otherwise returns \c false. - - \sa QEventLoopLocker - */ bool QCoreApplication::isQuitLockEnabled() { return quitLockRefEnabled; @@ -956,14 +952,6 @@ bool QCoreApplication::isQuitLockEnabled() static bool doNotify(QObject *, QEvent *); -/*! - Enables the ability of the QEventLoopLocker feature to quit - the application. - - If disabled, the use of QEventLoopLocker will not quit the application. - - \sa QEventLoopLocker - */ void QCoreApplication::setQuitLockEnabled(bool enabled) { quitLockRefEnabled = enabled; @@ -1819,7 +1807,7 @@ void QCoreApplicationPrivate::maybeQuit() Tells the application to exit with return code 0 (success). Equivalent to calling QCoreApplication::exit(0). - It's common to connect the QApplication::lastWindowClosed() signal + It's common to connect the QGuiApplication::lastWindowClosed() signal to quit(), and you also often connect e.g. QAbstractButton::clicked() or signals in QAction, QMenu, or QMenuBar to it. @@ -1827,7 +1815,7 @@ void QCoreApplicationPrivate::maybeQuit() \snippet code/src_corelib_kernel_qcoreapplication.cpp 1 - \sa exit(), aboutToQuit(), QApplication::lastWindowClosed() + \sa exit(), aboutToQuit(), QGuiApplication::lastWindowClosed() */ void QCoreApplication::quit() @@ -2530,17 +2518,6 @@ QStringList QCoreApplication::libraryPaths() if (!coreappdata()->app_libpaths) { QStringList *app_libpaths = new QStringList; coreappdata()->app_libpaths.reset(app_libpaths); - QString installPathPlugins = QLibraryInfo::location(QLibraryInfo::PluginsPath); - if (QFile::exists(installPathPlugins)) { - // Make sure we convert from backslashes to slashes. - installPathPlugins = QDir(installPathPlugins).canonicalPath(); - if (!app_libpaths->contains(installPathPlugins)) - app_libpaths->append(installPathPlugins); - } - - // If QCoreApplication is not yet instantiated, - // make sure we add the application path when we construct the QCoreApplication - if (self) self->d_func()->appendApplicationPathToLibraryPaths(); const QByteArray libPathEnv = qgetenv("QT_PLUGIN_PATH"); if (!libPathEnv.isEmpty()) { @@ -2553,6 +2530,18 @@ QStringList QCoreApplication::libraryPaths() } } } + + QString installPathPlugins = QLibraryInfo::location(QLibraryInfo::PluginsPath); + if (QFile::exists(installPathPlugins)) { + // Make sure we convert from backslashes to slashes. + installPathPlugins = QDir(installPathPlugins).canonicalPath(); + if (!app_libpaths->contains(installPathPlugins)) + app_libpaths->append(installPathPlugins); + } + + // If QCoreApplication is not yet instantiated, + // make sure we add the application path when we construct the QCoreApplication + if (self) self->d_func()->appendApplicationPathToLibraryPaths(); } return *(coreappdata()->app_libpaths); } diff --git a/src/corelib/kernel/qeventdispatcher_winrt.cpp b/src/corelib/kernel/qeventdispatcher_winrt.cpp index f771974a24..490a7c566a 100644 --- a/src/corelib/kernel/qeventdispatcher_winrt.cpp +++ b/src/corelib/kernel/qeventdispatcher_winrt.cpp @@ -288,7 +288,8 @@ void QEventDispatcherWinRT::registerTimer(int timerId, int interval, Qt::TimerTy } TimeSpan period; - period.Duration = interval ? (interval * 10000) : 1; // TimeSpan is based on 100-nanosecond units + // TimeSpan is based on 100-nanosecond units + period.Duration = qMax(qint64(1), qint64(interval) * 10000); const HANDLE handle = CreateEventEx(NULL, NULL, CREATE_EVENT_MANUAL_RESET, SYNCHRONIZE | EVENT_MODIFY_STATE); const HANDLE cancelHandle = CreateEventEx(NULL, NULL, CREATE_EVENT_MANUAL_RESET, SYNCHRONIZE|EVENT_MODIFY_STATE); HRESULT hr = runOnXamlThread([&]() { diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 3906cdc036..01e2542dfa 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -1081,25 +1081,16 @@ int QMetaType::registerNormalizedType(const NS(QByteArray) &normalizedTypeName, normalizedTypeName.constData(), idx, previousSize, size); } - // Do not compare types higher than 0x100: - // Ignore WasDeclaredAsMetaType inconsitency, to many users were hitting the problem - // Ignore IsGadget as it was added in Qt 5.5 - // Ignore all the future flags as well - if ((previousFlags ^ flags) & 0xff) { - const int maskForTypeInfo = NeedsConstruction | NeedsDestruction | MovableType; + // these flags cannot change in a binary compatible way: + const int binaryCompatibilityFlag = PointerToQObject | IsEnumeration | SharedPointerToQObject + | WeakPointerToQObject | TrackingPointerToQObject; + if ((previousFlags ^ flags) & binaryCompatibilityFlag) { + const char *msg = "QMetaType::registerType: Binary compatibility break. " "\nType flags for type '%s' [%i] don't match. Previously " - "registered TypeFlags(0x%x), now registering TypeFlags(0x%x). " - "This is an ODR break, which means that your application depends on a C++ undefined behavior." - "\nHint: %s"; - QT_PREPEND_NAMESPACE(QByteArray) hint; - if ((previousFlags & maskForTypeInfo) != (flags & maskForTypeInfo)) { - hint += "\nIt seems that the type was registered at least twice in a different translation units, " - "but Q_DECLARE_TYPEINFO is not visible from all the translations unit or different flags were used." - "Remember that Q_DECLARE_TYPEINFO should be declared before QMetaType registration, " - "preferably it should be placed just after the type declaration and before Q_DECLARE_METATYPE"; - } - qFatal(msg, normalizedTypeName.constData(), idx, previousFlags, int(flags), hint.constData()); + "registered TypeFlags(0x%x), now registering TypeFlags(0x%x). "; + + qFatal(msg, normalizedTypeName.constData(), idx, previousFlags, int(flags)); } return idx; diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index 9e3e1e94fa..3b8f8e7166 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -1627,7 +1627,7 @@ namespace QtPrivate { template<typename T> struct QMetaTypeTypeFlags { - enum { Flags = (!QTypeInfo<T>::isStatic ? QMetaType::MovableType : 0) + enum { Flags = (QTypeInfoQuery<T>::isRelocatable ? QMetaType::MovableType : 0) | (QTypeInfo<T>::isComplex ? QMetaType::NeedsConstruction : 0) | (QTypeInfo<T>::isComplex ? QMetaType::NeedsDestruction : 0) | (IsPointerToTypeDerivedFromQObject<T>::Value ? QMetaType::PointerToQObject : 0) @@ -2244,21 +2244,6 @@ namespace QtPrivate { }; } -namespace QtMetaTypePrivate { -inline Q_DECL_CONSTEXPR bool isBuiltinSequentialType(int typeId) -{ - return typeId == qMetaTypeId<QStringList>() - || typeId == qMetaTypeId<QByteArrayList>() - || typeId == qMetaTypeId<QVariantList>(); -} - -inline Q_DECL_CONSTEXPR bool isBuiltinAssociativeType(int typeId) -{ - return typeId == qMetaTypeId<QVariantHash>() - || typeId == qMetaTypeId<QVariantMap>(); -} -} // QtMetaTypePrivate - QT_END_NAMESPACE #endif // QMETATYPE_H diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 4d4cccd7b1..d324b6f150 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -1219,6 +1219,13 @@ void QObject::setObjectName(const QString &name) The event() function can be reimplemented to customize the behavior of an object. + Make sure you call the parent event class implementation + for all the events you did not handle. + + Example: + + \snippet code/src_corelib_kernel_qobject.cpp 52 + \sa installEventFilter(), timerEvent(), QCoreApplication::sendEvent(), QCoreApplication::postEvent() */ @@ -1382,7 +1389,7 @@ bool QObject::eventFilter(QObject * /* watched */, QEvent * /* event */) Signals are not blocked by default. - \sa blockSignals() + \sa blockSignals(), QSignalBlocker */ /*! @@ -1395,7 +1402,9 @@ bool QObject::eventFilter(QObject * /* watched */, QEvent * /* event */) Note that the destroyed() signal will be emitted even if the signals for this object have been blocked. - \sa signalsBlocked() + Signals emitted while being blocked are not buffered. + + \sa signalsBlocked(), QSignalBlocker */ bool QObject::blockSignals(bool block) Q_DECL_NOTHROW diff --git a/src/corelib/kernel/qpointer.h b/src/corelib/kernel/qpointer.h index 72388f2bb7..52bd368301 100644 --- a/src/corelib/kernel/qpointer.h +++ b/src/corelib/kernel/qpointer.h @@ -66,6 +66,11 @@ public: // compiler-generated copy/move ctor/assignment operators are fine! // compiler-generated dtor is fine! +#ifdef Q_QDOC + // Stop qdoc from complaining about missing function + ~QPointer(); +#endif + inline void swap(QPointer &other) { wp.swap(other.wp); } inline QPointer<T> &operator=(T* p) diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h index 27b19982de..4c7e498280 100644 --- a/src/corelib/kernel/qvariant.h +++ b/src/corelib/kernel/qvariant.h @@ -750,7 +750,7 @@ namespace QtPrivate { static QVariantList invoke(const QVariant &v) { const int typeId = v.userType(); - if (QtMetaTypePrivate::isBuiltinSequentialType(typeId) || QMetaType::hasRegisteredConverterFunction(typeId, qMetaTypeId<QtMetaTypePrivate::QSequentialIterableImpl>())) { + if (typeId == qMetaTypeId<QStringList>() || typeId == qMetaTypeId<QByteArrayList>() || QMetaType::hasRegisteredConverterFunction(typeId, qMetaTypeId<QtMetaTypePrivate::QSequentialIterableImpl>())) { QSequentialIterable iter = QVariantValueHelperInterface<QSequentialIterable>::invoke(v); QVariantList l; l.reserve(iter.size()); @@ -767,7 +767,7 @@ namespace QtPrivate { static QVariantHash invoke(const QVariant &v) { const int typeId = v.userType(); - if (QtMetaTypePrivate::isBuiltinAssociativeType(typeId) || QMetaType::hasRegisteredConverterFunction(typeId, qMetaTypeId<QtMetaTypePrivate::QAssociativeIterableImpl>())) { + if (typeId == qMetaTypeId<QVariantMap>() || QMetaType::hasRegisteredConverterFunction(typeId, qMetaTypeId<QtMetaTypePrivate::QAssociativeIterableImpl>())) { QAssociativeIterable iter = QVariantValueHelperInterface<QAssociativeIterable>::invoke(v); QVariantHash l; l.reserve(iter.size()); @@ -784,7 +784,7 @@ namespace QtPrivate { static QVariantMap invoke(const QVariant &v) { const int typeId = v.userType(); - if (QtMetaTypePrivate::isBuiltinAssociativeType(typeId) || QMetaType::hasRegisteredConverterFunction(typeId, qMetaTypeId<QtMetaTypePrivate::QAssociativeIterableImpl>())) { + if (typeId == qMetaTypeId<QVariantHash>() || QMetaType::hasRegisteredConverterFunction(typeId, qMetaTypeId<QtMetaTypePrivate::QAssociativeIterableImpl>())) { QAssociativeIterable iter = QVariantValueHelperInterface<QAssociativeIterable>::invoke(v); QVariantMap l; for (QAssociativeIterable::const_iterator it = iter.begin(), end = iter.end(); it != end; ++it) diff --git a/src/corelib/kernel/qvariant_p.h b/src/corelib/kernel/qvariant_p.h index 3b30b1286d..d84d702982 100644 --- a/src/corelib/kernel/qvariant_p.h +++ b/src/corelib/kernel/qvariant_p.h @@ -58,7 +58,7 @@ template<typename T> struct QVariantIntegrator { static const bool CanUseInternalSpace = sizeof(T) <= sizeof(QVariant::Private::Data) - && ((!QTypeInfo<T>::isStatic) || Q_IS_ENUM(T)); + && ((QTypeInfoQuery<T>::isRelocatable) || Q_IS_ENUM(T)); }; Q_STATIC_ASSERT(QVariantIntegrator<double>::CanUseInternalSpace); Q_STATIC_ASSERT(QVariantIntegrator<long int>::CanUseInternalSpace); |