aboutsummaryrefslogtreecommitdiffstats
path: root/examples/qml
diff options
context:
space:
mode:
authorNico Vertriest <nico.vertriest@qt.io>2016-12-16 13:14:01 +0100
committerNico Vertriest <nico.vertriest@theqtcompany.com>2017-01-09 09:38:01 +0000
commit27ea28b0f451076e773f9dc78babfdd799c3e0d8 (patch)
tree2759d2c65b8c10b75551be12c74a7c74a4764bba /examples/qml
parent11aef4eec22cac62d7728ee2895efe4cc80cd335 (diff)
Doc: Rearranged order of Extending QML Examples
Rearranged in logical order of example build up Change-Id: I6af8e39bd900d4ce058de46e0b3ebd5e368222c8 Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
Diffstat (limited to 'examples/qml')
-rw-r--r--examples/qml/doc/src/qml-extending.qdoc19
-rw-r--r--examples/qml/referenceexamples/extended/main.cpp4
2 files changed, 19 insertions, 4 deletions
diff --git a/examples/qml/doc/src/qml-extending.qdoc b/examples/qml/doc/src/qml-extending.qdoc
index 0812a3dba1..0cb004be7d 100644
--- a/examples/qml/doc/src/qml-extending.qdoc
+++ b/examples/qml/doc/src/qml-extending.qdoc
@@ -75,9 +75,21 @@ This example builds on:
Shows how to use \l {QQmlEngine::}{qmlRegisterExtendedType()} to provide an \l {Registering
Extension Objects}{extension object} to a \l QLineEdit without modifying or
-subclassing. The QML engine instantiates a \l QLineEdit and sets a property that
-only exists on the extension type. The extension type performs calls on the \l
-QLineEdit that otherwise will not be accessible to the QML engine.
+subclassing.
+
+\snippet referenceexamples/extended/main.cpp 0
+
+The QML engine instantiates a \l QLineEdit
+
+\snippet referenceexamples/extended/main.cpp 1
+
+and sets a property that oly exists on the extension type.
+
+\snippet referenceexamples/extended/example.qml 0
+
+The QML engine instantiates a \l QLineEdit and sets a property that
+only exists on the extension type. The extension type performs calls on the
+\l QLineEdit that otherwise will not be accessible to the QML engine.
*/
@@ -293,7 +305,6 @@ This example builds on:
This example builds on:
\list
-\li \l {Extending QML - Default Property Example}
\li \l {Extending QML - Inheritance and Coercion Example}
\li \l {Extending QML - Object and List Property Types Example}
\li \l {Extending QML - Adding Types Example}
diff --git a/examples/qml/referenceexamples/extended/main.cpp b/examples/qml/referenceexamples/extended/main.cpp
index fc11587841..f72cb0d9e2 100644
--- a/examples/qml/referenceexamples/extended/main.cpp
+++ b/examples/qml/referenceexamples/extended/main.cpp
@@ -48,11 +48,15 @@ int main(int argc, char ** argv)
{
QApplication app(argc, argv);
+// ![0]
qmlRegisterExtendedType<QLineEdit, LineEditExtension>("People", 1,0, "QLineEdit");
+// ![0]
+// ![1]
QQmlEngine engine;
QQmlComponent component(&engine, QUrl("qrc:example.qml"));
QLineEdit *edit = qobject_cast<QLineEdit *>(component.create());
+// ![1]
if (edit) {
edit->show();