diff options
author | Mitch Curtis <mitch.curtis@theqtcompany.com> | 2016-02-04 09:31:40 +0100 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@theqtcompany.com> | 2016-02-05 08:30:34 +0000 |
commit | 3024534574967ace249cf14f08d161ce4e728ba3 (patch) | |
tree | cf9bed8a7c71e7b99f31cd35441e871b56e01fa0 /src/qml/doc/src/qmlfunctions.qdoc | |
parent | 80eabc56349b5efe4acf3fcb467b5b2d6491131f (diff) |
Include qqml.h in qqmlengine.h for convenience
When a user creates a Qt Quick Application Project in Creator, they get
this main.cpp:
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
return app.exec();
}
According to the current documentation, if they then want to register a
C++ type for use in QML, they need to add a separate
"#include <QtQml>" (which is actually a module-wide include and brings
a lot of unnecessary files with it).
If the most common (or perhaps only) use case for that function (and
all of the others declared in qqml.h but documented as requiring QtQml)
is related to QQmlEngine, then it makes sense for qqmlengine.h to
include qqml.h.
This change makes it so that users can use these functions with
no changes to the code that Creator provides, as QQmlApplicationEngine
includes QQmlEngine.
Change-Id: I9d6be2e1abfd4cc831ca04dab4c2a9e50021f748
Task-number: QTBUG-50343
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src/qml/doc/src/qmlfunctions.qdoc')
-rw-r--r-- | src/qml/doc/src/qmlfunctions.qdoc | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/src/qml/doc/src/qmlfunctions.qdoc b/src/qml/doc/src/qmlfunctions.qdoc index 4203cca8b3..6f738752a7 100644 --- a/src/qml/doc/src/qmlfunctions.qdoc +++ b/src/qml/doc/src/qmlfunctions.qdoc @@ -30,8 +30,6 @@ \relates QQmlEngine Equivalent to \c Q_DECLARE_METATYPE(TYPE *) and \c Q_DECLARE_METATYPE(QQmlListProperty<TYPE>) - - #include <QtQml> to use this macro. */ /*! @@ -44,8 +42,6 @@ Current the only supported type info is \c QML_HAS_ATTACHED_PROPERTIES which declares that the \a Type supports \l {Attached Properties and Attached Signal Handlers} {attached properties}. - - #include <QtQml> to use this macro. */ /*! @@ -58,8 +54,6 @@ Any existing QQmlEngines must be deleted before calling this function. This function only affects the application global cache. Delete the QQmlEngine to clear all cached data relating to that engine. - - #include <QtQml> to use this method. */ @@ -93,10 +87,6 @@ "com.mycompany.qmlcomponents": \code - #include <QtQml> - - ... - qmlRegisterType<MySliderItem>("com.mycompany.qmlcomponents", 1, 0, "Slider"); \endcode @@ -151,8 +141,6 @@ Returns the QML type id. - #include <QtQml> to use this function. - \sa qmlRegisterTypeNotAvailable() */ @@ -167,8 +155,6 @@ Returns the QML type id. - #include <QtQml> to use this function. - \sa qmlRegisterType(), {Registering Extension Objects} */ @@ -190,8 +176,6 @@ Returns the QML type id. - #include <QtQml> to use this function. - \sa qmlRegisterUncreatableType() */ @@ -208,8 +192,6 @@ the \a parser provided. Returns the QML type id. - - #include <QtQml> to use this function. */ /*! @@ -244,8 +226,6 @@ Without this, a generic "Game is not a type" message would be given. - #include <QtQml> to use this function. - \sa qmlRegisterUncreatableType() */ @@ -258,8 +238,6 @@ system. Instances of this type cannot be created from the QML system. - #include <QtQml> to use this function. - Returns the QML type id. */ @@ -270,8 +248,6 @@ This template function registers the C++ type in the QML system under the name \a typeName. - #include <QtQml> to use this function. - Returns the QML type id. */ @@ -305,10 +281,7 @@ } // Second, register the singleton type provider with QML by calling this function in an initialization function. - #include <QtQml> - ... qmlRegisterSingletonType("Qt.example.qjsvalueApi", 1, 0, "MyApi", example_qjsvalue_singletontype_provider); - ... \endcode In order to use the registered singleton type in QML, you must import the singleton type. @@ -408,10 +381,7 @@ } // Third, register the singleton type provider with QML by calling this function in an initialization function. - #include <QtQml> - ... qmlRegisterSingletonType<SingletonTypeExample>("Qt.example.qobjectSingleton", 1, 0, "MyApi", example_qobject_singletontype_provider); - ... \endcode In order to use the registered singleton type in QML, you must import the singleton type. @@ -481,10 +451,7 @@ \code // Second, register the QML singleton type by calling this function in an initialization function. - #include <QtQml> - ... qmlRegisterSingletonType(QUrl("file:///absolute/path/SingletonType.qml"), "Qt.example.qobjectSingleton", 1, 0, "RegisteredSingleton"); - ... \endcode In order to use the registered singleton type in QML, you must import the singleton type. @@ -514,8 +481,6 @@ Normally QML files can be loaded as types directly from other QML files, or using a qmldir file. This function allows registration of files to types from C++ code, such as when the type mapping needs to be procedurally determined at startup. - #include <QtQml> to use this function. - Returns -1 if the registration was not successful. */ @@ -538,8 +503,6 @@ uri, major version combination will lead to a runtime error. Call this after you have registered all of your types with the engine. - #include <QtQml> to use this function. - Returns true if the module with \a uri as a \l{Identified Modules} {module identifier} and \a majVersion as a major version number was found and locked, otherwise returns false. The module must contain exported types |