From 653d5a4745ad2f20ae924527b7b31580eedc651b Mon Sep 17 00:00:00 2001 From: Maximilian Goldstein Date: Wed, 13 Jan 2021 16:25:13 +0100 Subject: exposecppattributes.qdoc: Warn about aliases Using aliases in conjunction with Q_PROPERTY might cause some issues, so we should warn about it. Task-number: QTBUG-83950 Change-Id: I53db6848e3a7659e8b7ad93de70088cab6e53184 Reviewed-by: Paul Wicking --- .../src/cppintegration/exposecppattributes.qdoc | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src') diff --git a/src/qml/doc/src/cppintegration/exposecppattributes.qdoc b/src/qml/doc/src/cppintegration/exposecppattributes.qdoc index 52534b4a62..5c53989cbb 100644 --- a/src/qml/doc/src/cppintegration/exposecppattributes.qdoc +++ b/src/qml/doc/src/cppintegration/exposecppattributes.qdoc @@ -91,6 +91,29 @@ For example, below is a \c Message class with an \c author property. As specified by the Q_PROPERTY macro call, this property is readable through the \c author() method, and writable through the \c setAuthor() method: +\note Do not use \e typedef or \e using for Q_PROPERTY types as these +will confuse moc. This may make certain type comparisons fail. + +Instead of: + +\badcode +using FooEnum = Foo::Enum; + +class Bar : public QObject { + Q_OBJECT + Q_PROPERTY(FooEnum enum READ enum WRITE setEnum NOTIFY enumChanged) +}; +\endcode + +Refer to the type directly: + +\code +class Bar : public QObject { + Q_OBJECT + Q_PROPERTY(Foo::Enum enum READ enum WRITE setEnum NOTIFY enumChanged) +}; +\endcode + \code class Message : public QObject { -- cgit v1.2.3