path: root/src/corelib/doc
diff options
authorFabian Kosmale <>2020-01-21 15:33:11 +0100
committerFabian Kosmale <>2020-01-23 16:47:45 +0100
commitcb3152086c61e7c51ed1c5f8c5946364e19abc4d (patch)
tree5624826388b8b5d8a80f4020cba701868e1b2c44 /src/corelib/doc
parent49f143e19ca11ef48260a3aaaa4ddbe490cf81ab (diff)
Introduce Q_PROPERTY attribute REQUIRED
This is meant to correspond to required properties in QML. Change-Id: I2645981e13f7423bc86b48370c165b3cfe2aaa62 Task-number: QTBUG-81561 Reviewed-by: Olivier Goffart (Woboq GmbH) <>
Diffstat (limited to 'src/corelib/doc')
2 files changed, 7 insertions, 0 deletions
diff --git a/src/corelib/doc/snippets/code/doc_src_properties.cpp b/src/corelib/doc/snippets/code/doc_src_properties.cpp
index b72c9d13e1..a67945bbcf 100644
--- a/src/corelib/doc/snippets/code/doc_src_properties.cpp
+++ b/src/corelib/doc/snippets/code/doc_src_properties.cpp
@@ -61,6 +61,7 @@ Q_PROPERTY(type name
[USER bool]
//! [0]
diff --git a/src/corelib/doc/src/objectmodel/properties.qdoc b/src/corelib/doc/src/objectmodel/properties.qdoc
index 9ef08cce07..680e5598f0 100644
--- a/src/corelib/doc/src/objectmodel/properties.qdoc
+++ b/src/corelib/doc/src/objectmodel/properties.qdoc
@@ -144,6 +144,12 @@
optimizations in some cases, but is not enforced by moc. Care must be taken
never to override a \c FINAL property.
+ \li The presence of the \c REQUIRED attribute indicates that the property
+ should be set by a user of the class. This is not enforced by moc, and is
+ mostly useful for classes exposed to QML. In QML, classes with REQUIRED
+ properties cannot be instantiated unless all REQUIRED properties have
+ been set.
The \c READ, \c WRITE, and \c RESET functions can be inherited.