Commit f35d7147 authored by Tim Jenssen's avatar Tim Jenssen Committed by Tim Jenssen

QmlDesigner: use list initialization

Change-Id: Iecc075d82c5b26589a6201a3b1adb04f59c92db0
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@theqtcompany.com>
parent 791e8af5
......@@ -85,7 +85,7 @@ void ModelToTextMerger::propertiesChanged(const QList<AbstractProperty>& propert
ModelNode containedModelNode;
const int indentDepth = m_rewriterView->textModifier()->indentDepth();
const QString propertyTextValue = QmlTextGenerator(getPropertyOrder(),
const QString propertyTextValue = QmlTextGenerator(propertyOrder(),
indentDepth)(property);
switch (propertyChange) {
......@@ -162,14 +162,14 @@ void ModelToTextMerger::nodeReparented(const ModelNode &node, const NodeAbstract
switch (propertyChange) {
case AbstractView::PropertiesAdded:
schedule(new AddPropertyRewriteAction(newPropertyParent,
QmlTextGenerator(getPropertyOrder())(node),
QmlTextGenerator(propertyOrder())(node),
propertyType(newPropertyParent),
node));
break;
case AbstractView::NoAdditionalChanges:
schedule(new ChangePropertyRewriteAction(newPropertyParent,
QmlTextGenerator(getPropertyOrder())(node),
QmlTextGenerator(propertyOrder())(node),
propertyType(newPropertyParent),
node));
break;
......@@ -212,7 +212,7 @@ void ModelToTextMerger::applyChanges()
return;
dumpRewriteActions(QStringLiteral("Before compression"));
RewriteActionCompressor compress(getPropertyOrder());
RewriteActionCompressor compress(propertyOrder());
compress(m_rewriteActions);
dumpRewriteActions(QStringLiteral("After compression"));
......@@ -241,7 +241,7 @@ void ModelToTextMerger::applyChanges()
ModelNodePositionRecalculator positionRecalculator(m_rewriterView->positionStorage(), m_rewriterView->positionStorage()->modelNodes());
positionRecalculator.connectTo(textModifier);
QmlRefactoring refactoring(tmpDocument, *textModifier, getPropertyOrder());
QmlRefactoring refactoring(tmpDocument, *textModifier, propertyOrder());
textModifier->deactivateChangeSignals();
textModifier->startGroup();
......@@ -348,31 +348,27 @@ QmlRefactoring::PropertyType ModelToTextMerger::propertyType(const AbstractPrope
return (QmlRefactoring::PropertyType) -1;
}
PropertyNameList ModelToTextMerger::m_propertyOrder;
PropertyNameList ModelToTextMerger::getPropertyOrder()
PropertyNameList ModelToTextMerger::propertyOrder()
{
if (m_propertyOrder.isEmpty()) {
m_propertyOrder
<< PropertyName("id")
<< PropertyName("name")
<< PropertyName("target")
<< PropertyName("property")
<< PropertyName("x")
<< PropertyName("y")
<< PropertyName("width")
<< PropertyName("height")
<< PropertyName("position")
<< PropertyName("color")
<< PropertyName("radius")
<< PropertyName("text")
<< PropertyName()
<< PropertyName("states")
<< PropertyName("transitions")
;
}
static const PropertyNameList properties = {
PropertyName("id"),
PropertyName("name"),
PropertyName("target"),
PropertyName("property"),
PropertyName("x"),
PropertyName("y"),
PropertyName("width"),
PropertyName("height"),
PropertyName("position"),
PropertyName("color"),
PropertyName("radius"),
PropertyName("text"),
PropertyName(),
PropertyName("states"),
PropertyName("transitions")
};
return m_propertyOrder;
return properties;
}
bool ModelToTextMerger::isInHierarchy(const AbstractProperty &property) {
......
......@@ -37,7 +37,6 @@ namespace Internal {
class ModelToTextMerger
{
typedef AbstractView::PropertyChangeFlags PropertyChangeFlags;
static PropertyNameList m_propertyOrder;
public:
ModelToTextMerger(RewriterView *reWriterView);
......@@ -75,7 +74,7 @@ protected:
{ return m_rewriteActions; }
static QmlDesigner::QmlRefactoring::PropertyType propertyType(const AbstractProperty &property, const QString &textValue = QString());
static PropertyNameList getPropertyOrder();
static PropertyNameList propertyOrder();
static bool isInHierarchy(const AbstractProperty &property);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment