diff options
| author | Olivier De Cannière <olivier.decanniere@qt.io> | 2024-11-28 15:35:18 +0100 |
|---|---|---|
| committer | Olivier De Cannière <olivier.decanniere@qt.io> | 2025-01-14 19:15:40 +0100 |
| commit | 405fb70437a1a576e032dda61d880e49f10f6f9b (patch) | |
| tree | db0e676089203402c402c55611037f6cce040869 /tools | |
| parent | 86e4eecb6ab95eb681184f9f8fc6591392379d9b (diff) | |
qmltc: Add READ before WRITE in generated Q_PROPERTYs
We currently have two orderings for the READ and WRITE elements of the
macro depending on whether we compile a property or an alias. Make them
uniform by having READ before WRITE in both cases.
Change-Id: I1dd308c921b8948347029c603bc3bca2be87abda
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/qmltc/qmltccompiler.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tools/qmltc/qmltccompiler.cpp b/tools/qmltc/qmltccompiler.cpp index a78af67a9a..7ad038aaa4 100644 --- a/tools/qmltc/qmltccompiler.cpp +++ b/tools/qmltc/qmltccompiler.cpp @@ -887,6 +887,14 @@ void QmltcCompiler::compileProperty(QmltcType ¤t, const QQmlJSMetaProperty // 1. add setter and getter // If p.isList(), it's a QQmlListProperty. Then you can write the underlying list through // the QQmlListProperty object retrieved with the getter. Setting it would make no sense. + QmltcMethod getter{}; + getter.returnType = underlyingType; + getter.name = compilationData.read; + getter.body << u"return " + variableName + u".value();"; + getter.userVisible = true; + current.functions.emplaceBack(getter); + mocPieces << u"READ"_s << getter.name; + if (p.isWritable() && !qIsReferenceTypeList(p)) { QmltcMethod setter {}; setter.returnType = u"void"_s; @@ -901,14 +909,6 @@ void QmltcCompiler::compileProperty(QmltcType ¤t, const QQmlJSMetaProperty mocPieces << u"WRITE"_s << setter.name; } - QmltcMethod getter {}; - getter.returnType = underlyingType; - getter.name = compilationData.read; - getter.body << u"return " + variableName + u".value();"; - getter.userVisible = true; - current.functions.emplaceBack(getter); - mocPieces << u"READ"_s << getter.name; - // 2. add bindable if (!qIsReferenceTypeList(p)) { QmltcMethod bindable {}; |
