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>
This commit is contained in:
Nico Vertriest 2016-12-16 13:14:01 +01:00 committed by Nico Vertriest
parent 11aef4eec2
commit 27ea28b0f4
3 changed files with 55 additions and 4 deletions

View File

@ -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}

View File

@ -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();

View File

@ -32,4 +32,40 @@
The list of examples demonstrating how to extend C++ to QML or the other way
around.
\noautolist
\table
\row
\li \l {Extending QML - Adding Types Example}
\li Exporting C++ Classes
\row
\li \l {Extending QML - Object and List Property Types Example}
\li Exporting C++ Properties
\row
\li \l {Extending QML - Extension Objects Example}
\li Extension Objects
\row
\li \l {Extending QML - Inheritance and Coercion Example}
\li C++ Inheritance and Coercion
\row
\li \l {Extending QML - Methods Example}
\li Methods Support
\row
\li \l {Extending QML - Attached Properties Example}
\li Attached Properties
\row
\li \l {Extending QML - Signal Support Example}
\li Signal Support
\row
\li \l {Extending QML - Property Value Source Example}
\li Property Value Source
\row
\li \l {Extending QML - Default Property Example}
\li Default Property
\row
\li \l {Extending QML - Grouped Properties Example}
\li Grouped Properties
\endtable
*/