aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/doc/snippets/qmltc/special/HelloWorld.qml.cpp2
-rw-r--r--src/qml/doc/snippets/qmltc/tst_qmltc_examples.cpp5
-rw-r--r--src/qml/doc/src/tools/qtquickcompiler/qtqml-qml-type-compiler.qdoc11
3 files changed, 13 insertions, 5 deletions
diff --git a/src/qml/doc/snippets/qmltc/special/HelloWorld.qml.cpp b/src/qml/doc/snippets/qmltc/special/HelloWorld.qml.cpp
index eda9009bb7..0afbcbf0bf 100644
--- a/src/qml/doc/snippets/qmltc/special/HelloWorld.qml.cpp
+++ b/src/qml/doc/snippets/qmltc/special/HelloWorld.qml.cpp
@@ -22,7 +22,7 @@ class HelloWorld : public QObject
Q_PROPERTY(QString hello WRITE setHello READ hello BINDABLE bindableHello)
public:
- HelloWorld(QQmlEngine* engine, QObject* parent = nullptr);
+ HelloWorld(QQmlEngine* engine, QObject* parent = nullptr, [[maybe_unused]] qxp::function_ref<void(PropertyInitializer&)> initializer = [](PropertyInitializer&){});
Q_SIGNALS:
void created();
diff --git a/src/qml/doc/snippets/qmltc/tst_qmltc_examples.cpp b/src/qml/doc/snippets/qmltc/tst_qmltc_examples.cpp
index 7bda70f985..8c2706531b 100644
--- a/src/qml/doc/snippets/qmltc/tst_qmltc_examples.cpp
+++ b/src/qml/doc/snippets/qmltc/tst_qmltc_examples.cpp
@@ -53,7 +53,10 @@ void tst_qmltc_examples::app()
QQmlEngine e;
QQuickWindow window;
- QScopedPointer<QmltcExample::myApp> documentRoot(new QmltcExample::myApp(&e));
+ QScopedPointer<QmltcExample::myApp> documentRoot(
+ new QmltcExample::myApp(&e, nullptr, [](auto& component){
+ component.setWidth(800);
+ }));
documentRoot->setParentItem(window.contentItem());
window.setHeight(documentRoot->height());
diff --git a/src/qml/doc/src/tools/qtquickcompiler/qtqml-qml-type-compiler.qdoc b/src/qml/doc/src/tools/qtquickcompiler/qtqml-qml-type-compiler.qdoc
index b512be1b7e..dc525f3428 100644
--- a/src/qml/doc/src/tools/qtquickcompiler/qtqml-qml-type-compiler.qdoc
+++ b/src/qml/doc/src/tools/qtquickcompiler/qtqml-qml-type-compiler.qdoc
@@ -113,9 +113,14 @@ Unlike in the case of QQmlComponent instantiation, the output of qmltc, being
C++ code, is used directly by the application. Generally, constructing a new
object in C++ is equivalent to creating a new object through
QQmlComponent::create(). Once created, the object could be manipulated from C++
-or, for example, combined with QQuickWindow to be drawn on screen. Given a
-\c{myApp.qml} file, the application code (in both cases) would typically look
-like this:
+or, for example, combined with QQuickWindow to be drawn on screen.
+
+Additionally, the constructor for a qmltc object can be provided with
+with a callback to set up initial values for the component's
+properties.
+
+Given a \c{myApp.qml} file, the application code (in both cases) would
+typically look like this:
\if defined(onlinedocs)
\tab {generated-c++}{tab-qqmlcomponent}{Using QQmlComponent}{checked}