summaryrefslogtreecommitdiffstats
path: root/src/tools/moc/moc.h
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2020-04-15 20:23:28 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2020-04-30 19:39:25 +0200
commit3d7265db9075db7b22b241b659f23d392d62d804 (patch)
tree902bb831d91f39b89d4481dca9381a18abb5dac3 /src/tools/moc/moc.h
parentb480acb3720c0d61c5c69a2b861af63b9d7c9f86 (diff)
Provide a way of exposing private QProperties with a fake API
The API reduces the amount of manual plumbing required to offer a conceptual property through the traditional setter/getter API as well as through QProperty<T> API. Since the latter would require inlining the type and thus making it impossible to add new properties without breaking binary compatibility, this patch introduces a fake API that behaves similar but does not contain the property by value. Change-Id: Ib9bccd867f0e4e36a520e5583ba348e728284253 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/tools/moc/moc.h')
-rw-r--r--src/tools/moc/moc.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/tools/moc/moc.h b/src/tools/moc/moc.h
index 210b6c7c2a..486d033049 100644
--- a/src/tools/moc/moc.h
+++ b/src/tools/moc/moc.h
@@ -148,6 +148,14 @@ struct PropertyDef
};
Q_DECLARE_TYPEINFO(PropertyDef, Q_MOVABLE_TYPE);
+struct PrivateQPropertyDef
+{
+ Type type;
+ QByteArray name;
+ QByteArray setter;
+ QByteArray accessor;
+};
+Q_DECLARE_TYPEINFO(PrivateQPropertyDef, Q_MOVABLE_TYPE);
struct ClassInfoDef
{
@@ -191,6 +199,7 @@ struct ClassDef : BaseDef {
QVector<FunctionDef> signalList, slotList, methodList, publicList;
QVector<QByteArray> nonClassSignalList;
QVector<PropertyDef> propertyList;
+ QVector<PrivateQPropertyDef> privateQProperties;
QSet<QByteArray> qPropertyMembers;
int notifyableProperties = 0;
int revisionedMethods = 0;
@@ -258,6 +267,7 @@ public:
void parseProperty(ClassDef *def);
void parsePluginData(ClassDef *def);
void createPropertyDef(PropertyDef &def);
+ void parsePropertyAttributes(PropertyDef &propDef);
void parseEnumOrFlag(BaseDef *def, bool isFlag);
void parseFlag(BaseDef *def);
void parseClassInfo(BaseDef *def);
@@ -266,7 +276,9 @@ public:
void parseDeclareMetatype();
void parseMocInclude();
void parseSlotInPrivate(ClassDef *def, FunctionDef::Access access);
+ QByteArray parsePropertyAccessor();
void parsePrivateProperty(ClassDef *def);
+ void parsePrivateQProperty(ClassDef *def);
void parseFunctionArguments(FunctionDef *def);