forked from qt-creator/qt-creator
CppEditor: GenerateGetterSetter now ignores symbols in Q_PROPERTY
Since the Q_PROPERTY's name equals the typical getter name the "Generate Getter" quick fix was not offered. Q_PROPERTY(int a ...) // <-- a is "recognized" as "int a();" int m_a; Task-number: QTCREATORBUG-14166 Change-Id: I35709a1b6492b68309d02427d60251df4fd76cfa Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
@@ -914,6 +914,36 @@ void CppEditorPlugin::test_quickfix_data()
|
||||
"}\n"
|
||||
);
|
||||
|
||||
// Checks if the declaration inside Q_PROPERTY macro is ignored and a getter created
|
||||
QTest::newRow("GenerateGetterSetter_ignoreQPropertiesMacro")
|
||||
<< CppQuickFixFactoryPtr(new GenerateGetterSetter) << _(
|
||||
"class Something\n"
|
||||
"{\n"
|
||||
" Q_PROPERTY(int foo)\n"
|
||||
" int @m_foo;\n"
|
||||
"};\n"
|
||||
) << _(
|
||||
"class Something\n"
|
||||
"{\n"
|
||||
" Q_PROPERTY(int foo)\n"
|
||||
" int m_foo;\n"
|
||||
"\n"
|
||||
"public:\n"
|
||||
" int foo() const;\n"
|
||||
" void setFoo(int foo);\n"
|
||||
"};\n"
|
||||
"\n"
|
||||
"int Something::foo() const\n"
|
||||
"{\n"
|
||||
" return m_foo;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"void Something::setFoo(int foo)\n"
|
||||
"{\n"
|
||||
" m_foo = foo;\n"
|
||||
"}\n"
|
||||
);
|
||||
|
||||
QTest::newRow("MoveDeclarationOutOfIf_ifOnly")
|
||||
<< CppQuickFixFactoryPtr(new MoveDeclarationOutOfIf) << _(
|
||||
"void f()\n"
|
||||
|
||||
Reference in New Issue
Block a user