diff options
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r-- | src/corelib/kernel/qcoreapplication.cpp | 6 | ||||
-rw-r--r-- | src/corelib/kernel/qcoreapplication_win.cpp | 2 | ||||
-rw-r--r-- | src/corelib/kernel/qmetaobject.cpp | 19 | ||||
-rw-r--r-- | src/corelib/kernel/qmetaobject.h | 3 | ||||
-rw-r--r-- | src/corelib/kernel/qmetaobject_moc_p.h | 3 | ||||
-rw-r--r-- | src/corelib/kernel/qmetaobjectbuilder.cpp | 2 | ||||
-rw-r--r-- | src/corelib/kernel/qmetatype.cpp | 46 | ||||
-rw-r--r-- | src/corelib/kernel/qmetatype.h | 39 | ||||
-rw-r--r-- | src/corelib/kernel/qmetatype_p.h | 3 | ||||
-rw-r--r-- | src/corelib/kernel/qobject.cpp | 68 | ||||
-rw-r--r-- | src/corelib/kernel/qobject.h | 24 | ||||
-rw-r--r-- | src/corelib/kernel/qobject_p.h | 12 | ||||
-rw-r--r-- | src/corelib/kernel/qobjectdefs.h | 4 | ||||
-rw-r--r-- | src/corelib/kernel/qtranslator.cpp | 8 | ||||
-rw-r--r-- | src/corelib/kernel/qvariant.cpp | 21 | ||||
-rw-r--r-- | src/corelib/kernel/qvariant.h | 2 |
16 files changed, 131 insertions, 131 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 32efa727b8..a66c71cff6 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -138,10 +138,10 @@ QT_BEGIN_NAMESPACE extern QString qAppFileName(); #endif -#if QT_VERSION >= 0x060000 -# error "Bump QCoreApplicatoinPrivate::app_compile_version to 0x060000" +#if QT_VERSION >= 0x070000 +# error "Bump QCoreApplicatoinPrivate::app_compile_version to 0x070000" #endif -int QCoreApplicationPrivate::app_compile_version = 0x050000; //we don't know exactly, but it's at least 5.0.0 +int QCoreApplicationPrivate::app_compile_version = 0x060000; //we don't know exactly, but it's at least 6.0.0 bool QCoreApplicationPrivate::setuidAllowed = false; diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp index 765f129758..824c0535ed 100644 --- a/src/corelib/kernel/qcoreapplication_win.cpp +++ b/src/corelib/kernel/qcoreapplication_win.cpp @@ -772,7 +772,7 @@ QString decodeMSG(const MSG& msg) auto rect = reinterpret_cast<const RECT *>(lParam); QTextStream(¶meters) << "DPI: " << HIWORD(wParam) << ',' << LOWORD(wParam) << ' ' << (rect->right - rect->left) << 'x' - << (rect->bottom - rect->top) << forcesign << rect->left << rect->top; + << (rect->bottom - rect->top) << Qt::forcesign << rect->left << rect->top; } break; case WM_IME_NOTIFY: diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index 5cb30a74ac..b1e1bb8b4a 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -682,7 +682,9 @@ static void argumentTypesFromString(const char *str, const char *end, --level; ++str; } - types += QArgumentType(QByteArray(begin, str - begin)); + QByteArray argType(begin, str - begin); + argType.replace("QList<", "QVector<"); + types += QArgumentType(std::move(argType)); } } @@ -3655,6 +3657,21 @@ const char* QMetaClassInfo::value() const } /*! + \class QMethodRawArguments + \internal + + A wrapper class for the void ** arguments array used by the meta + object system. If a slot uses a single argument of this type, + the meta object system will pass the raw arguments array directly + to the slot and set the arguments count in the slot description to + zero, so that any signal can connect to it. + + This is used internally to implement signal relay functionality in + our state machine and dbus. +*/ + + +/*! \macro QGenericArgument Q_ARG(Type, const Type &value) \relates QMetaObject diff --git a/src/corelib/kernel/qmetaobject.h b/src/corelib/kernel/qmetaobject.h index fcd92afd89..31fecd0b07 100644 --- a/src/corelib/kernel/qmetaobject.h +++ b/src/corelib/kernel/qmetaobject.h @@ -46,9 +46,6 @@ QT_BEGIN_NAMESPACE - -template <typename T> class QList; - #define Q_METAMETHOD_INVOKE_MAX_ARGS 10 class Q_CORE_EXPORT QMetaMethod diff --git a/src/corelib/kernel/qmetaobject_moc_p.h b/src/corelib/kernel/qmetaobject_moc_p.h index 8c7900767b..471e43f85b 100644 --- a/src/corelib/kernel/qmetaobject_moc_p.h +++ b/src/corelib/kernel/qmetaobject_moc_p.h @@ -213,6 +213,9 @@ static QByteArray normalizeTypeInternal(const char *t, const char *e, bool fixSc } } + // Qt 5 compatibility, make sure we use the correct type name for QList + result.replace("QList<", "QVector<"); + return result; } diff --git a/src/corelib/kernel/qmetaobjectbuilder.cpp b/src/corelib/kernel/qmetaobjectbuilder.cpp index f77c4ce32f..aab9e05182 100644 --- a/src/corelib/kernel/qmetaobjectbuilder.cpp +++ b/src/corelib/kernel/qmetaobjectbuilder.cpp @@ -1103,7 +1103,7 @@ int QMetaStringTable::enter(const QByteArray &value) int QMetaStringTable::preferredAlignment() { - return Q_ALIGNOF(QByteArrayData); + return alignof(QByteArrayData); } // Returns the size (in bytes) required for serializing this string table. diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index 356a675517..5c1e4b4ddd 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -37,6 +37,8 @@ ** ****************************************************************************/ +#include <bitset> + #include "qmetatype.h" #include "qmetatype_p.h" #include "qobjectdefs.h" @@ -2416,6 +2418,50 @@ const QMetaObject *metaObjectForQWidget() return nullptr; return qMetaObjectWidgetsHelper; } + +void qt5CompatibilityHookPostRegister(int id, const QByteArray &normalizedTypeName) +{ + // In Qt6 QList got typedef'ed to QVector. To keep runtime behavior compatibility + // with Qt5 we install corresponding aliases. For example if one register + // QVector<QVector<int>> + // we need to register the type plus all possible aliases: + // QVector<QList<int>> + // QList<QVector<int>> + // QList<QList<int>> + // ### Qt6 TODO This is slow, as it allocates couple of strings we would need to + // if def this call with something like QT_NO_QLIST + const char *vectorName = "QVector<"; + const char *listName = "QList<"; + + auto isSubstringOfAType = [](char c) { return c != ' ' && c != ',' && c != '<'; }; + QVarLengthArray<int> indexes; + + for (auto containerName: {vectorName, listName}) { + for (int i = normalizedTypeName.indexOf(containerName, 0); i != -1; i = normalizedTypeName.indexOf(containerName, i + 1)) { + if (!i || (i > 0 && !isSubstringOfAType(normalizedTypeName[i - 1]))) + indexes.append(i); + } + } + // To avoid problems with the constantly changing size we start replacements + // from the end of normalizedTypeName + std::sort(indexes.rbegin(), indexes.rend()); + + for (quint64 combination = 1; ; ++combination) { + std::bitset<64> bits(combination); + QByteArray name = normalizedTypeName; + for (auto j = 0; j < indexes.size(); ++j) { + if (bits.test(j)) { + auto i = indexes[j]; + auto replaceFrom = normalizedTypeName[i + 1] == 'V' ? vectorName : listName; + auto replaceTo = normalizedTypeName[i + 1] == 'V' ? listName : vectorName; + name.replace(i, sizeof(replaceFrom), replaceTo); + } + } + QMetaType::registerNormalizedTypedef(name, id); + if (bits.count() >= size_t(indexes.size())) + break; + } +} } namespace QtMetaTypePrivate { diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index 240828bc9a..af1b0faf38 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -151,6 +151,13 @@ inline Q_DECL_CONSTEXPR int qMetaTypeId(); F(QVariantHash, 28, QVariantHash) \ F(QByteArrayList, 49, QByteArrayList) \ +#if QT_CONFIG(shortcut) +#define QT_FOR_EACH_STATIC_KEYSEQUENCE_CLASS(F)\ + F(QKeySequence, 75, QKeySequence) +#else +#define QT_FOR_EACH_STATIC_KEYSEQUENCE_CLASS(F) +#endif + #define QT_FOR_EACH_STATIC_GUI_CLASS(F)\ F(QFont, 64, QFont) \ F(QPixmap, 65, QPixmap) \ @@ -163,7 +170,7 @@ inline Q_DECL_CONSTEXPR int qMetaTypeId(); F(QRegion, 72, QRegion) \ F(QBitmap, 73, QBitmap) \ F(QCursor, 74, QCursor) \ - F(QKeySequence, 75, QKeySequence) \ + QT_FOR_EACH_STATIC_KEYSEQUENCE_CLASS(F) \ F(QPen, 76, QPen) \ F(QTextLength, 77, QTextLength) \ F(QTextFormat, 78, QTextFormat) \ @@ -200,10 +207,11 @@ inline Q_DECL_CONSTEXPR int qMetaTypeId(); F(UInt, -1, uint, "quint32") \ F(LongLong, -1, qlonglong, "qint64") \ F(ULongLong, -1, qulonglong, "quint64") \ + F(QVariantList, -1, QVariantList, "QVector<QVariant>") \ F(QVariantList, -1, QVariantList, "QList<QVariant>") \ F(QVariantMap, -1, QVariantMap, "QMap<QString,QVariant>") \ F(QVariantHash, -1, QVariantHash, "QHash<QString,QVariant>") \ - F(QByteArrayList, -1, QByteArrayList, "QList<QByteArray>") \ + F(QByteArrayList, -1, QByteArrayList, "QVector<QByteArray>") \ #define QT_FOR_EACH_STATIC_TYPE(F)\ QT_FOR_EACH_STATIC_PRIMITIVE_TYPE(F)\ @@ -218,7 +226,6 @@ inline Q_DECL_CONSTEXPR int qMetaTypeId(); TypeName = Id, #define QT_FOR_EACH_AUTOMATIC_TEMPLATE_1ARG(F) \ - F(QList) \ F(QVector) \ F(QQueue) \ F(QStack) \ @@ -500,7 +507,7 @@ public: typedef void (*Deleter)(void *); typedef void *(*Creator)(const void *); -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) +#if 1 || QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt6: fix this typedef void (*Destructor)(void *); typedef void *(*Constructor)(void *, const void *); // TODO Qt6: remove me #endif @@ -997,10 +1004,6 @@ struct ContainerAPI : CapabilitiesImpl<T> }; template<typename T> -struct ContainerAPI<QList<T> > : CapabilitiesImpl<QList<T> > -{ static int size(const QList<T> *t) { return t->size(); } }; - -template<typename T> struct ContainerAPI<QVector<T> > : CapabilitiesImpl<QVector<T> > { static int size(const QVector<T> *t) { return t->size(); } }; @@ -1646,6 +1649,23 @@ namespace QtPrivate static bool registerConverter(int) { return false; } }; + template<class T> + struct Qt5CompatibilityHook + { + static inline void postRegister(int, const QByteArray &) {}; + }; + + Q_CORE_EXPORT void qt5CompatibilityHookPostRegister(int id, const QByteArray &normalizedTypeName); + + template<class T> + struct Qt5CompatibilityHook<QVector<T>> + { + static inline void postRegister(int id, const QByteArray &normalizedTypeName) + { + qt5CompatibilityHookPostRegister(id, normalizedTypeName); + } + }; + Q_CORE_EXPORT bool isBuiltinType(const QByteArray &type); } // namespace QtPrivate @@ -1772,6 +1792,7 @@ int qRegisterNormalizedMetaType(const QT_PREPEND_NAMESPACE(QByteArray) &normaliz QtPrivate::AssociativeContainerConverterHelper<T>::registerConverter(id); QtPrivate::MetaTypePairHelper<T>::registerConverter(id); QtPrivate::MetaTypeSmartPointerHelper<T>::registerConverter(id); + QtPrivate::Qt5CompatibilityHook<T>::postRegister(id, normalizedTypeName); } return id; @@ -1995,7 +2016,7 @@ typedef QHash<QString, QVariant> QVariantHash; #ifdef Q_CLANG_QDOC class QByteArrayList; #else -typedef QList<QByteArray> QByteArrayList; +typedef QVector<QByteArray> QByteArrayList; #endif #define Q_DECLARE_METATYPE_TEMPLATE_1ARG(SINGLE_ARG_TEMPLATE) \ diff --git a/src/corelib/kernel/qmetatype_p.h b/src/corelib/kernel/qmetatype_p.h index d743d5a5c7..f2057e25b4 100644 --- a/src/corelib/kernel/qmetatype_p.h +++ b/src/corelib/kernel/qmetatype_p.h @@ -232,9 +232,6 @@ template<> struct TypeDefinition<QRegExp> { static const bool IsAvailable = fals #if !QT_CONFIG(regularexpression) template<> struct TypeDefinition<QRegularExpression> { static const bool IsAvailable = false; }; #endif -#ifdef QT_NO_SHORTCUT -template<> struct TypeDefinition<QKeySequence> { static const bool IsAvailable = false; }; -#endif #ifdef QT_NO_CURSOR template<> struct TypeDefinition<QCursor> { static const bool IsAvailable = false; }; #endif diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index cee885c0fe..a2f76a6354 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -161,7 +161,6 @@ extern "C" Q_CORE_EXPORT void qt_removeObject(QObject *) #endif void (*QAbstractDeclarativeData::destroyed)(QAbstractDeclarativeData *, QObject *) = 0; -void (*QAbstractDeclarativeData::destroyed_qml1)(QAbstractDeclarativeData *, QObject *) = 0; void (*QAbstractDeclarativeData::parentChanged)(QAbstractDeclarativeData *, QObject *, QObject *) = 0; void (*QAbstractDeclarativeData::signalEmitted)(QAbstractDeclarativeData *, QObject *, int, void **) = 0; int (*QAbstractDeclarativeData::receivers)(QAbstractDeclarativeData *, const QObject *, int) = 0; @@ -234,10 +233,6 @@ QObjectPrivate::~QObjectPrivate() if (metaObject) metaObject->objectDestroyed(q_ptr); -#ifndef QT_NO_USERDATA - if (extraData) - qDeleteAll(extraData->userData); -#endif delete extraData; } @@ -997,15 +992,8 @@ QObject::~QObject() emit destroyed(this); } - if (d->declarativeData) { - if (static_cast<QAbstractDeclarativeDataImpl*>(d->declarativeData)->ownedByQml1) { - if (QAbstractDeclarativeData::destroyed_qml1) - QAbstractDeclarativeData::destroyed_qml1(d->declarativeData, this); - } else { - if (QAbstractDeclarativeData::destroyed) - QAbstractDeclarativeData::destroyed(d->declarativeData, this); - } - } + if (d->declarativeData && QAbstractDeclarativeData::destroyed) + QAbstractDeclarativeData::destroyed(d->declarativeData, this); QObjectPrivate::ConnectionData *cd = d->connections.loadRelaxed(); if (cd) { @@ -4249,58 +4237,6 @@ void QObject::dumpObjectInfo() const } } -#ifndef QT_NO_USERDATA -static QBasicAtomicInteger<uint> user_data_registration = Q_BASIC_ATOMIC_INITIALIZER(0); - -/*! - \internal - */ -uint QObject::registerUserData() -{ - return user_data_registration.fetchAndAddRelaxed(1); -} - -/*! - \fn QObjectUserData::QObjectUserData() - \internal - */ - -/*! - \internal - */ -QObjectUserData::~QObjectUserData() -{ -} - -/*! - \internal - */ -void QObject::setUserData(uint id, QObjectUserData* data) -{ - Q_D(QObject); - if (!d->extraData) - d->extraData = new QObjectPrivate::ExtraData; - - if (d->extraData->userData.size() <= (int) id) - d->extraData->userData.resize((int) id + 1); - d->extraData->userData[id] = data; -} - -/*! - \internal - */ -QObjectUserData* QObject::userData(uint id) const -{ - Q_D(const QObject); - if (!d->extraData) - return 0; - if ((int)id < d->extraData->userData.size()) - return d->extraData->userData.at(id); - return 0; -} - -#endif // QT_NO_USERDATA - #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug dbg, const QObject *o) diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h index 540b8b32c1..296552c2f2 100644 --- a/src/corelib/kernel/qobject.h +++ b/src/corelib/kernel/qobject.h @@ -78,12 +78,6 @@ class QRegExp; #if QT_CONFIG(regularexpression) class QRegularExpression; #endif -#if !QT_DEPRECATED_SINCE(5, 14) || QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) -# define QT_NO_USERDATA -#endif -#ifndef QT_NO_USERDATA -class QObjectUserData; -#endif struct QDynamicMetaObjectData; typedef QList<QObject*> QObjectList; @@ -408,15 +402,6 @@ public: QList<QByteArray> dynamicPropertyNames() const; #endif // QT_NO_PROPERTIES -#ifndef QT_NO_USERDATA - QT_DEPRECATED_VERSION_5_14 - static uint registerUserData(); - QT_DEPRECATED_VERSION_X_5_14("Use setProperty()") - void setUserData(uint id, QObjectUserData* data); - QT_DEPRECATED_VERSION_X_5_14("Use property()") - QObjectUserData* userData(uint id) const; -#endif // QT_NO_USERDATA - Q_SIGNALS: void destroyed(QObject * = nullptr); void objectNameChanged(const QString &objectName, QPrivateSignal); @@ -485,15 +470,6 @@ inline QMetaObject::Connection QObject::connect(const QObject *asender, const ch inline const QMetaObject *qt_getQtMetaObject() noexcept { return &QObject::staticQtMetaObject; } -#ifndef QT_NO_USERDATA -class Q_CORE_EXPORT QObjectUserData { - Q_DISABLE_COPY(QObjectUserData) -public: - QObjectUserData() = default; - virtual ~QObjectUserData(); -}; -#endif - #if QT_DEPRECATED_SINCE(5, 0) template<typename T> inline QT_DEPRECATED T qFindChild(const QObject *o, const QString &name = QString()) diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h index 1ebf8e7a07..a421b55764 100644 --- a/src/corelib/kernel/qobject_p.h +++ b/src/corelib/kernel/qobject_p.h @@ -89,7 +89,6 @@ class Q_CORE_EXPORT QAbstractDeclarativeData { public: static void (*destroyed)(QAbstractDeclarativeData *, QObject *); - static void (*destroyed_qml1)(QAbstractDeclarativeData *, QObject *); static void (*parentChanged)(QAbstractDeclarativeData *, QObject *, QObject *); static void (*signalEmitted)(QAbstractDeclarativeData *, QObject *, int, void **); static int (*receivers)(QAbstractDeclarativeData *, const QObject *, int); @@ -97,14 +96,6 @@ public: static void (*setWidgetParent)(QObject *, QObject *); // Used by the QML engine to specify parents for widgets. Set by QtWidgets. }; -// This is an implementation of QAbstractDeclarativeData that is identical with -// the implementation in QtDeclarative and QtQml for the first bit -struct QAbstractDeclarativeDataImpl : public QAbstractDeclarativeData -{ - quint32 ownedByQml1:1; - quint32 unused: 31; -}; - class Q_CORE_EXPORT QObjectPrivate : public QObjectData { Q_DECLARE_PUBLIC(QObject) @@ -113,9 +104,6 @@ public: struct ExtraData { ExtraData() {} - #ifndef QT_NO_USERDATA - QVector<QObjectUserData *> userData; - #endif QList<QByteArray> propertyNames; QVector<QVariant> propertyValues; QVector<int> runningTimers; diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h index dc2d832fe5..9f654b0318 100644 --- a/src/corelib/kernel/qobjectdefs.h +++ b/src/corelib/kernel/qobjectdefs.h @@ -285,6 +285,10 @@ class QMetaEnum; class QMetaProperty; class QMetaClassInfo; +struct QMethodRawArguments +{ + void **arguments; +}; class Q_CORE_EXPORT QGenericArgument { diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp index ddb96ecad6..31c1277b03 100644 --- a/src/corelib/kernel/qtranslator.cpp +++ b/src/corelib/kernel/qtranslator.cpp @@ -58,11 +58,11 @@ #include "qendian.h" #include "qresource.h" -#if defined(Q_OS_UNIX) && !defined(Q_OS_INTEGRITY) -#define QT_USE_MMAP -#include "private/qcore_unix_p.h" +#if defined(Q_OS_UNIX) && !defined(Q_OS_NACL) && !defined(Q_OS_INTEGRITY) +# define QT_USE_MMAP +# include "private/qcore_unix_p.h" // for mmap -#include <sys/mman.h> +# include <sys/mman.h> #endif #include <stdlib.h> diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 705cae6cf4..258da1a8d4 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -1470,7 +1470,7 @@ static void customConstruct(QVariant::Private *d, const void *copy) } else { // Private::Data contains long long, and long double is the biggest standard type. const size_t maxAlignment = - qMax(Q_ALIGNOF(QVariant::Private::Data), Q_ALIGNOF(long double)); + qMax(alignof(QVariant::Private::Data), alignof(long double)); const size_t s = sizeof(QVariant::PrivateShared); const size_t offset = s + ((s * maxAlignment - s) % maxAlignment); void *data = operator new(offset + size); @@ -2469,7 +2469,9 @@ static const ushort mapIdFromQt3ToCurrent[MapFromThreeCount] = QVariant::DateTime, QVariant::ByteArray, QVariant::BitArray, +#if QT_CONFIG(shortcut) QVariant::KeySequence, +#endif QVariant::Pen, QVariant::LongLong, QVariant::ULongLong, @@ -2574,7 +2576,11 @@ void QVariant::save(QDataStream &s) const typeId += 97; } else if (typeId == QMetaType::QSizePolicy) { typeId = 75; +#if QT_CONFIG(shortcut) } else if (typeId >= QMetaType::QKeySequence && typeId <= QMetaType::QQuaternion) { +#else + } else if (typeId >= QMetaType::QPen && typeId <= QMetaType::QQuaternion) { +#endif // and as a result these types received lower ids too typeId +=1; } else if (typeId == QMetaType::QPolygonF) { @@ -3647,9 +3653,11 @@ bool QVariant::canConvert(int targetTypeId) const if (currentType > int(QMetaType::QUuid) || targetTypeId > int(QMetaType::QUuid)) { switch (uint(targetTypeId)) { case QVariant::Int: +#if QT_CONFIG(shortcut) if (currentType == QVariant::KeySequence) return true; Q_FALLTHROUGH(); +#endif case QVariant::UInt: case QVariant::LongLong: case QVariant::ULongLong: @@ -3672,11 +3680,16 @@ bool QVariant::canConvert(int targetTypeId) const return currentType == QVariant::Color || currentType == QMetaType::Nullptr || ((QMetaType::typeFlags(currentType) & QMetaType::IsEnumeration) && QMetaType::metaObjectForType(currentType)); case QVariant::String: - return currentType == QVariant::KeySequence || currentType == QVariant::Font - || currentType == QVariant::Color || currentType == QMetaType::Nullptr - || ((QMetaType::typeFlags(currentType) & QMetaType::IsEnumeration) && QMetaType::metaObjectForType(currentType)); + return currentType == QVariant::Font + || currentType == QVariant::Color || currentType == QMetaType::Nullptr +#if QT_CONFIG(shortcut) + || currentType == QVariant::KeySequence +#endif + || ((QMetaType::typeFlags(currentType) & QMetaType::IsEnumeration) && QMetaType::metaObjectForType(currentType)); +#if QT_CONFIG(shortcut) case QVariant::KeySequence: return currentType == QVariant::String || currentType == QVariant::Int; +#endif case QVariant::Font: return currentType == QVariant::String; case QVariant::Color: diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h index 86c7414704..331adea4e7 100644 --- a/src/corelib/kernel/qvariant.h +++ b/src/corelib/kernel/qvariant.h @@ -184,7 +184,9 @@ class Q_CORE_EXPORT QVariant Region = QMetaType::QRegion, Bitmap = QMetaType::QBitmap, Cursor = QMetaType::QCursor, +#if QT_CONFIG(shortcut) KeySequence = QMetaType::QKeySequence, +#endif Pen = QMetaType::QPen, TextLength = QMetaType::QTextLength, TextFormat = QMetaType::QTextFormat, |