From 83e926f1cde9dc94b58cdd27ddde3b19541881aa Mon Sep 17 00:00:00 2001 From: Artem Sokolovskii Date: Thu, 2 Sep 2021 16:10:54 +0200 Subject: [PATCH] CppEditor: Fix space issue for auto generated Q_PROPERTY Change-Id: I3744ecfc18c7291666f346ea7b047ee749672e05 Reviewed-by: Christian Kandeler --- src/plugins/cppeditor/cppquickfix_test.cpp | 10 +++++----- src/plugins/cppeditor/cppquickfixes.cpp | 5 +++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/plugins/cppeditor/cppquickfix_test.cpp b/src/plugins/cppeditor/cppquickfix_test.cpp index cc3bef67d8e..0451e1632c1 100644 --- a/src/plugins/cppeditor/cppquickfix_test.cpp +++ b/src/plugins/cppeditor/cppquickfix_test.cpp @@ -2798,12 +2798,12 @@ class Foo { public: custom bar@; - N2::test*getBar() const; + N2::test *getBar() const; void setBar(const custom &newBar); signals: - void barChanged(N2::test*bar); + void barChanged(N2::test *bar); private: - Q_PROPERTY(N2::test* bar READ getBar NOTIFY barChanged) + Q_PROPERTY(N2::test *bar READ getBar NOTIFY barChanged) }; })--"; testDocuments << QuickFixTestDocument::create("file.h", original, expected); @@ -2812,7 +2812,7 @@ private: original = ""; expected = R"-( using namespace N1; -N2::test*Foo::getBar() const +N2::test *Foo::getBar() const { return bar.get(); } @@ -2837,7 +2837,7 @@ void Foo::setBar(const custom &newBar) t.types.append("custom"); t.equalComparison = ".equals()"; t.returnExpression = ".get()"; - t.returnType = "*"; + t.returnType = " *"; t.assignment = ".assign()"; s->customTemplates.push_back(t); diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp index cc4768dc991..6dc0b3d6fa1 100644 --- a/src/plugins/cppeditor/cppquickfixes.cpp +++ b/src/plugins/cppeditor/cppquickfixes.cpp @@ -4144,8 +4144,9 @@ void GetterSetterRefactoringHelper::performGeneration(ExistingGetterSetterData d type = ref->elementType(); type.setConst(false); - QString propertyDeclaration = QLatin1String("Q_PROPERTY(") + overview.prettyType(type) - + QLatin1Char(' ') + memberBaseName(data.memberVariableName); + QString propertyDeclaration = QLatin1String("Q_PROPERTY(") + + overview.prettyType(type, + memberBaseName(data.memberVariableName)); bool needMember = false; if (data.getterName.isEmpty()) needMember = true;