summaryrefslogtreecommitdiffstats
path: root/examples/multimedia/declarative-camera/doc/src/declarative-camera.qdoc
diff options
context:
space:
mode:
authorMikko Hallamaa <mikko.hallamaa@qt.io>2023-10-18 12:08:19 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-10-24 19:25:04 +0000
commit8d5e445c31ccf418261f289104f5253f7b232680 (patch)
treebb282efb61bed06f3073ff26013cafc2a4fab75e /examples/multimedia/declarative-camera/doc/src/declarative-camera.qdoc
parentb3dfd80467c0838349905b5b7aa5b20b69fe961f (diff)
Refactor QML Camera example orientation and control layout state logic
In QML Camera example, the state of the photo/video controls that determines the layout those controls was updated by the setState function. This function was called on camera UI width change, and initially only because of stillControls.state being bound to the function. The videoControls.state was then bound to stillControls.state. This caused qmllint warnings (unqualified access to setState() and info message because setState() doesn't return a value) and log spamming whenever the window width changed. The orientation and control layout state logic is now encapsulated in a separate Item "controlLayout", and the stillControls and videoControls objects both bind to the state and buttonsWidth properties of this new Item. Additionally the message about state change is logged only when the state actually changes. Documentation is also updated to display the correct part of the code in the section that mentions the control layout. Task-number: QTBUG-113682 Pick-to: 6.5 Change-Id: I99e5c0c3d3bb369dd985cd06fdb51d687ef24f1f Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io> (cherry picked from commit 2785589db4447d3ea421ba59130d6be4e6574b6b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'examples/multimedia/declarative-camera/doc/src/declarative-camera.qdoc')
-rw-r--r--examples/multimedia/declarative-camera/doc/src/declarative-camera.qdoc16
1 files changed, 11 insertions, 5 deletions
diff --git a/examples/multimedia/declarative-camera/doc/src/declarative-camera.qdoc b/examples/multimedia/declarative-camera/doc/src/declarative-camera.qdoc
index b22c80234..633592aad 100644
--- a/examples/multimedia/declarative-camera/doc/src/declarative-camera.qdoc
+++ b/examples/multimedia/declarative-camera/doc/src/declarative-camera.qdoc
@@ -26,13 +26,19 @@ controls.
\section1 Using screen orientation to select layout
-In \c declarative-camera.qml we handle detecting the orientation we're in and
-select the appropriate layout while also catering for the limitations of small
-screen mobile devices like so:
+The orientation and control layout state logic is encapsulated in a separate
+Item, \c controlLayout like so:
\quotefromfile declarative-camera/declarative-camera.qml
-\skipto Rectangle {
-\printto states: [
+\skipto Item {
+\printto PhotoCaptureControls {
+
+The \c stillControls and \c videoControls objects both bind to the \c state
+and \c buttonsWidth properties of this Item, as shown in \c stillControls:
+
+\printto VideoCaptureControls {
+
+To support debugging, a message about layout state change is logged.
Here is the portrait layout: