Commit Graph

18 Commits

Author SHA1 Message Date
Fabian Kosmale 677229cb59 Coffee example: Fix slider synchronization
Use Synchronizer to synchronize different coffee
slider values with CoffeeConfig.

Set sugarAmount to 0 by default.

Change docs to reflect new implementation.

Fixes the synchronization issue with sugar value.

Pick-to: 6.10
Fixes: QTBUG-138676
Change-Id: Ic73066df3ab2a4281aaf885547f22d2a3bdf662d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-08-07 11:34:19 +03:00
Fabian Kosmale 89a6ad7466 coffee example: Prepare to restore Qt 6.10 compatibility
We can't have cyclic dependencies between types in 6.10.

To reduce the cyclic dependency, we are extracting the coffee settings
into their own type.
The next commit will then (targeting only 6.10) replace ApplicationFlow
properties with var properies.
Reducing the coupling further by extracting the navigation functions
into yet another type is left as a future exercise.

Also, note the opportunity to fix the PropertyChanges in Progress.qml to
not reference a non-local id (which now wouldn't work anymore) – that
wasn't caught by qmllint because PropertyChanges is custom parsed, and
the only way to avoid this is to use the new syntax – but the warning
for that has been turned off due to QDS compatabililty.

Task-number: QTBUG-138898
Change-Id: I6ae97a567350c98dcd8056ac8433858b0b8aec6f
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
(cherry picked from commit 5b075084fa)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
2025-08-05 13:55:53 +00:00
Fabian Kosmale 79d24cacfb coffee example: Clean up dataflow (7/n)
Move the orientation value into its own singleton; it's not directly
coffee related, and we want to make use of it in many places, including
ui files, where we don't really want to have a dependency
ApplicationForm (so that they can be still be opened in QDS).

Pick-to: 6.10
Task-number: QTBUG-138164
Change-Id: Ib60fe29e814af2e564a33239ba36afd0d7bf9537
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-07-18 10:04:28 +02:00
Fabian Kosmale 7ff06dc1da coffee example: Clean up dataflow (6/n)
Avoid coupling CustomToolBar to ApplicationFlow. Instead, give
CustomToolBar its own signals, and emit them when the buttons are
clicked.
Add the signal handling logic to ApplicationFlow.

Pick-to: 6.10
Task-number: QTBUG-138164
Change-Id: I96c98750f99cb4529bf47dd27a22a55bcecfa20f
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-07-18 10:04:20 +02:00
Fabian Kosmale 70f1b0756e coffee example: fix some unqualified id warnings
Task-number: QTBUG-138164
Change-Id: I4d708d23218a87d568fe18b322d0b7bb182d2ea0
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-07-18 10:04:11 +02:00
Fabian Kosmale daf3f87430 coffee example: Clean up dataflow (4/n)
Deal with Home. Home differs from the other pages, because it is used as
the initial item, and thus an actual instance is already created in the
ui.qml file, not only a Component.
As we still want to use a required property referencing the
ApplicationFlow instance, the instantiation is moved into
ApplicationFlow (instead of ApplicationFlowForm).

Pick-to: 6.10
Task-number: QTBUG-138164
Change-Id: I903352e17560c056fdb12e370ee5413adbe2fd1d
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-07-18 10:04:04 +02:00
Fabian Kosmale 1c77d5ec77 coffee example: Clean up dataflow (3/n)
Apply the common pattern to the remaining sub-pages, besides Home.

Pick-to: 6.10
Task-number: QTBUG-138164
Change-Id: Ic79547d04b97285981afb206ba2db79309c629fd
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-07-18 10:04:01 +02:00
Fabian Kosmale d2bb2585f2 coffee example: Clean up dataflow (2/n)
Make the dependency on AppicationFlow explicit in Progress by using a
required property. Use that to move the binding to ApplicationFlow's
properties into Progress itself, instead of setting them up in the
"progress" component – this reduces the dependency of
ApplicationFlowForm on its derived type. Initialize the required
property when pushing the component on the StackView.

As a drive-by, use the more modern pushItem function instead of push.

Pick-to: 6.10
Task-number: QTBUG-138164
Change-Id: I9e483c97b7585cef2fed043aa3a5ab35a4b54b10
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-07-18 10:03:57 +02:00
Fabian Kosmale 12b2da0621 coffee example: Clean up dataflow (1/n)
Make the dependency on AppicationFlow explicit in Settings by using a
required property. Use that to move the binding to ApplicationFlow's
properties into settings itself, instead of setting them up in the
"settings" component – this reduces the dependency of
ApplicationFlowForm on its derived type. Initialize the required
property when pushing the component on the StackView.

As a drive-by, use the more modern pushItem function instead of push.

Pick-to: 6.10
Task-number: QTBUG-138164
Change-Id: I47f2931d57ccd66c47775923a15e23d371afa6d1
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2025-07-18 10:03:54 +02:00
Konsta Alajärvi 0cac392e36 Separate UI from business logic on re-designed Coffee Machine example
Added .ui.qml counterpart files for components that needed separation
between the UI and business logic.

Rebased to dev to get the newest changes

Added Cup snippet tags to ProgressForm.ui.qml

Added AbstractButton snippet tags to CoffeeCardForm.ui.qml

Fix ambiguous id's and corresponding property aliases in CoffeeCardForm.ui.qml

Added qdoc snippet tags to ChoosingCoffeeForm.ui.qml

Fixed incorrect file paths in snippet tags in coffee.qdoc

Moved transitions from ProgressForm.ui.qml to Progress.qml
as they did not work properly from there to make the coffee cup
animation work properly.

Added property alias "contentItem" to ProgressForm.ui.qml
to access it's properties from Progress.qml to make the progress bar
animation work properly.

Fixed x coordinates in custom sliders so that the slider handle
will not go over the slider bar and become unresponsive.

Removed "brewTime" property int from ProgressForm.ui.qml as it was
not needed there.

* Fixed x coordinate in Sliders to work like they are described
in official documentation.

* Created property int in Progress.qml to better describe cup animation
velocity factor.

Fixes: QTBUG-120280
Pick-to: 6.6 6.7
Change-Id: I3ed0e1c6777674e2d9502aab1e5c670b6099f60a
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
2024-02-08 10:18:18 +02:00
Nicholas Bennett f167a114ea Docs: Coffee Machine application example app documentation update
Added material under Adapting to different screens.

Added section Navigating through the app pages.

Added material to Implementing start page and
Implementing Coffee selection sections.

Added code snippets that will replace the precviously used
\quotefromfile.

Added material to cover the rest of the code.

Added snippet identifiers to source code.

Removed trailing whitespaces.

* Fixed grammatical issues.

Fixes: QTBUG-116406
Pick-to: 6.6 6.7
Change-Id: I30c4d8a3f7a159d03df70b960059c11472f942bb
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Reviewed-by: Rami Potinkara <rami.potinkara@qt.io>
2023-12-18 06:26:05 +00:00
Konsta Alajärvi b40aaf48ca Re-design for Coffee Machine example
Implementing new design for Coffee Machine example, more information
on how the new design is going to look like in QTBUG-116402 and in
its subtasks.

Removed unused imports folder.

Changed the names of Home.ui.qml to Home.qml and FilledCup.qml to
Cup.qml in Coffee.qrc file.

Changed the names of the files stated above also in qmldir.

Fixes: QTBUG-116403
Fixes: QTBUG-116402
Task-number: QTBUG-116404
Change-Id: Ib4d33e28ce1e3f268172007e85f36eb1280d11a4
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-11-24 11:42:21 +02:00
Jakub Wincenciak 182521e226 Fix bug in Coffe example causing app stuck when user made a second coffe
The bug was due to the fact that when the coffee was finished brewing,
the state was being set to "initial" which was unnecessary.
So I decided to remove this part of code, which solved the bug.

Task-number: QTBUG-114375
Pick-to: 6.5 6.6
Change-Id: I7c8cbc96330574f0378ea8d1ee3ac2a4732f70e3
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2023-10-10 10:40:53 +02:00
Thomas Hartmann 910e28a7f1 Fix qmllint issues in coffee demo
* Removing usused imports
* Removing versions from imports
* The state property is a string

Change-Id: I2a7c8de17c414a20984830b964f9386f92a2cb00
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2023-06-19 17:47:33 +00:00
Lucie Gérard 6f57506953 Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
License files are organized under LICENSES directory.

Pick-to: 6.4
Task-number: QTBUG-67283
Change-Id: Idfd176b7f7b077a5b7c66b7738dc9bcac94ab290
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2022-06-07 18:23:52 +02:00
Kai Koehne 9194f8602b examples: Do not use versioned QML import
Ignore .ui.qml files though for now, until they are properly handled
by Qt Design Studio.

Task-number: QTBUG-89033
Change-Id: I85ea1dc2f85928e9fa1f473535687ab8b0288e9d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-12-02 16:04:51 +01:00
Venugopal Shivashankar 70ce5f4d3e Move demos to qtdoc repository
These demos use several modules and moving them allows to use for
example Qt Quick Controls 2 in them.

The shared directory should be removed and the examples made
self-contained.

Change-Id: I5dc667d22388651894d7d145b65752bc5c5cf6cf
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2018-07-09 12:43:59 +00:00
Nico Vertriest d6686a578d Doc: Move coffeemachine examples to examples/demos
-Also add license file for TitilliumWeb-Regular.ttf
-Add qt_qttribution.json and LICENSE.txt

Task-number: QTBUG-68357
Change-Id: I705a28ed9f113e7ad3cca1b93eb162cc223d9d2d
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2018-06-07 11:07:19 +00:00