diff options
author | Juergen Bocklage-Ryannel <juergen.bocklage-ryannel@pelagicore.com> | 2016-09-11 16:50:57 +0200 |
---|---|---|
committer | Juergen Ryannel <juergen.bocklage-ryannel@pelagicore.com> | 2016-11-30 10:01:20 +0100 |
commit | 7da6214e25892cb3c9495814db3a5f0269191405 (patch) | |
tree | 5506b244a2d4a73318435e4ea2f8a42095bd493a /docs | |
parent | 69223115b4b969344c43bc6ffbb6cb223d5524b8 (diff) |
Added initial documentation for QTCPP generator. Figured out it is not good to generate the .pro file.
Diffstat (limited to 'docs')
-rw-r--r-- | docs/generator_qtcpp.rst | 57 | ||||
-rw-r--r-- | docs/index.rst | 1 |
2 files changed, 58 insertions, 0 deletions
diff --git a/docs/generator_qtcpp.rst b/docs/generator_qtcpp.rst new file mode 100644 index 0000000..a11f7c5 --- /dev/null +++ b/docs/generator_qtcpp.rst @@ -0,0 +1,57 @@ +QtCPP Generator +=============== + +This is one of the buit-in generators to generate a QtCPP API to be exported into QML. +The structs/enums/flags are defined in an own Module Qbject which acts as a namespace and can not be instantiated. + +Each interface is generated into a QObject with proper properties, signals and invokables. + +For example an QDL like this: + +.. code-block:: text + + module sample 1.0 + + interface Heater { + real temperature; + Status status; + void increaseTemperature(qreal step); + void decreaseTemperature(qreal step); + event void error(string message); + } + + enum Status { + Null, + Ready, + Error + } + +The QTCPP generator will generate all CPP code including the plugin code and project files. Additional it will generate an empy simulation stub. + +In QML you would now be able to write the following code. + +.. code-block:: qml + + import sample 1.0 + + Item { + Heater { + id: heater + onStatusChanged: { + if(status === SampleModule.Ready) { + console.log('ready ...') + } + } + onError: console.log(message) + } + Text { + anchors.centerIn: parent + text: heater.temperature + } + MouseArea { + anchors.fill: parent + onClicked: { + heater.increaseTemperature(0.5) + } + } + } diff --git a/docs/index.rst b/docs/index.rst index 31f303a..bf38f8a 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -10,6 +10,7 @@ QFace is a flexible Qt API generator. It uses a common IDL format (called qdl) t writing_idl idl_grammar writing_generator + generator_qtcpp domain api |