Add some support to flag alias properties
This is required if we want to be able to get rid of the property cache. Also reserve a flag for var properties, in case it turns out that we need to keep the distinction between var and QVariant properties in QML. Change-Id: I55c2191adcc2d94bd8f148216e26423defaa900f Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
parent
d0689ec867
commit
03107d0ccd
@ -3031,6 +3031,20 @@ bool QMetaProperty::hasStdCppSet() const
|
|||||||
return (data.flags() & StdCppSet);
|
return (data.flags() & StdCppSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\internal
|
||||||
|
|
||||||
|
Returns \c true if the property is an alias.
|
||||||
|
This is for instance true for a property declared in QML
|
||||||
|
as 'property alias'.
|
||||||
|
*/
|
||||||
|
bool QMetaProperty::isAlias() const
|
||||||
|
{
|
||||||
|
if (!mobj)
|
||||||
|
return false;
|
||||||
|
return (data.flags() & Alias);
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\internal
|
\internal
|
||||||
Executes metacall with QMetaObject::RegisterPropertyMetaType flag.
|
Executes metacall with QMetaObject::RegisterPropertyMetaType flag.
|
||||||
|
@ -314,6 +314,7 @@ public:
|
|||||||
bool resetOnGadget(void *gadget) const;
|
bool resetOnGadget(void *gadget) const;
|
||||||
|
|
||||||
bool hasStdCppSet() const;
|
bool hasStdCppSet() const;
|
||||||
|
bool isAlias() const;
|
||||||
inline bool isValid() const { return isReadable(); }
|
inline bool isValid() const { return isReadable(); }
|
||||||
inline const QMetaObject *enclosingMetaObject() const { return mobj; }
|
inline const QMetaObject *enclosingMetaObject() const { return mobj; }
|
||||||
|
|
||||||
|
@ -71,6 +71,8 @@ enum PropertyFlags {
|
|||||||
Writable = 0x00000002,
|
Writable = 0x00000002,
|
||||||
Resettable = 0x00000004,
|
Resettable = 0x00000004,
|
||||||
EnumOrFlag = 0x00000008,
|
EnumOrFlag = 0x00000008,
|
||||||
|
Alias = 0x00000010,
|
||||||
|
//Reserved for future usage = 0x00000020,
|
||||||
StdCppSet = 0x00000100,
|
StdCppSet = 0x00000100,
|
||||||
Constant = 0x00000400,
|
Constant = 0x00000400,
|
||||||
Final = 0x00000800,
|
Final = 0x00000800,
|
||||||
|
@ -2367,6 +2367,19 @@ bool QMetaPropertyBuilder::isFinal() const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* Returns \c true if the property is an alias.
|
||||||
|
* The default value is false
|
||||||
|
*/
|
||||||
|
bool QMetaPropertyBuilder::isAlias() const
|
||||||
|
{
|
||||||
|
QMetaPropertyBuilderPrivate *d = d_func();
|
||||||
|
if (d)
|
||||||
|
return d->flag(Alias);
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Sets this property to readable if \a value is true.
|
Sets this property to readable if \a value is true.
|
||||||
|
|
||||||
@ -2502,6 +2515,16 @@ void QMetaPropertyBuilder::setFinal(bool value)
|
|||||||
d->setFlag(Final, value);
|
d->setFlag(Final, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Sets the \c ALIAS flag on this property to \a value
|
||||||
|
*/
|
||||||
|
void QMetaPropertyBuilder::setAlias(bool value)
|
||||||
|
{
|
||||||
|
QMetaPropertyBuilderPrivate *d = d_func();
|
||||||
|
if (d)
|
||||||
|
d->setFlag(Alias, value);
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the revision of this property.
|
Returns the revision of this property.
|
||||||
|
|
||||||
|
@ -262,6 +262,7 @@ public:
|
|||||||
bool isEnumOrFlag() const;
|
bool isEnumOrFlag() const;
|
||||||
bool isConstant() const;
|
bool isConstant() const;
|
||||||
bool isFinal() const;
|
bool isFinal() const;
|
||||||
|
bool isAlias() const;
|
||||||
|
|
||||||
void setReadable(bool value);
|
void setReadable(bool value);
|
||||||
void setWritable(bool value);
|
void setWritable(bool value);
|
||||||
@ -274,6 +275,7 @@ public:
|
|||||||
void setEnumOrFlag(bool value);
|
void setEnumOrFlag(bool value);
|
||||||
void setConstant(bool value);
|
void setConstant(bool value);
|
||||||
void setFinal(bool value);
|
void setFinal(bool value);
|
||||||
|
void setAlias(bool value);
|
||||||
|
|
||||||
int revision() const;
|
int revision() const;
|
||||||
void setRevision(int revision);
|
void setRevision(int revision);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user