diff --git a/src/libs/utils/changeset.h b/src/libs/utils/changeset.h index 5cb484c9b67..31e9540f0ba 100644 --- a/src/libs/utils/changeset.h +++ b/src/libs/utils/changeset.h @@ -121,4 +121,9 @@ private: bool m_error; }; +inline bool operator<(const ChangeSet::Range &r1, const ChangeSet::Range &r2) +{ + return r1.start < r2.start; +} + } // namespace Utils diff --git a/src/plugins/cppeditor/cppquickfix_test.cpp b/src/plugins/cppeditor/cppquickfix_test.cpp index 85ca917e954..cf66662e09c 100644 --- a/src/plugins/cppeditor/cppquickfix_test.cpp +++ b/src/plugins/cppeditor/cppquickfix_test.cpp @@ -1582,6 +1582,40 @@ void CppEditorPlugin::test_quickfix_data() "};\n" ); + QTest::newRow("InsertQtPropertyMembersPrivateBeforePublic") + << CppQuickFixFactoryPtr(new InsertQtPropertyMembers) + << _("class XmarksTheSpot {\n" + "private:\n" + " @Q_PROPERTY(int it READ getIt WRITE setIt NOTIFY itChanged)\n" + "public:\n" + " void find();\n" + "};\n" + ) + << _("class XmarksTheSpot {\n" + "private:\n" + " Q_PROPERTY(int it READ getIt WRITE setIt NOTIFY itChanged)\n" + " int m_it;\n" + "\n" + "public:\n" + " void find();\n" + " int getIt() const\n" + " {\n" + " return m_it;\n" + " }\n" + "public slots:\n" + " void setIt(int it)\n" + " {\n" + " if (m_it == it)\n" + " return;\n" + "\n" + " m_it = it;\n" + " emit itChanged(m_it);\n" + " }\n" + "signals:\n" + " void itChanged(int it);\n" + "};\n" + ); + // Escape String Literal as UTF-8 (no-trigger) QTest::newRow("EscapeStringLiteral_notrigger") << CppQuickFixFactoryPtr(new EscapeStringLiteral) diff --git a/src/plugins/texteditor/refactoringchanges.cpp b/src/plugins/texteditor/refactoringchanges.cpp index cc8166e0fe0..0ee7410b41a 100644 --- a/src/plugins/texteditor/refactoringchanges.cpp +++ b/src/plugins/texteditor/refactoringchanges.cpp @@ -31,8 +31,9 @@ #include #include #include -#include +#include #include +#include #include #include @@ -343,6 +344,9 @@ bool RefactoringFile::apply() else c.beginEditBlock(); + sort(m_indentRanges); + sort(m_reindentRanges); + // build indent selections now, applying the changeset will change locations const RefactoringSelections &indentSelections = RefactoringChanges::rangesToSelections(doc, m_indentRanges);