Add part 1 of colorpalette example
This example is based on "Qt Quick Demo - RESTful API client".
The purpose is to use our colorpalette client generated files.
Expose QtOAIColorsApi singleton as a Foreign type.
For now the example only communicates with the default server of
colorpalette spec: Qt-based REST API server example.
Most qml code is copied from the existing example.
My changes:
* In Main.qml:
- Removed the 'loginService', 'colors', and 'colorViewUsers'
properties from ColorView.
The ColorView now directly accesses the global singleton API
(ColorsApi and in the follow-up patch UsersApi) for data and login
management.
* In ColorView.qml
- Add "Connections".
- Component.onCompleted and onCurrentColorPageChanged actions
- Modify colorListView's model: Replace required external
PaginatedResource "data" property with the local colorListModel
filled via the newly added fetchColors() function.
- Add a popup that warns about a connection failure when the server
is not available and a button inside it to try to get colors again.
- Add a resetState() function.
- Moved pagination logic from the external PaginatedResource colors
object to the local root component properties "currentColorPage" and
"totalColorPages".
The docs will be provided in a follow-up patch.
Task-number: QTBUG-140020
Change-Id: If168a504c98320badff8dbd5842e85549773926f
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>