diff options
author | Christian Kamm <christian.d.kamm@nokia.com> | 2011-10-10 14:37:41 +0200 |
---|---|---|
committer | Christian Kamm <christian.d.kamm@nokia.com> | 2011-10-11 12:45:04 +0200 |
commit | aa3d406faf4265c526cb4d9923e849e8264f5204 (patch) | |
tree | e1d8b60041ef80c78e0a9e8f9240e52e527f8995 /src/plugins/cpptools/cppcodeformatter.cpp | |
parent | 6a988ee8acce2e5ca9c0a5334b1d1ef6e4c55469 (diff) | |
download | qt-creator-aa3d406faf4265c526cb4d9923e849e8264f5204.tar.gz |
C++ indenter: Accept attributes in access specifiers.
Change-Id: Ie85b8264c9579e8c8312e30018280fb11f95edda
Reviewed-on: http://codereview.qt-project.org/6328
Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@nokia.com>
Sanity-Review: Erik Verbruggen <erik.verbruggen@nokia.com>
Diffstat (limited to 'src/plugins/cpptools/cppcodeformatter.cpp')
-rw-r--r-- | src/plugins/cpptools/cppcodeformatter.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/plugins/cpptools/cppcodeformatter.cpp b/src/plugins/cpptools/cppcodeformatter.cpp index 203e73057e..6ac322cad6 100644 --- a/src/plugins/cpptools/cppcodeformatter.cpp +++ b/src/plugins/cpptools/cppcodeformatter.cpp @@ -137,6 +137,11 @@ void CodeFormatter::recalculateStateAfter(const QTextBlock &block) case T_RBRACE: leave(); continue; // always nested in class_start } break; + case access_specifier_start: + switch (kind) { + case T_COLON: leave(); break; + } break; + case enum_start: switch (kind) { case T_SEMICOLON: leave(); break; @@ -817,6 +822,16 @@ bool CodeFormatter::tryDeclaration() enter(using_start); return true; + case T_PUBLIC: + case T_PRIVATE: + case T_PROTECTED: + case T_Q_SIGNALS: + if (m_currentState.top().type == class_open) { + enter(access_specifier_start); + return true; + } + return false; + default: return false; } @@ -1473,7 +1488,8 @@ void QtStyleCodeFormatter::adjustIndent(const QList<CPlusPlus::Token> &tokens, i case T_Q_SIGNALS: if (m_styleSettings.indentDeclarationsRelativeToAccessSpecifiers && topState.type == class_open) { - if (tokenAt(1).is(T_COLON) || tokenAt(2).is(T_COLON)) { + if (tokenAt(1).is(T_COLON) || tokenAt(2).is(T_COLON) + || (tokenAt(tokenCount() - 1).is(T_COLON) && tokenAt(1).is(T___ATTRIBUTE__))) { *indentDepth = topState.savedIndentDepth; if (m_styleSettings.indentAccessSpecifiers) *indentDepth += m_tabSettings.m_indentSize; |