forked from qt-creator/qt-creator
QmlDesigner: use initializer lists
Change-Id: Ie93861c7d8a5b2863ec8b111afceacc2c163715b Reviewed-by: Thomas Hartmann <Thomas.Hartmann@theqtcompany.com>
This commit is contained in:
@@ -65,7 +65,7 @@ void BehaviorNodeInstance::resetProperty(const PropertyName &name)
|
||||
|
||||
PropertyNameList BehaviorNodeInstance::ignoredProperties() const
|
||||
{
|
||||
return PropertyNameList() << "enabled";
|
||||
return PropertyNameList({"enabled"});
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -70,7 +70,8 @@ void LayoutNodeInstance::refreshLayoutable()
|
||||
|
||||
PropertyNameList LayoutNodeInstance::ignoredProperties() const
|
||||
{
|
||||
return PropertyNameList() << "move" << "add" << "populate";
|
||||
static const PropertyNameList properties({"move", "add", "populate"});
|
||||
return properties;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -76,8 +76,8 @@ void PositionerNodeInstance::refreshLayoutable()
|
||||
|
||||
PropertyNameList PositionerNodeInstance::ignoredProperties() const
|
||||
{
|
||||
return PropertyNameList() << "move" << "add" << "populate";
|
||||
}
|
||||
|
||||
static const PropertyNameList properties({"move", "add", "populate"});
|
||||
return properties;
|
||||
}
|
||||
} // namespace Internal
|
||||
} // namespace QmlDesigner
|
||||
|
||||
@@ -52,7 +52,8 @@ bool QmlTransitionNodeInstance::isTransition() const
|
||||
|
||||
PropertyNameList QmlTransitionNodeInstance::ignoredProperties() const
|
||||
{
|
||||
return PropertyNameList() << "from" << "to";
|
||||
static const PropertyNameList properties({"from", "to"});
|
||||
return properties;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -734,15 +734,15 @@ bool QuickItemNodeInstance::hasAnchor(const PropertyName &name) const
|
||||
|
||||
static bool isValidAnchorName(const PropertyName &name)
|
||||
{
|
||||
static PropertyNameList anchorNameList(PropertyNameList() << "anchors.top"
|
||||
<< "anchors.left"
|
||||
<< "anchors.right"
|
||||
<< "anchors.bottom"
|
||||
<< "anchors.verticalCenter"
|
||||
<< "anchors.horizontalCenter"
|
||||
<< "anchors.fill"
|
||||
<< "anchors.centerIn"
|
||||
<< "anchors.baseline");
|
||||
static PropertyNameList anchorNameList({"anchors.top",
|
||||
"anchors.left",
|
||||
"anchors.right",
|
||||
"anchors.bottom",
|
||||
"anchors.verticalCenter",
|
||||
"anchors.horizontalCenter",
|
||||
"anchors.fill",
|
||||
"anchors.centerIn",
|
||||
"anchors.baseline"});
|
||||
|
||||
return anchorNameList.contains(name);
|
||||
}
|
||||
|
||||
@@ -527,7 +527,7 @@ void FormEditorView::instancePropertyChange(const QList<QPair<ModelNode, Propert
|
||||
const QmlItemNode itemNode(nodePropertyPair.first);
|
||||
const PropertyName propertyName = nodePropertyPair.second;
|
||||
if (itemNode.isValid() && scene()->hasItemForQmlItemNode(itemNode)) {
|
||||
static PropertyNameList skipList = PropertyNameList() << "x" << "y" << "width" << "height";
|
||||
static const PropertyNameList skipList({"x", "y", "width", "height"});
|
||||
if (!skipList.contains(propertyName)) {
|
||||
m_scene->synchronizeOtherProperty(itemNode, propertyName);
|
||||
m_currentTool->formEditorItemsChanged(QList<FormEditorItem*>() << m_scene->itemForQmlItemNode(itemNode));
|
||||
|
||||
@@ -124,7 +124,7 @@ NodeInstanceView::~NodeInstanceView()
|
||||
|
||||
bool isSkippedRootNode(const ModelNode &node)
|
||||
{
|
||||
static PropertyNameList skipList = PropertyNameList() << "Qt.ListModel" << "QtQuick.ListModel" << "Qt.ListModel" << "QtQuick.ListModel";
|
||||
static const PropertyNameList skipList({"Qt.ListModel", "QtQuick.ListModel", "Qt.ListModel", "QtQuick.ListModel"});
|
||||
|
||||
if (skipList.contains(node.type()))
|
||||
return true;
|
||||
@@ -135,7 +135,7 @@ bool isSkippedRootNode(const ModelNode &node)
|
||||
|
||||
bool isSkippedNode(const ModelNode &node)
|
||||
{
|
||||
static PropertyNameList skipList = PropertyNameList() << "QtQuick.XmlRole" << "Qt.XmlRole" << "QtQuick.ListElement" << "Qt.ListElement";
|
||||
static const PropertyNameList skipList({"QtQuick.XmlRole", "Qt.XmlRole", "QtQuick.ListElement", "Qt.ListElement"});
|
||||
|
||||
if (skipList.contains(node.type()))
|
||||
return true;
|
||||
|
||||
@@ -332,15 +332,15 @@ private:
|
||||
|
||||
static inline bool isValueType(const TypeName &type)
|
||||
{
|
||||
static PropertyTypeList objectValuesList(PropertyTypeList()
|
||||
<< "QFont" << "QPoint" << "QPointF" << "QSize" << "QSizeF" << "QVector3D" << "QVector2D");
|
||||
static const PropertyTypeList objectValuesList({"QFont", "QPoint", "QPointF",
|
||||
"QSize", "QSizeF", "QVector3D", "QVector2D"});
|
||||
return objectValuesList.contains(type);
|
||||
}
|
||||
|
||||
static inline bool isValueType(const QString &type)
|
||||
{
|
||||
static QStringList objectValuesList(QStringList()
|
||||
<< "QFont" << "QPoint" << "QPointF" << "QSize" << "QSizeF" << "QVector3D" << "QVector2D");
|
||||
static const QStringList objectValuesList({"QFont", "QPoint", "QPointF",
|
||||
"QSize", "QSizeF", "QVector3D", "QVector2D"});
|
||||
return objectValuesList.contains(type);
|
||||
}
|
||||
|
||||
|
||||
@@ -1488,7 +1488,7 @@ void ModelPrivate::setVariantProperty(const InternalNode::Pointer &internalNodeP
|
||||
|
||||
internalNodePointer->variantProperty(name)->setValue(value);
|
||||
internalNodePointer->variantProperty(name)->resetDynamicTypeName();
|
||||
notifyVariantPropertiesChanged(internalNodePointer, PropertyNameList() << name, propertyChange);
|
||||
notifyVariantPropertiesChanged(internalNodePointer, PropertyNameList({name}), propertyChange);
|
||||
}
|
||||
|
||||
void ModelPrivate::setDynamicVariantProperty(const InternalNodePointer &internalNodePointer,
|
||||
@@ -1503,7 +1503,7 @@ void ModelPrivate::setDynamicVariantProperty(const InternalNodePointer &internal
|
||||
}
|
||||
|
||||
internalNodePointer->variantProperty(name)->setDynamicValue(dynamicPropertyType, value);
|
||||
notifyVariantPropertiesChanged(internalNodePointer, PropertyNameList() << name, propertyChange);
|
||||
notifyVariantPropertiesChanged(internalNodePointer, PropertyNameList({name}), propertyChange);
|
||||
}
|
||||
|
||||
void ModelPrivate::setDynamicBindingProperty(const InternalNodePointer &internalNodePointer,
|
||||
|
||||
@@ -187,8 +187,8 @@ bool detectHorizontalCycle(const ModelNode &node, QList<ModelNode> knownNodeList
|
||||
|
||||
knownNodeList.append(node);
|
||||
|
||||
static PropertyNameList validAnchorLines(PropertyNameList() << "right" << "left" << "horizontalCenter");
|
||||
static PropertyNameList anchorNames(PropertyNameList() << "anchors.right" << "anchors.left" << "anchors.horizontalCenter");
|
||||
static const PropertyNameList validAnchorLines({"right", "left", "horizontalCenter"});
|
||||
static const PropertyNameList anchorNames({"anchors.right", "anchors.left", "anchors.horizontalCenter"});
|
||||
|
||||
foreach (const PropertyName &anchorName, anchorNames) {
|
||||
if (node.hasBindingProperty(anchorName)) {
|
||||
@@ -204,7 +204,7 @@ bool detectHorizontalCycle(const ModelNode &node, QList<ModelNode> knownNodeList
|
||||
|
||||
}
|
||||
|
||||
static PropertyNameList anchorShortcutNames(PropertyNameList() << "anchors.fill" << "anchors.centerIn");
|
||||
static const PropertyNameList anchorShortcutNames({"anchors.fill", "anchors.centerIn"});
|
||||
foreach (const PropertyName &anchorName, anchorShortcutNames) {
|
||||
if (node.hasBindingProperty(anchorName)) {
|
||||
ModelNode targetNode = node.bindingProperty(anchorName).resolveToModelNode();
|
||||
@@ -227,8 +227,8 @@ bool detectVerticalCycle(const ModelNode &node, QList<ModelNode> knownNodeList)
|
||||
|
||||
knownNodeList.append(node);
|
||||
|
||||
static PropertyNameList validAnchorLines(PropertyNameList() << "top" << "bottom" << "verticalCenter" << "baseline");
|
||||
static PropertyNameList anchorNames(PropertyNameList() << "anchors.top" << "anchors.bottom" << "anchors.verticalCenter" << "anchors.baseline");
|
||||
static const PropertyNameList validAnchorLines({"top", "bottom", "verticalCenter", "baseline"});
|
||||
static const PropertyNameList anchorNames({"anchors.top", "anchors.bottom", "anchors.verticalCenter", "anchors.baseline"});
|
||||
|
||||
foreach (const PropertyName &anchorName, anchorNames) {
|
||||
if (node.hasBindingProperty(anchorName)) {
|
||||
@@ -244,7 +244,7 @@ bool detectVerticalCycle(const ModelNode &node, QList<ModelNode> knownNodeList)
|
||||
|
||||
}
|
||||
|
||||
static PropertyNameList anchorShortcutNames(PropertyNameList() << "anchors.fill" << "anchors.centerIn");
|
||||
static const PropertyNameList anchorShortcutNames({"anchors.fill", "anchors.centerIn"});
|
||||
foreach (const PropertyName &anchorName, anchorShortcutNames) {
|
||||
if (node.hasBindingProperty(anchorName)) {
|
||||
ModelNode targetNode = node.bindingProperty(anchorName).resolveToModelNode();
|
||||
|
||||
Reference in New Issue
Block a user