aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaximilian Goldstein <max.goldstein@qt.io>2020-11-23 13:17:40 +0100
committerMaximilian Goldstein <max.goldstein@qt.io>2020-11-23 16:20:36 +0100
commit65851a450926befad65d9cffcaa217875d1936c6 (patch)
tree888fe7e14e33ecb38c414e12654f6354319236ea
parent4d6078e4b556e83f55ffed55f14203c3ed880c62 (diff)
qmlfunctions.qdoc: Add clarification to QML_FOREIGN
Fixes: QTBUG-87150 Change-Id: If99a06a07892bdfef7b6b1e8fa737480750992fe Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 56f428c360191230b571969a2651e85380030afa)
-rw-r--r--examples/qml/doc/src/qml-extending.qdoc4
-rw-r--r--src/qml/doc/src/qmlfunctions.qdoc4
2 files changed, 8 insertions, 0 deletions
diff --git a/examples/qml/doc/src/qml-extending.qdoc b/examples/qml/doc/src/qml-extending.qdoc
index 723e470d45..c9922ebd45 100644
--- a/examples/qml/doc/src/qml-extending.qdoc
+++ b/examples/qml/doc/src/qml-extending.qdoc
@@ -79,6 +79,10 @@ Qt's internal QLineEdit class.
\snippet referenceexamples/extended/lineedit.h 0
+Note the usage of \l QML_NAMED_ELEMENT() instead of \l QML_ELEMENT.
+QML_ELEMENT uses the name of the containing type by default, "LineEditExtension" in this case.
+As the class being an extension class is an implementation detail, we choose the more natural name "LineEdit" instead
+
The QML engine then instantiates a \l QLineEdit:
\snippet referenceexamples/extended/main.cpp 1
diff --git a/src/qml/doc/src/qmlfunctions.qdoc b/src/qml/doc/src/qmlfunctions.qdoc
index 12b7efb159..4e531ceb61 100644
--- a/src/qml/doc/src/qmlfunctions.qdoc
+++ b/src/qml/doc/src/qmlfunctions.qdoc
@@ -250,6 +250,10 @@
This is useful for registering types that cannot be amended to add the macros,
for example because they belong to 3rdparty libraries.
+ \b{NOTE:} You may want to use \l QML_NAMED_ELEMENT() instead of \l QML_ELEMENT due to the fact that
+ the element will be named like the struct it is contained in, not the foreign type.
+ See \l {Extending QML - Extension Objects Example} for an example.
+
\sa QML_ELEMENT, QML_NAMED_ELEMENT()
*/