aboutsummaryrefslogtreecommitdiffstats
path: root/src/quicktemplates2
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2021-06-08 15:58:18 +0200
committerMitch Curtis <mitch.curtis@qt.io>2021-06-10 14:33:09 +0200
commit332011c8e6a96cd2b0c685b72f96337660f690e0 (patch)
tree9952ca1f799b65c7fd91d0a65ab043b92361fbbe /src/quicktemplates2
parentde66c7e6c4ae03d1da2225dc443a028bf5f6e722 (diff)
Doc: some ComboBox functions must be used after component completion
The internal QQmlDelegate model may not be ready until after componentComplete() is called. For example, the following code will print -1 for the find call, even though printing the model will show the "Hello" entry: ComboBox { id: comboBug anchors.centerIn: parent model: ["123", "BlaBla", "Hello", "Turtle"] currentIndex: { console.log("Model: " + comboBug.model) console.log("Find: " + comboBug.find("Hello")) return comboBug.find("Hello") } } Fixes: QTBUG-94257 Pick-to: 6.1 6.2 Change-Id: I6e8c2a4eb8ca7ffca0a38d2f2e914cf791d3bd2e Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'src/quicktemplates2')
-rw-r--r--src/quicktemplates2/qquickcombobox.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp
index 71fb33c8..c94fbee8 100644
--- a/src/quicktemplates2/qquickcombobox.cpp
+++ b/src/quicktemplates2/qquickcombobox.cpp
@@ -1659,6 +1659,8 @@ QVariant QQuickComboBox::valueAt(int index) const
For an example of how to use this method, see \l {ComboBox Model Roles}.
+ \include qquickcombobox.qdocinc functions-after-component-completion
+
\sa find(), currentValue, currentIndex, valueRole
*/
int QQuickComboBox::indexOfValue(const QVariant &value) const
@@ -1772,6 +1774,10 @@ void QQuickComboBox::setImplicitContentWidthPolicy(QQuickComboBox::ImplicitConte
Returns the text for the specified \a index, or an empty string
if the index is out of bounds.
+ \include qquickcombobox.qdocinc functions-after-component-completion
+ For example:
+ \snippet qtquickcontrols2-combobox-textat.qml textat
+
\sa textRole
*/
QString QQuickComboBox::textAt(int index) const
@@ -1801,6 +1807,10 @@ QString QQuickComboBox::textAt(int index) const
\value Qt.MatchContains The search term is contained in the item.
\value Qt.MatchCaseSensitive The search is case sensitive.
+ \include qquickcombobox.qdocinc functions-after-component-completion
+ For example:
+ \snippet qtquickcontrols2-combobox-find.qml find
+
\sa textRole
*/
int QQuickComboBox::find(const QString &text, Qt::MatchFlags flags) const