aboutsummaryrefslogtreecommitdiffstats
path: root/qface/helper/qtcpp.py
diff options
context:
space:
mode:
authorJuergen Bocklage-Ryannel <juergen.bocklage-ryannel@pelagicore.com>2017-01-10 21:49:11 +0100
committerJuergen Bocklage-Ryannel <juergen.bocklage-ryannel@pelagicore.com>2017-01-10 21:49:11 +0100
commit245a9eaf05fa5e549326e6d1f4b62f132879528d (patch)
treefeb3430d5b8cc93929efcba7baa6f5d8b27cd8d9 /qface/helper/qtcpp.py
parentfb6601b52997b3c6bf5c643522b91089057b8310 (diff)
- added support for singleton tag (@singleton in front of an interface will register the interface as singleton)
- respect now the readonly modifier for properties (no setter is generated) - fixed some issue with model naming in helper filters
Diffstat (limited to 'qface/helper/qtcpp.py')
-rw-r--r--qface/helper/qtcpp.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/qface/helper/qtcpp.py b/qface/helper/qtcpp.py
index f31c7a1..c72c3ee 100644
--- a/qface/helper/qtcpp.py
+++ b/qface/helper/qtcpp.py
@@ -22,6 +22,8 @@ class Filters(object):
return 'false'
if t.name == 'string':
return 'QString()'
+ if t.name == 'real':
+ return '0.0'
elif t.is_void:
return ''
elif t.is_enum:
@@ -33,6 +35,9 @@ class Filters(object):
return 'QVariantList()'.format(nested)
elif symbol.type.is_struct:
return 'Qml{0}()'.format(symbol.type)
+ elif symbol.type.is_model:
+ nested = Filters.returnType(symbol.type.nested)
+ return 'new {0}Model(this)'.format(nested)
return 'XXX'
@@ -48,13 +53,13 @@ class Filters(object):
if symbol.type.name == 'var':
return 'const QVariant &{0}'.format(symbol)
if symbol.type.name == 'real':
- return 'float {0}'.format(symbol)
+ return 'qreal {0}'.format(symbol)
return '{0} {1}'.format(symbol.type, symbol)
elif symbol.type.is_list:
nested = Filters.returnType(symbol.type.nested)
return 'const QVariantList &{1}'.format(nested, symbol)
elif symbol.type.is_model:
- return '{0}Model *{1}'.format(symbol.type.nested, symbol)
+ return 'Qml{0}Model *{1}'.format(symbol.type.nested, symbol)
else:
return 'const {0}{1} &{2}'.format(classPrefix, symbol.type, symbol)
@@ -70,12 +75,12 @@ class Filters(object):
if symbol.type.name == 'var':
return 'QVariant'
if symbol.type.name == 'real':
- return 'float'
+ return 'qreal'
return symbol.type
elif symbol.type.is_list:
nested = Filters.returnType(symbol.type.nested)
return 'QVariantList'.format(nested)
elif symbol.type.is_model:
- return '{0}Model*'.format(symbol.type.nested)
+ return 'Qml{0}Model*'.format(symbol.type.nested)
else:
return '{0}{1}'.format(classPrefix, symbol.type)