Commit 85800657 authored by Olaf Mandel's avatar Olaf Mandel Committed by Carl Schwan

Support Doxygen 1.8.20 by adding property getter

Doxygen 1.8.20 apparently needs a READ property accessor in order to
detect a Q_PROPERTY() macro correctly. So add a dummy-accessor to our
output.

As suggested by Matthew Jones in #7.
parent babea422
Pipeline #42551 passed with stage
in 3 minutes and 17 seconds
......@@ -257,7 +257,8 @@ class QmlProperty(object):
lst.append(self.DEFAULT_PROPERTY_COMMENT + "\n")
elif self.is_readonly:
lst.append(self.READONLY_PROPERTY_COMMENT + "\n")
lst.append("Q_PROPERTY(%s %s)" % (self.type, self.name))
lst.append("Q_PROPERTY(%s %s READ dummyGetter_%s_ignore)"
% (self.type, self.name, self.name))
if self.doc_is_inline:
lst.append(" " + self.doc)
return "".join(lst)
......
......@@ -10,7 +10,7 @@ public:
/**
* The 'foo' property
*/
Q_PROPERTY(int foo)
Q_PROPERTY(int foo READ dummyGetter_foo_ignore)
Q_SIGNALS: void clicked(int x, int y); public:
......@@ -29,9 +29,9 @@ void doSomething(string arg1, int arg2);
*/
void badlyDocumented(string foo, bar);
Q_PROPERTY(string escaped)
Q_PROPERTY(string escaped READ dummyGetter_escaped_ignore)
Q_PROPERTY(string block)
Q_PROPERTY(string block READ dummyGetter_block_ignore)
/**
* Compute the arg^2
* @return the result
......@@ -58,7 +58,7 @@ int propDefaultParameter(int arg = foo);
/// One-line comment
void refresh();
Q_PROPERTY(int weirdProperty)
Q_PROPERTY(int weirdProperty READ dummyGetter_weirdProperty_ignore)
/* baz */
/* foo */
};
......@@ -8,7 +8,7 @@ using namespace QtQuick;
*/
class InlineComments : public QtQuick.Item {
public:
Q_PROPERTY(int foo) ///< The 'foo' property
Q_PROPERTY(int foo READ dummyGetter_foo_ignore) ///< The 'foo' property
Q_SIGNALS: void clicked(int x, int y); /**< The `clicked` signal */
public:
Q_SIGNALS: void activated(); //!< Another signal
......@@ -20,8 +20,8 @@ void doSomething(string arg1, int arg2); /*!< @param arg1 first argument @param
* @param bar this argument does exist
*/
void weirdlyDocumented(string foo, int bar);
Q_PROPERTY(string escaped) ///< and an inline comment
Q_PROPERTY(string block) /**< and an inline comment! ***< //!< */
Q_PROPERTY(string escaped READ dummyGetter_escaped_ignore) ///< and an inline comment
Q_PROPERTY(string block READ dummyGetter_block_ignore) /**< and an inline comment! ***< //!< */
int square(arg); ///< Compute the arg^2. @return the result
void refresh(); ///< Inline comment out of place (should be moved inline in the output)
// Just some regular comment
......@@ -35,7 +35,7 @@ void reload(); ///< Inline comment for a keyword following a regular comment.
*/
void update(string arg1, int arg2);
Q_PROPERTY(int weirdProperty)
Q_PROPERTY(int weirdProperty READ dummyGetter_weirdProperty_ignore)
/* baz */
/* foo */
///< and a useless inline comment
......
......@@ -7,9 +7,9 @@ public:
* A readonly property
*/
/** @remark This property is read-only */
Q_PROPERTY(real gravity)
Q_PROPERTY(real gravity READ dummyGetter_gravity_ignore)
/**
* A read-write property
*/
Q_PROPERTY(real speed)
Q_PROPERTY(real speed READ dummyGetter_speed_ignore)
};
......@@ -4,10 +4,10 @@ public:
/**
* The 'foo' property
*/
Q_PROPERTY(int foo)
Q_PROPERTY(int foo READ dummyGetter_foo_ignore)
/// @cond TEST
/// A test property, not visible by default
Q_PROPERTY(int test)
Q_PROPERTY(int test READ dummyGetter_test_ignore)
/// @endcond TEST
private:
/// @cond
......
......@@ -5,5 +5,5 @@ using namespace QtQuick::Controls;
class AbstractApplicationWindow : public QtQuick.Controls.ApplicationWindow {
public:
Q_PROPERTY(Item pageStack)
Q_PROPERTY(Item pageStack READ dummyGetter_pageStack_ignore)
};
......@@ -7,6 +7,6 @@ public:
/**
* Car speed
*/
Q_PROPERTY(real speed)
Q_PROPERTY(real speed READ dummyGetter_speed_ignore)
};
}
......@@ -2,8 +2,8 @@ namespace test::doxyqml {
class QualifiedName : public QtQuick.Item {
public:
Q_PROPERTY(int x)
Q_PROPERTY(int x READ dummyGetter_x_ignore)
Q_PROPERTY(int y)
Q_PROPERTY(int y READ dummyGetter_y_ignore)
};
}
......@@ -3,8 +3,8 @@ namespace test::doxyqml {
class QualifiedName : public QtQuick.Item {
public:
Q_PROPERTY(int x)
Q_PROPERTY(int x READ dummyGetter_x_ignore)
Q_PROPERTY(int y)
Q_PROPERTY(int y READ dummyGetter_y_ignore)
};
}
......@@ -3,8 +3,8 @@ namespace test::doxyqml {
class AlsoQualified : public QtQuick.Item {
public:
Q_PROPERTY(int x)
Q_PROPERTY(int x READ dummyGetter_x_ignore)
Q_PROPERTY(int y)
Q_PROPERTY(int y READ dummyGetter_y_ignore)
};
}
......@@ -5,7 +5,7 @@ using namespace QtQuick::Controls::Styles;
class RelativeImport : public QtQml.QtObject {
public:
Q_PROPERTY(string import_hello)
Q_PROPERTY(string import_hello READ dummyGetter_import_hello_ignore)
Q_PROPERTY(string hello_import)
Q_PROPERTY(string hello_import READ dummyGetter_hello_import_ignore)
};
......@@ -83,4 +83,4 @@ class QmlPropertyTestCase(TestCase):
prop.is_default = True
self.assertEqual(str(prop),
"/// Children\n" + QmlProperty.DEFAULT_PROPERTY_COMMENT + "\nQ_PROPERTY(list<Item> )")
"/// Children\n" + QmlProperty.DEFAULT_PROPERTY_COMMENT + "\nQ_PROPERTY(list<Item> READ dummyGetter__ignore)")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment