summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qmetaobject.cpp
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2020-01-28 01:00:39 +0100
committerLiang Qi <liang.qi@qt.io>2020-01-28 14:14:20 +0000
commit558fc903acc610769279da2737ad679aa9fd728d (patch)
treeebe36deb140e47ca32fea9b0753cde06f465a0fa /src/corelib/kernel/qmetaobject.cpp
parent089d54f06ff327f5212cb08fdbcb540066357dd5 (diff)
parentbe8c257da9a264994243c120231965ff0008ef09 (diff)
Merge remote-tracking branch 'origin/5.15' into dev
Conflicts: src/corelib/io/qsettings.cpp src/corelib/kernel/qvariant.cpp src/corelib/serialization/qjsoncbor.cpp src/corelib/serialization/qjsonvalue.cpp src/corelib/tools/tools.pri src/gui/image/qimage.cpp src/gui/kernel/qguivariant.cpp src/widgets/kernel/qshortcut.cpp tests/auto/tools/moc/allmocs_baseline_in.json tests/auto/tools/moc/tst_moc.cpp src/opengl/qglframebufferobject.cpp Done-With: Edward Welbourne <edward.welbourne@qt.io> Done-With: Leander Beernaert <leander.beernaert@qt.io> Change-Id: Ie7f5fa646c607fe70c314bf7195f7578ded1d271
Diffstat (limited to 'src/corelib/kernel/qmetaobject.cpp')
-rw-r--r--src/corelib/kernel/qmetaobject.cpp31
1 files changed, 23 insertions, 8 deletions
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp
index 3883613d49..f4d0a88529 100644
--- a/src/corelib/kernel/qmetaobject.cpp
+++ b/src/corelib/kernel/qmetaobject.cpp
@@ -603,7 +603,7 @@ static bool methodMatch(const QMetaObject *m, int handle,
* \internal
* helper function for indexOf{Method,Slot,Signal}, returns the relative index of the method within
* the baseObject
-* \a MethodType might be MethodSignal or MethodSlot, or 0 to match everything.
+* \a MethodType might be MethodSignal or MethodSlot, or \nullptr to match everything.
*/
template<int MethodType>
static inline int indexOfMethodRelative(const QMetaObject **baseObject,
@@ -737,7 +737,7 @@ int QMetaObject::indexOfSignal(const char *signal) const
\internal
Same as QMetaObject::indexOfSignal, but the result is the local offset to the base object.
- \a baseObject will be adjusted to the enclosing QMetaObject, or 0 if the signal is not found
+ \a baseObject will be adjusted to the enclosing QMetaObject, or \nullptr if the signal is not found
*/
int QMetaObjectPrivate::indexOfSignalRelative(const QMetaObject **baseObject,
const QByteArray &name, int argc,
@@ -2988,7 +2988,7 @@ int QMetaProperty::userType() const
if (type == QMetaType::UnknownType) {
type = registerPropertyType();
if (type == QMetaType::UnknownType)
- return QVariant::Int; // Match behavior of QMetaType::type()
+ return QMetaType::Int; // Match behavior of QMetaType::type()
}
return type;
}
@@ -3106,7 +3106,7 @@ QVariant QMetaProperty::read(const QObject *object) const
if (!object || !mobj)
return QVariant();
- uint t = QVariant::Int;
+ uint t = QMetaType::Int;
if (isEnumType()) {
/*
try to create a QVariant that can be converted to this enum
@@ -3183,9 +3183,9 @@ bool QMetaProperty::write(QObject *object, const QVariant &value) const
return false;
QVariant v = value;
- uint t = QVariant::Invalid;
+ uint t = QMetaType::UnknownType;
if (isEnumType()) {
- if (v.type() == QVariant::String) {
+ if (v.userType() == QMetaType::QString) {
bool ok;
if (isFlagType())
v = QVariant(menum.keysToValue(value.toByteArray(), &ok));
@@ -3193,13 +3193,13 @@ bool QMetaProperty::write(QObject *object, const QVariant &value) const
v = QVariant(menum.keyToValue(value.toByteArray(), &ok));
if (!ok)
return false;
- } else if (v.type() != QVariant::Int && v.type() != QVariant::UInt) {
+ } else if (v.userType() != QMetaType::Int && v.userType() != QMetaType::UInt) {
int enumMetaTypeId = QMetaType::type(qualifiedName(menum));
if ((enumMetaTypeId == QMetaType::UnknownType) || (v.userType() != enumMetaTypeId) || !v.constData())
return false;
v = QVariant(*reinterpret_cast<const int *>(v.constData()));
}
- v.convert(QVariant::Int);
+ v.convert(QMetaType::Int);
} else {
int handle = priv(mobj->d.data)->propertyData + 3*idx;
const char *typeName = nullptr;
@@ -3579,6 +3579,21 @@ bool QMetaProperty::isFinal() const
}
/*!
+ \since 5.15
+ Returns \c true if the property is required; otherwise returns \c false.
+
+ A property is final if the \c{Q_PROPERTY()}'s \c REQUIRED attribute
+ is set.
+*/
+bool QMetaProperty::isRequired() const
+{
+ if (!mobj)
+ return false;
+ int flags = mobj->d.data[handle + 2];
+ return flags & Required;
+}
+
+/*!
\obsolete
Returns \c true if the property is editable for the given \a object;