diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-07-13 15:20:46 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-07-14 17:06:46 +0200 |
commit | 8cdaeb26552313e7b9d67fa062a3d9ff597c2e06 (patch) | |
tree | 7ba18ecdb22417bb38c756f5379c6dd991b5000a /src/tools/moc/moc.cpp | |
parent | bb6a73260ec8272647265f42180963604ad0f755 (diff) |
moc: allow wrapper generation for QProperty in pimpl class
Previously, only QNotifiedProperty was supported. As moc cannot
determine by itself whether the backing property is a QProperty or a
QNotifiedProperty, allow NOTIFY false to indicate that it is a plain
QProperty. For symmetry, NOTIFY true is also allowed and means that the
backing property is a QNotifiedProperty.
Change-Id: I66f3105c976ef084198ce8658bc07499a3cb1cd8
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/tools/moc/moc.cpp')
-rw-r--r-- | src/tools/moc/moc.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index 6acabbf2ce..ad9c684541 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -1387,8 +1387,19 @@ void Moc::parsePropertyAttributes(PropertyDef &propDef) checkIsFunction(propDef.designable, "DESIGNABLE"); break; case 'N': if (l != "NOTIFY") error(2); - propDef.notify = v; - break; + if (v == "false") { + if (!propDef.isQProperty) + error(1); + propDef.isQPropertyWithNotifier = false; + break; + } else if (v == "true") { + if (!propDef.isQProperty) + error(1); + break; + } else { + propDef.notify = v; + break; + } case 'U': if (l != "USER") error(2); propDef.user = v + v2; checkIsFunction(propDef.user, "USER"); @@ -1543,7 +1554,7 @@ void Moc::parsePrivateQProperty(ClassDef *def) propDef.qpropertyname = stored ? name : (name + "()"); def->privateQProperties += PrivateQPropertyDef { - type, name, setter, accessor, propDef.qpropertyname + type, name, setter, accessor, propDef.qpropertyname, propDef.isQPropertyWithNotifier }; if (propDef.read.isEmpty()) |