You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This example consists of a graphical QML frontend and a "mock" QML backend. By a mock backend is meant that it only returns hardcoded values rather than providing the required functionality. The resulting application will be displayed using Qt `qml` viewer.
* Download Qt Online Installer from [qt.io](https://www.qt.io/download-qt-installer-oss). More info at [doc.qt.io](https://doc.qt.io/qt-6/qt-online-installation.html).
23
36
* Install Qt for desktop development using a custom installation that includes the following components:
24
37
* Qt
@@ -31,9 +44,22 @@ This example consists of a graphical QML frontend and a "mock" QML backend. By a
31
44
* [] Developer and Designer Tools
32
45
* [x] Qt Creator x.y.z
33
46
47
+
### VSCode
48
+
* Download an install VSCode
49
+
* Add the python extension
50
+
* Rename the folder `vscode` to `.vscode`. The `launch.json` file will then be read by VSCode
51
+
* Select any python file in the repo and choose the desired python environment
52
+
53
+
54
+
## How to run
55
+
56
+
### Type I Examples: BasicQml (QML runtime with QML backend)
57
+
58
+
This example is located in `examples/BasicQml` and the source code is in the subfolder `src/BasicQml`. The example consists of a graphical QML frontend (`Gui/Application.qml`) and a QML backend (`Logic/Mock/BackendProxy.qml`). It is considered a mock backend as it only returns hardcoded values rather than providing the required functionality. The entry point for Qt is `main.qml`, whcih can be displayed using Qt `qml` viewer.
59
+
34
60
#### Qt Creator IDE (QML Runtime)
35
61
* Run Qt Creator
36
-
* Open the qml project file `*.qmlproject` from the example folder from `examples/BasicQml/src/BasicQml.qmlproject`
62
+
* Open the qml project file `*.qmlproject` from the example folder from `src/BasicQml.qmlproject`
37
63
* Click Run (Green play button)
38
64
39
65
#### Run from the terminal (QML Runtime)
@@ -50,7 +76,6 @@ This example consists of a graphical QML frontend and a "mock" QML backend. By a
50
76
```
51
77
52
78
#### How to edit GUI elements in live mode
53
-
54
79
* In Qt Creator, select the `.qml` file to be edited in live mode
55
80
* Click the `Design` button at the top of the left sidebar of `Qt Creator`
56
81
*_Note: If this button is disabled, find and click `About plugins...` in the `Qt Creator` menu, scroll down to the `Qt Quick` section and enable `QmlDesigner`._
@@ -60,41 +85,16 @@ This example consists of a graphical QML frontend and a "mock" QML backend. By a
60
85
61
86
### Type II Examples: BasicMinimalPy (Python runtime with QML backend)
62
87
63
-
This example serves to demonstrate how an application with a QML frontend and a QML "mock" backend can be executed from Python.
64
-
65
-
Most examples can be run via Python, even if they only have a mock backend in QML (the Python backend is not implemented). The minimum configuration requires a base `main.py` file. To execute this one needs to the following:
66
-
67
-
#### Preparation
68
-
69
-
* Download and install the Qt Framework following the instruction above for the Type I example
70
-
* Install the Qt PySide6 module in the desired python environment
This example is located in `examples/BasicMinimalPy` with the source code in `src/BasicMinimalPy`. This example serves to demonstrate how an application with a QML frontend and a QML backend (similar to the Type I example) can be executed from Python. The entry point for the Python program is `main.py` file. To execute this do the following:
87
89
88
90
#### QtCreator IDE (Python Runtime)
89
91
* Run Qt Creator
90
92
* Open the python project file `*.pyproject` from the example folder from `examples/BasicMinimalPy/src/BasicMinimalPy.pyproject`
91
-
* Select the desired python environment with the Qt PySide6 module installed
93
+
* Select the desired python environment with the Qt `PySide6` module installed
92
94
* Click Run (Green play button)
93
95
94
96
#### VSCode IDE (Python Runtime)
95
97
* Open the repo in VSCode
96
-
* Rename the folder `vscode` to `.vscode`. The `launch.json` file will then be read by VSCode
97
-
* Select any python file in the repo and choose the desired python environment
98
98
* Click on the debug extension and select which example to execute
@@ -112,9 +112,7 @@ Most examples can be run via Python, even if they only have a mock backend in QM
112
112
113
113
### Type III Examples: BasicPy and IntermediatePy (Python runtime with Py backend)
114
114
115
-
These examples demonstrate how to use a Python runtime to execute the QML frontend and a Python backend.
116
-
117
-
These examples can be run through Python in the same way as Type II described above. These examples have a Python-based backend (proxy object), which is created in `main.py` and then get exposed to QML. Communication between the Qt QML frontend and the Python backend occurs through this python proxy.
115
+
These examples demonstrate how to use a Python runtime to execute the QML frontend and the Python backend located in `Logic/Py/backend_proxy.py`. These examples can be run through Python in the same way as Type II described above. These examples have a Python-based backend (proxy object), which gets created in `main.py` and then exposed to QML. The Qt QML frontend then acceses the backend by calling methods exposed by the proxy object in the `Py` folder.
0 commit comments