Modeling: Avoid QStringList constructor when creating QList<QString>

This avoids slicing, is shorter, and will do the right thing no matter
what the QList/QVector/QStringList discussion will end up with.

Change-Id: I3e317e1677f3942aacf83401324f7022bd164823
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2020-04-29 09:18:01 +02:00
parent fd527a4828
commit 04d0e09568
3 changed files with 4 additions and 4 deletions

View File

@@ -151,9 +151,9 @@ void StereotypeDisplayVisitor::visitDItem(const DItem *item)
m_stereotypeSmartDisplay = DObject::StereotypeIcon; m_stereotypeSmartDisplay = DObject::StereotypeIcon;
visitDObject(item); visitDObject(item);
if (m_stereotypeIconId.isEmpty() && !item->shape().isEmpty()) if (m_stereotypeIconId.isEmpty() && !item->shape().isEmpty())
m_stereotypeIconId = m_stereotypeController->findStereotypeIconId(StereotypeIcon::ElementItem, QStringList(item->shape())); m_stereotypeIconId = m_stereotypeController->findStereotypeIconId(StereotypeIcon::ElementItem, {item->shape()});
if (m_shapeIconId.isEmpty() && !item->variety().isEmpty()) if (m_shapeIconId.isEmpty() && !item->variety().isEmpty())
m_shapeIconId = m_stereotypeController->findStereotypeIconId(StereotypeIcon::ElementItem, QStringList(item->variety())); m_shapeIconId = m_stereotypeController->findStereotypeIconId(StereotypeIcon::ElementItem, {item->variety()});
updateShapeIcon(); updateShapeIcon();
} }

View File

@@ -1518,7 +1518,7 @@ void PropertiesView::MView::setTitle(const MItem *item, const QList<V *> &elemen
if (elements.size() == 1) { if (elements.size() == 1) {
if (item && !item->isVarietyEditable()) { if (item && !item->isVarietyEditable()) {
QString stereotypeIconId = m_propertiesView->stereotypeController() QString stereotypeIconId = m_propertiesView->stereotypeController()
->findStereotypeIconId(StereotypeIcon::ElementItem, QStringList(item->variety())); ->findStereotypeIconId(StereotypeIcon::ElementItem, {item->variety()});
if (!stereotypeIconId.isEmpty()) { if (!stereotypeIconId.isEmpty()) {
StereotypeIcon stereotypeIcon = m_propertiesView->stereotypeController()->findStereotypeIcon(stereotypeIconId); StereotypeIcon stereotypeIcon = m_propertiesView->stereotypeController()->findStereotypeIcon(stereotypeIconId);
m_propertiesTitle = stereotypeIcon.title(); m_propertiesTitle = stereotypeIcon.title();

View File

@@ -101,7 +101,7 @@ public:
endItems = customRelation.endItems(); endItems = customRelation.endItems();
QString stereotypeIconId = m_stereotypeController->findStereotypeIconId(StereotypeIcon::ElementItem, object->stereotypes()); QString stereotypeIconId = m_stereotypeController->findStereotypeIconId(StereotypeIcon::ElementItem, object->stereotypes());
if (stereotypeIconId.isEmpty() && !m_variety.isEmpty()) if (stereotypeIconId.isEmpty() && !m_variety.isEmpty())
stereotypeIconId = m_stereotypeController->findStereotypeIconId(StereotypeIcon::ElementItem, QStringList(m_variety)); stereotypeIconId = m_stereotypeController->findStereotypeIconId(StereotypeIcon::ElementItem, {m_variety});
m_accepted = endItems.contains(stereotypeIconId); m_accepted = endItems.contains(stereotypeIconId);
} }
} }