diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-10-30 13:35:11 +0100 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-11-02 09:44:57 +0100 |
commit | 4391ddd0015db183ea103e4587653793485dea9d (patch) | |
tree | d55c98758770731133a4c41230daa47fd511e61c /src/qml/doc | |
parent | 7a80f35d6f19a0623284c857815897b6c0b4b8dd (diff) |
Migration guide: cover removal of deprecated functions
Change-Id: I9e35d84940652d6de02cb7bd18bbb25f3e111184
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/qml/doc')
-rw-r--r-- | src/qml/doc/src/qt6-changes.qdoc | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/src/qml/doc/src/qt6-changes.qdoc b/src/qml/doc/src/qt6-changes.qdoc index 513a9508a5..31f3544dab 100644 --- a/src/qml/doc/src/qt6-changes.qdoc +++ b/src/qml/doc/src/qt6-changes.qdoc @@ -71,4 +71,106 @@ the engine. As with \c variant properties, code that relied on implicit string conversions need to use the corresponding functions of the Qt object. + \section1 Removed API + + Various deprecated functions have been removed. + + \list + \li The QQmlListProperty constructor taking a reference has been removed. + \oldcode + QQmlListProperty<QObject>(owner, owner->objectList); + \newcode + QQmlListProperty<QObject>(owner, &owner->objectList); + \endcode + + \li The functions \c qmlExecuteDeferred, \c qmlContext and \c qmlEngine used to exist both in + the global namespace (or Qt namespace in namespaced builds), and in the \c QtQml namespace. The + latter has been removed. + \oldcode + QQmlEngine *engine = QtQml::qmlEngine(qmlObject); + \newcode + QQmlEngine *engine = qmlEngine(qmlObject); + \endcode + + \li The \c qmlRegisterType overload taking no arguments has been removed. Use + \c qmlRegisterAnonymousType instead, or switch to declarative type registration with + \c QML_ANONYMOUS. + \oldcode + class AnonymousType : public QObject { + // ... + }; + + qmlRegisterType<AnonymousType>(); + \newcode + class AnonymousType : public QObject { + // ... + }; + + qmlRegisterAnonymousType<AnonymousType>("MyModule", 1); + \endcode + Or alternatively + \code + class AnonymousType : public QObject { + QML_ANONYMOUS + // ... + }; + \endcode + + \li The overloads of \c qmlRegisterExtendedType and \c qmlRegisterInterface + which take no version argument have been removed. Use the overloads providing a + version, or switch to declarative type registration with QML_EXTENDED + and QML_INTERFACE. + + \oldcode + struct GreetInterface + { + virtual ~GreetInterface(); + virtual void greet(); + }; + Q_DECLARE_INTERFACE(GreetInterface, "org.hi.GreetInterface") + + qmlRegisterInterface<GreetInterface>("Greeter"); + \newcode + struct GreetInterface + { + virtual ~GreetInterface(); + virtual void greet(); + }; + Q_DECLARE_INTERFACE(GreetInterface, "org.hi.GreetInterface") + + qmlRegisterInterface<GreetInterface>("Greeter", 1); + \endcode + Alternatively + \code + struct GreetInterface + { + QML_INTERFACE(Greeter) + virtual ~GreetInterface(); + virtual void greet(); + }; + Q_DECLARE_INTERFACE(GreetInterface, "org.hi.GreetInterface") + \endcode + \note In new code, declarative type registration should be preferred. + + \li The function \c QJSValue::engine has been removed. If access to the engine is required, a + reference to it must be stored instead. + + \li \c qmlAttachedPropertiesObjectById and \c qmlAttachedPropertiesObject(int *, const QObject *, + const QMetaObject *, bool) have been removed. Use the + \c qmlAttachedPropertiesObject(QObject *, QQmlAttachedPropertiesFunc, bool) overload of + \c qmlAttachedPropertiesObject instead. + + \li \c QJSEngine::installTranslatorFunctions has been removed. \c QJSEngine::installExtensions + is available as a replacement. + \oldcode + QJSEngine engine; + engine.installTranslatorFunctions(); + \newcode + QJSEngine engine; + engine.installExtensions(QJSEngine::TranslationExtension + \endcode; + + \endlist + + */ |