|
|
383017 |
From 4ee1462686dc12eb463f5ba6b378d43a39aed074 Mon Sep 17 00:00:00 2001
|
|
|
383017 |
From: Fabian Kosmale <fabian.kosmale@qt.io>
|
|
|
383017 |
Date: Thu, 12 Nov 2020 12:11:29 +0100
|
|
|
383017 |
Subject: [PATCH 05/28] QQuickView docs: show correct usage of
|
|
|
383017 |
setInitialProperties
|
|
|
383017 |
|
|
|
383017 |
Change-Id: If63f4c59f18bc0754ce2e68e424f6efd0f512d30
|
|
|
383017 |
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
|
|
|
383017 |
(cherry picked from commit 54d4f8f526f9c9a1af702b14925e1d34ee8b2134)
|
|
|
383017 |
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
|
|
|
383017 |
---
|
|
|
383017 |
src/quick/doc/snippets/qquickview-ex.cpp | 9 +++++++++
|
|
|
383017 |
src/quick/items/qquickview.cpp | 4 ++++
|
|
|
383017 |
2 files changed, 13 insertions(+)
|
|
|
383017 |
|
|
|
383017 |
diff --git a/src/quick/doc/snippets/qquickview-ex.cpp b/src/quick/doc/snippets/qquickview-ex.cpp
|
|
|
383017 |
index 32406f8f2f..5f93dfdbe8 100644
|
|
|
383017 |
--- a/src/quick/doc/snippets/qquickview-ex.cpp
|
|
|
383017 |
+++ b/src/quick/doc/snippets/qquickview-ex.cpp
|
|
|
383017 |
@@ -59,3 +59,12 @@ int main(int argc, char *argv[])
|
|
|
383017 |
return app.exec();
|
|
|
383017 |
}
|
|
|
383017 |
//![0]
|
|
|
383017 |
+
|
|
|
383017 |
+void makeDocTeamHappyByKeepingExampleCompilable() {
|
|
|
383017 |
+//![1]
|
|
|
383017 |
+ QScopedPointer<QQuickView> view { new QQuickView };
|
|
|
383017 |
+ view->setInitialProperties({"x, 100"}, {"width", 50});
|
|
|
383017 |
+ view->setSource(QUrl::fromLocalFile("myqmlfile.qml"));
|
|
|
383017 |
+ view->show();
|
|
|
383017 |
+//![1]
|
|
|
383017 |
+}
|
|
|
383017 |
diff --git a/src/quick/items/qquickview.cpp b/src/quick/items/qquickview.cpp
|
|
|
383017 |
index 97f6689d8a..b3a5270e9b 100644
|
|
|
383017 |
--- a/src/quick/items/qquickview.cpp
|
|
|
383017 |
+++ b/src/quick/items/qquickview.cpp
|
|
|
383017 |
@@ -240,7 +240,11 @@ void QQuickView::setSource(const QUrl& url)
|
|
|
383017 |
Sets the initial properties \a initialProperties with which the QML
|
|
|
383017 |
component gets initialized after calling \l QQuickView::setSource().
|
|
|
383017 |
|
|
|
383017 |
+ \snippet qquickview-ex.cpp 1
|
|
|
383017 |
+
|
|
|
383017 |
\note You can only use this function to initialize top-level properties.
|
|
|
383017 |
+ \note This function should always be called before setSource, as it has
|
|
|
383017 |
+ no effect once the component has become \c Ready.
|
|
|
383017 |
|
|
|
383017 |
\sa QQmlComponent::createWithInitialProperties()
|
|
|
383017 |
\since 5.14
|
|
|
383017 |
--
|
|
|
383017 |
2.31.1
|
|
|
383017 |
|