diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2020-05-27 17:13:10 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2020-05-29 09:02:49 +0000 |
commit | c8d7c074f56922153923356581fcbd6d15f79110 (patch) | |
tree | db338ff569b44f3d028098472cda52c83774d636 /src/plugins/cppeditor/cppquickfixes.cpp | |
parent | 28a999be522af2be568f86c10af8cceab4b8a20c (diff) |
CppEditor: Consider namespaces in "extract function" quickfix
Fixes: QTCREATORBUG-23256
Change-Id: I99b1271907767c3607e35adb49bd4109f3eca18c
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Diffstat (limited to 'src/plugins/cppeditor/cppquickfixes.cpp')
-rw-r--r-- | src/plugins/cppeditor/cppquickfixes.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/plugins/cppeditor/cppquickfixes.cpp b/src/plugins/cppeditor/cppquickfixes.cpp index b52e7be493..24c43d24ca 100644 --- a/src/plugins/cppeditor/cppquickfixes.cpp +++ b/src/plugins/cppeditor/cppquickfixes.cpp @@ -3438,12 +3438,17 @@ public: // Write class qualification, if any. if (matchingClass) { - Class *current = matchingClass; + const Scope *current = matchingClass; QVector<const Name *> classes{matchingClass->name()}; while (current->enclosingScope()->asClass()) { current = current->enclosingScope()->asClass(); classes.prepend(current->name()); } + while (current->enclosingScope() && current->enclosingScope()->asNamespace()) { + current = current->enclosingScope()->asNamespace(); + if (current->name()) + classes.prepend(current->name()); + } for (const Name *n : classes) { const Name *name = rewriteName(n, &env, control); funcDef.append(printer.prettyName(name)); |