From 27ea28b0f451076e773f9dc78babfdd799c3e0d8 Mon Sep 17 00:00:00 2001 From: Nico Vertriest Date: Fri, 16 Dec 2016 13:14:01 +0100 Subject: Doc: Rearranged order of Extending QML Examples MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rearranged in logical order of example build up Change-Id: I6af8e39bd900d4ce058de46e0b3ebd5e368222c8 Reviewed-by: Topi Reiniƶ --- examples/qml/doc/src/qml-extending.qdoc | 19 +++++++++++++++---- examples/qml/referenceexamples/extended/main.cpp | 4 ++++ 2 files changed, 19 insertions(+), 4 deletions(-) (limited to 'examples') 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("People", 1,0, "QLineEdit"); +// ![0] +// ![1] QQmlEngine engine; QQmlComponent component(&engine, QUrl("qrc:example.qml")); QLineEdit *edit = qobject_cast(component.create()); +// ![1] if (edit) { edit->show(); -- cgit v1.2.3