aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2023-01-23 16:14:03 +0800
committerMitch Curtis <mitch.curtis@qt.io>2023-01-25 01:47:46 +0000
commit70f1732ee6f9ad3c895061acd55cef3e21c5094f (patch)
treebc317c19bc73f8815c010f087a378e6cfa6e2e54 /src
parent05908e67a2a281b56bad503490e5c9121e9f285a (diff)
Doc: explain how to manage currentIndex without breaking bindings
There is a section for this on Container's page, so let's link to it in more places. Task-number: QTBUG-109996 Pick-to: 6.5 6.2 Change-Id: I8c96f0cb0998d65a2c2669b6358236a14e0352dc Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/quickcontrols/doc/src/includes/container-currentindex.qdocinc9
-rw-r--r--src/quicktemplates/qquickswipeview.cpp2
-rw-r--r--src/quicktemplates/qquicktabbar.cpp2
3 files changed, 13 insertions, 0 deletions
diff --git a/src/quickcontrols/doc/src/includes/container-currentindex.qdocinc b/src/quickcontrols/doc/src/includes/container-currentindex.qdocinc
new file mode 100644
index 0000000000..9fcf43e168
--- /dev/null
+++ b/src/quickcontrols/doc/src/includes/container-currentindex.qdocinc
@@ -0,0 +1,9 @@
+//! [file]
+When \1 is paired with another container such as \l \2, it is
+necessary to make a two-way binding between the
+\l {Container::}{currentIndex} property
+of each control. To do this without breaking bindings, avoid setting
+\c currentIndex directly, and instead use
+\l {Container::}{setCurrentIndex()}, for example.
+See \l {Managing the Current Index} for more information.
+//! [file]
diff --git a/src/quicktemplates/qquickswipeview.cpp b/src/quicktemplates/qquickswipeview.cpp
index e19211e5ae..fe647f5764 100644
--- a/src/quicktemplates/qquickswipeview.cpp
+++ b/src/quicktemplates/qquickswipeview.cpp
@@ -37,6 +37,8 @@ QT_BEGIN_NAMESPACE
\l {Container::moveItem()}{move}, and \l {Container::removeItem()}{remove}
pages dynamically at run time.
+ \include container-currentindex.qdocinc {file} {SwipeView} {TabBar}
+
It is generally not advisable to add excessive amounts of pages to a
SwipeView. However, when the amount of pages grows larger, or individual
pages are relatively complex, it may be desirable to free up resources by
diff --git a/src/quicktemplates/qquicktabbar.cpp b/src/quicktemplates/qquicktabbar.cpp
index 3894d90af3..2ea62e4e89 100644
--- a/src/quicktemplates/qquicktabbar.cpp
+++ b/src/quicktemplates/qquicktabbar.cpp
@@ -35,6 +35,8 @@ QT_BEGIN_NAMESPACE
items dynamically at run time. The items can be accessed using
\l {Container::}{itemAt()} or \l {Container::}{contentChildren}.
+ \include container-currentindex.qdocinc {file} {TabBar} {SwipeView}
+
\section2 Resizing Tabs
By default, TabBar resizes its buttons to fit the width of the control.