summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/kernel/qmetaobject.cpp17
-rw-r--r--src/corelib/kernel/qmetaobject.h1
-rw-r--r--src/tools/moc/generator.cpp5
-rw-r--r--src/tools/moc/moc.cpp3
-rw-r--r--src/tools/moc/moc.h3
5 files changed, 26 insertions, 3 deletions
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp
index fee2da9..3b09061 100644
--- a/src/corelib/kernel/qmetaobject.cpp
+++ b/src/corelib/kernel/qmetaobject.cpp
@@ -161,7 +161,8 @@ enum PropertyFlags {
ResolveUser = 0x00200000,
Notify = 0x00400000,
Dynamic = 0x00800000,
- Constant = 0x00000400
+ Constant = 0x00000400,
+ Final = 0x00000800
};
enum MethodFlags {
@@ -2466,6 +2467,20 @@ bool QMetaProperty::isConstant() const
}
/*!
+ Returns true if the property is final; otherwise returns false.
+
+ A property is final if the \c{Q_PROPERTY()}'s \c FINAL attribute
+ is set.
+*/
+bool QMetaProperty::isFinal() const
+{
+ if (!mobj)
+ return false;
+ int flags = mobj->d.data[handle + 2];
+ return flags & Final;
+}
+
+/*!
\obsolete
Returns true if the property is editable for the given \a object;
diff --git a/src/corelib/kernel/qmetaobject.h b/src/corelib/kernel/qmetaobject.h
index 73b52a9..bd47582 100644
--- a/src/corelib/kernel/qmetaobject.h
+++ b/src/corelib/kernel/qmetaobject.h
@@ -189,6 +189,7 @@ public:
bool isUser(const QObject *obj = 0) const;
bool isDynamic() const;
bool isConstant() const;
+ bool isFinal() const;
bool isFlagType() const;
bool isEnumType() const;
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp
index e4086e6..fbc434d 100644
--- a/src/tools/moc/generator.cpp
+++ b/src/tools/moc/generator.cpp
@@ -68,7 +68,8 @@ enum PropertyFlags {
ResolveUser = 0x00200000,
Notify = 0x00400000,
Dynamic = 0x00800000,
- Constant = 0x00000400
+ Constant = 0x00000400,
+ Final = 0x00000800
};
enum MethodFlags {
AccessPrivate = 0x00,
@@ -601,6 +602,8 @@ void Generator::generateProperties()
if (p.constant)
flags |= Constant;
+ if (p.final)
+ flags |= Final;
fprintf(out, " %4d, %4d, ",
strreg(p.name),
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp
index 66012ca..aa11d0e 100644
--- a/src/tools/moc/moc.cpp
+++ b/src/tools/moc/moc.cpp
@@ -912,6 +912,9 @@ void Moc::parseProperty(ClassDef *def)
if (l[0] == 'C' && l == "CONSTANT") {
propDef.constant = true;
continue;
+ } else if(l[0] == 'F' && l == "FINAL") {
+ propDef.final = true;
+ continue;
}
QByteArray v, v2;
diff --git a/src/tools/moc/moc.h b/src/tools/moc/moc.h
index 494d53e..767f84e 100644
--- a/src/tools/moc/moc.h
+++ b/src/tools/moc/moc.h
@@ -115,10 +115,11 @@ struct FunctionDef
struct PropertyDef
{
- PropertyDef():notifyId(-1), constant(false), gspec(ValueSpec){}
+ PropertyDef():notifyId(-1), constant(false), final(false), gspec(ValueSpec){}
QByteArray name, type, read, write, reset, designable, scriptable, editable, stored, user, notify;
int notifyId;
bool constant;
+ bool final;
enum Specification { ValueSpec, ReferenceSpec, PointerSpec };
Specification gspec;
bool stdCppSet() const {