From e393422618ccf03254677a5ec1828c77ccae39d4 Mon Sep 17 00:00:00 2001 From: Nikita Baryshnikov Date: Tue, 12 Dec 2017 19:50:59 +0300 Subject: [PATCH] Qml&Js: better formatting of enums inspection Change-Id: I3d3948fcebb6b902a18fcf492122229c69c5ac3e Reviewed-by: Marco Benelli --- src/plugins/qmljseditor/qmljseditor.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp index 4170b6a6a53..01e37a3e4ca 100644 --- a/src/plugins/qmljseditor/qmljseditor.cpp +++ b/src/plugins/qmljseditor/qmljseditor.cpp @@ -658,8 +658,16 @@ static QString inspectCppComponent(const CppComponentValue *cppValue) const int enumeratorCount = cppValue->metaObject()->enumeratorCount(); for (int index = cppValue->metaObject()->enumeratorOffset(); index < enumeratorCount; ++index) { LanguageUtils::FakeMetaEnum enumerator = cppValue->metaObject()->enumerator(index); - bufWriter << " // Enum " << enumerator.name() << " { " << - enumerator.keys().join(QLatin1Char(',')) << " }" << endl; + bufWriter << " enum " << enumerator.name() << " {" << endl; + const QStringList keys = enumerator.keys(); + const int keysCount = keys.size(); + for (int i = 0; i < keysCount; ++i) { + bufWriter << " " << keys.at(i); + if (i != keysCount - 1) + bufWriter << ','; + bufWriter << endl; + } + bufWriter << " }" << endl; } bufWriter << "}" << endl;