forked from qt-creator/qt-creator
Port from qAsConst() to std::as_const()
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally starts to bother us (QTBUG-99313), so time to port away from it now. Since qAsConst has exactly the same semantics as std::as_const (down to rvalue treatment, constexpr'ness and noexcept'ness), there's really nothing more to it than a global search-and-replace. Task-number: QTBUG-99313 Change-Id: I88edd91395849574436299b8badda21bb93bea39 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -270,7 +270,7 @@ void ConnectableItem::removeInputTransition(TransitionItem *transition)
|
||||
|
||||
void ConnectableItem::updateInputTransitions()
|
||||
{
|
||||
for (TransitionItem *transition : qAsConst(m_inputTransitions)) {
|
||||
for (TransitionItem *transition : std::as_const(m_inputTransitions)) {
|
||||
transition->updateComponents();
|
||||
transition->updateUIProperties();
|
||||
}
|
||||
@@ -279,7 +279,7 @@ void ConnectableItem::updateInputTransitions()
|
||||
|
||||
void ConnectableItem::updateOutputTransitions()
|
||||
{
|
||||
for (TransitionItem *transition : qAsConst(m_outputTransitions)) {
|
||||
for (TransitionItem *transition : std::as_const(m_outputTransitions)) {
|
||||
transition->updateComponents();
|
||||
transition->updateUIProperties();
|
||||
}
|
||||
@@ -303,10 +303,10 @@ void ConnectableItem::updateTransitions(bool allChildren)
|
||||
|
||||
void ConnectableItem::updateTransitionAttributes(bool allChildren)
|
||||
{
|
||||
for (TransitionItem *transition : qAsConst(m_outputTransitions))
|
||||
for (TransitionItem *transition : std::as_const(m_outputTransitions))
|
||||
transition->updateTarget();
|
||||
|
||||
for (TransitionItem *transition : qAsConst(m_inputTransitions))
|
||||
for (TransitionItem *transition : std::as_const(m_inputTransitions))
|
||||
transition->updateTarget();
|
||||
|
||||
if (allChildren) {
|
||||
@@ -333,7 +333,7 @@ QPointF ConnectableItem::getInternalPosition(const TransitionItem *transition, T
|
||||
|
||||
int ind = 0;
|
||||
if (type == TransitionItem::InternalNoTarget) {
|
||||
for (TransitionItem *item : qAsConst(m_outputTransitions)) {
|
||||
for (TransitionItem *item : std::as_const(m_outputTransitions)) {
|
||||
if (item->targetType() == TransitionItem::InternalSameTarget)
|
||||
ind++;
|
||||
}
|
||||
@@ -565,7 +565,7 @@ void ConnectableItem::updateAttributes()
|
||||
{
|
||||
BaseItem::updateAttributes();
|
||||
|
||||
for (TransitionItem *transition : qAsConst(m_inputTransitions)) {
|
||||
for (TransitionItem *transition : std::as_const(m_inputTransitions)) {
|
||||
if (transition->isEndItem(this))
|
||||
transition->setTagValue("target", itemId());
|
||||
}
|
||||
@@ -681,7 +681,7 @@ void ConnectableItem::finalizeCreation()
|
||||
|
||||
bool ConnectableItem::hasInputTransitions(const ConnectableItem *parentItem, bool checkChildren) const
|
||||
{
|
||||
for (const TransitionItem *it : qAsConst(m_inputTransitions))
|
||||
for (const TransitionItem *it : std::as_const(m_inputTransitions))
|
||||
if (!SceneUtils::isChild(parentItem, it->connectedItem(this)))
|
||||
return true;
|
||||
|
||||
@@ -701,7 +701,7 @@ bool ConnectableItem::hasInputTransitions(const ConnectableItem *parentItem, boo
|
||||
|
||||
bool ConnectableItem::hasOutputTransitions(const ConnectableItem *parentItem, bool checkChildren) const
|
||||
{
|
||||
for (TransitionItem *it : qAsConst(m_outputTransitions))
|
||||
for (TransitionItem *it : std::as_const(m_outputTransitions))
|
||||
if (!SceneUtils::isChild(parentItem, it->connectedItem(this)))
|
||||
return true;
|
||||
|
||||
@@ -754,7 +754,7 @@ void ConnectableItem::checkOverlapping()
|
||||
}
|
||||
|
||||
// Add new overlapped items
|
||||
for (ConnectableItem *it : qAsConst(overlappedItems)) {
|
||||
for (ConnectableItem *it : std::as_const(overlappedItems)) {
|
||||
if (!m_overlappedItems.contains(it)) {
|
||||
m_overlappedItems << it;
|
||||
it->addOverlappingItem(this);
|
||||
|
||||
@@ -54,20 +54,20 @@ void GraphicsScene::unselectAll()
|
||||
|
||||
void GraphicsScene::unhighlightAll()
|
||||
{
|
||||
for (BaseItem *it : qAsConst(m_baseItems))
|
||||
for (BaseItem *it : std::as_const(m_baseItems))
|
||||
it->setHighlight(false);
|
||||
}
|
||||
|
||||
void GraphicsScene::highlightItems(const QVector<ScxmlTag*> &lstIds)
|
||||
{
|
||||
for (BaseItem *it : qAsConst(m_baseItems))
|
||||
for (BaseItem *it : std::as_const(m_baseItems))
|
||||
it->setHighlight(lstIds.contains(it->tag()));
|
||||
}
|
||||
|
||||
QRectF GraphicsScene::selectedBoundingRect() const
|
||||
{
|
||||
QRectF r;
|
||||
for (BaseItem *item : qAsConst(m_baseItems)) {
|
||||
for (BaseItem *item : std::as_const(m_baseItems)) {
|
||||
if (item->isSelected())
|
||||
r = r.united(item->sceneBoundingRect());
|
||||
}
|
||||
@@ -77,7 +77,7 @@ QRectF GraphicsScene::selectedBoundingRect() const
|
||||
qreal GraphicsScene::selectedMaxWidth() const
|
||||
{
|
||||
qreal maxw = 0;
|
||||
for (BaseItem *item : qAsConst(m_baseItems)) {
|
||||
for (BaseItem *item : std::as_const(m_baseItems)) {
|
||||
if (item->isSelected() && item->type() >= InitialStateType)
|
||||
maxw = qMax(maxw, item->sceneBoundingRect().width());
|
||||
}
|
||||
@@ -87,7 +87,7 @@ qreal GraphicsScene::selectedMaxWidth() const
|
||||
qreal GraphicsScene::selectedMaxHeight() const
|
||||
{
|
||||
qreal maxh = 0;
|
||||
for (BaseItem *item : qAsConst(m_baseItems)) {
|
||||
for (BaseItem *item : std::as_const(m_baseItems)) {
|
||||
if (item->isSelected() && item->type() >= InitialStateType)
|
||||
maxh = qMax(maxh, item->sceneBoundingRect().height());
|
||||
}
|
||||
@@ -103,37 +103,37 @@ void GraphicsScene::alignStates(int alignType)
|
||||
if (r.isValid()) {
|
||||
switch (alignType) {
|
||||
case ActionAlignLeft:
|
||||
for (BaseItem *item : qAsConst(m_baseItems)) {
|
||||
for (BaseItem *item : std::as_const(m_baseItems)) {
|
||||
if (item->isSelected() && item->type() >= InitialStateType)
|
||||
item->moveStateBy(r.left() - item->sceneBoundingRect().left(), 0);
|
||||
}
|
||||
break;
|
||||
case ActionAlignRight:
|
||||
for (BaseItem *item : qAsConst(m_baseItems)) {
|
||||
for (BaseItem *item : std::as_const(m_baseItems)) {
|
||||
if (item->isSelected() && item->type() >= InitialStateType)
|
||||
item->moveStateBy(r.right() - item->sceneBoundingRect().right(), 0);
|
||||
}
|
||||
break;
|
||||
case ActionAlignTop:
|
||||
for (BaseItem *item : qAsConst(m_baseItems)) {
|
||||
for (BaseItem *item : std::as_const(m_baseItems)) {
|
||||
if (item->isSelected() && item->type() >= InitialStateType)
|
||||
item->moveStateBy(0, r.top() - item->sceneBoundingRect().top());
|
||||
}
|
||||
break;
|
||||
case ActionAlignBottom:
|
||||
for (BaseItem *item : qAsConst(m_baseItems)) {
|
||||
for (BaseItem *item : std::as_const(m_baseItems)) {
|
||||
if (item->isSelected() && item->type() >= InitialStateType)
|
||||
item->moveStateBy(0, r.bottom() - item->sceneBoundingRect().bottom());
|
||||
}
|
||||
break;
|
||||
case ActionAlignHorizontal:
|
||||
for (BaseItem *item : qAsConst(m_baseItems)) {
|
||||
for (BaseItem *item : std::as_const(m_baseItems)) {
|
||||
if (item->isSelected() && item->type() >= InitialStateType)
|
||||
item->moveStateBy(0, r.center().y() - item->sceneBoundingRect().center().y());
|
||||
}
|
||||
break;
|
||||
case ActionAlignVertical:
|
||||
for (BaseItem *item : qAsConst(m_baseItems)) {
|
||||
for (BaseItem *item : std::as_const(m_baseItems)) {
|
||||
if (item->isSelected() && item->type() >= InitialStateType)
|
||||
item->moveStateBy(r.center().x() - item->sceneBoundingRect().center().x(), 0);
|
||||
}
|
||||
@@ -154,7 +154,7 @@ void GraphicsScene::adjustStates(int adjustType)
|
||||
qreal maxw = selectedMaxWidth();
|
||||
qreal maxh = selectedMaxHeight();
|
||||
|
||||
for (BaseItem *item : qAsConst(m_baseItems)) {
|
||||
for (BaseItem *item : std::as_const(m_baseItems)) {
|
||||
if (item->isSelected() && item->type() >= InitialStateType) {
|
||||
QRectF rr = item->boundingRect();
|
||||
if ((adjustType == ActionAdjustWidth || adjustType == ActionAdjustSize) && !qFuzzyCompare(rr.width(), maxw))
|
||||
@@ -202,7 +202,7 @@ void GraphicsScene::copy()
|
||||
QVector<ScxmlTag*> tags;
|
||||
if (m_document->currentTag()->tagType() == Scxml) {
|
||||
QVector<BaseItem*> items;
|
||||
for (BaseItem *item : qAsConst(m_baseItems)) {
|
||||
for (BaseItem *item : std::as_const(m_baseItems)) {
|
||||
if (!item->parentItem())
|
||||
items << item;
|
||||
}
|
||||
@@ -220,7 +220,7 @@ void GraphicsScene::copy()
|
||||
mime->setText(QLatin1String(result));
|
||||
mime->setData("StateChartEditor/StateData", result);
|
||||
QStringList strTypes;
|
||||
for (const ScxmlTag *tag : qAsConst(tags))
|
||||
for (const ScxmlTag *tag : std::as_const(tags))
|
||||
strTypes << tag->tagName(false);
|
||||
|
||||
mime->setData("StateChartEditor/CopiedTagTypes", strTypes.join(",").toLocal8Bit());
|
||||
@@ -246,7 +246,7 @@ void GraphicsScene::paste(const QPointF &targetPos)
|
||||
QPointF startPos(targetPos);
|
||||
|
||||
BaseItem *targetItem = nullptr;
|
||||
for (BaseItem *item : qAsConst(m_baseItems)) {
|
||||
for (BaseItem *item : std::as_const(m_baseItems)) {
|
||||
if (item->isSelected() && item->type() >= StateType) {
|
||||
targetItem = item;
|
||||
break;
|
||||
@@ -275,7 +275,7 @@ void GraphicsScene::paste(const QPointF &targetPos)
|
||||
|
||||
void GraphicsScene::setEditorInfo(const QString &key, const QString &value)
|
||||
{
|
||||
for (BaseItem *item : qAsConst(m_baseItems)) {
|
||||
for (BaseItem *item : std::as_const(m_baseItems)) {
|
||||
if (item->isSelected() && item->type() >= TransitionType)
|
||||
item->setEditorInfo(key, value);
|
||||
}
|
||||
@@ -350,7 +350,7 @@ void GraphicsScene::runLayoutToSelectedStates()
|
||||
m_document->undoStack()->beginMacro(Tr::tr("Re-layout"));
|
||||
|
||||
QVector<BaseItem*> selectedItems;
|
||||
for (BaseItem *node : qAsConst(m_baseItems)) {
|
||||
for (BaseItem *node : std::as_const(m_baseItems)) {
|
||||
if (node->isSelected()) {
|
||||
int index = 0;
|
||||
for (int i = 0; i < selectedItems.count(); ++i) {
|
||||
@@ -370,19 +370,19 @@ void GraphicsScene::runLayoutToSelectedStates()
|
||||
// Layout scene items if necessary
|
||||
if (selectedItems.isEmpty()) {
|
||||
QList<QGraphicsItem*> sceneItems;
|
||||
for (BaseItem *item : qAsConst(m_baseItems)) {
|
||||
for (BaseItem *item : std::as_const(m_baseItems)) {
|
||||
if (item->type() >= InitialStateType && !item->parentItem())
|
||||
sceneItems << item;
|
||||
}
|
||||
SceneUtils::layout(sceneItems);
|
||||
|
||||
for (QGraphicsItem *item : qAsConst(sceneItems))
|
||||
for (QGraphicsItem *item : std::as_const(sceneItems))
|
||||
if (item->type() >= StateType)
|
||||
static_cast<StateItem*>(item)->shrink();
|
||||
}
|
||||
|
||||
// Update properties
|
||||
for (BaseItem *node : qAsConst(selectedItems))
|
||||
for (BaseItem *node : std::as_const(selectedItems))
|
||||
node->updateUIProperties();
|
||||
|
||||
m_document->undoStack()->endMacro();
|
||||
@@ -394,31 +394,31 @@ void GraphicsScene::runAutomaticLayout()
|
||||
|
||||
// 1. Find max depth
|
||||
int maxDepth = 0;
|
||||
for (BaseItem *node : qAsConst(m_baseItems)) {
|
||||
for (BaseItem *node : std::as_const(m_baseItems)) {
|
||||
maxDepth = qMax(maxDepth, node->depth());
|
||||
node->setBlockUpdates(true);
|
||||
}
|
||||
|
||||
// 2. Layout every depth-level separately
|
||||
for (int d = (maxDepth + 1); d--;) {
|
||||
for (BaseItem *node : qAsConst(m_baseItems))
|
||||
for (BaseItem *node : std::as_const(m_baseItems))
|
||||
node->doLayout(d);
|
||||
}
|
||||
|
||||
// 3. Layout scene items
|
||||
QList<QGraphicsItem*> sceneItems;
|
||||
for (BaseItem *item : qAsConst(m_baseItems)) {
|
||||
for (BaseItem *item : std::as_const(m_baseItems)) {
|
||||
if (item->type() >= InitialStateType && !item->parentItem())
|
||||
sceneItems << item;
|
||||
}
|
||||
SceneUtils::layout(sceneItems);
|
||||
|
||||
for (QGraphicsItem *item : qAsConst(sceneItems)) {
|
||||
for (QGraphicsItem *item : std::as_const(sceneItems)) {
|
||||
if (item->type() >= StateType)
|
||||
static_cast<StateItem*>(item)->shrink();
|
||||
}
|
||||
|
||||
for (BaseItem *node : qAsConst(m_baseItems)) {
|
||||
for (BaseItem *node : std::as_const(m_baseItems)) {
|
||||
node->updateUIProperties();
|
||||
node->setBlockUpdates(false);
|
||||
}
|
||||
@@ -445,21 +445,21 @@ void GraphicsScene::endTagChange(ScxmlDocument::TagChange change, ScxmlTag *tag,
|
||||
|
||||
switch (change) {
|
||||
case ScxmlDocument::TagAttributesChanged: {
|
||||
for (BaseItem *item : qAsConst(m_baseItems)) {
|
||||
for (BaseItem *item : std::as_const(m_baseItems)) {
|
||||
if (item->tag() == tag)
|
||||
item->updateAttributes();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ScxmlDocument::TagEditorInfoChanged: {
|
||||
for (BaseItem *item : qAsConst(m_baseItems)) {
|
||||
for (BaseItem *item : std::as_const(m_baseItems)) {
|
||||
if (item->tag() == tag)
|
||||
item->updateEditorInfo();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ScxmlDocument::TagCurrentChanged: {
|
||||
for (BaseItem *item : qAsConst(m_baseItems)) {
|
||||
for (BaseItem *item : std::as_const(m_baseItems)) {
|
||||
if (!item->isSelected() && item->tag() == tag)
|
||||
item->setSelected(true);
|
||||
}
|
||||
@@ -702,7 +702,7 @@ BaseItem *GraphicsScene::findItem(const ScxmlTag *tag) const
|
||||
if (!tag)
|
||||
return nullptr;
|
||||
|
||||
for (BaseItem *it : qAsConst(m_baseItems)) {
|
||||
for (BaseItem *it : std::as_const(m_baseItems)) {
|
||||
if (it->tag() == tag)
|
||||
return it;
|
||||
}
|
||||
@@ -715,7 +715,7 @@ void GraphicsScene::removeItems(const ScxmlTag *tag)
|
||||
if (tag) {
|
||||
// Find right items
|
||||
QVector<BaseItem*> items;
|
||||
for (BaseItem *it : qAsConst(m_baseItems)) {
|
||||
for (BaseItem *it : std::as_const(m_baseItems)) {
|
||||
if (it->tag() == tag)
|
||||
items << it;
|
||||
}
|
||||
@@ -741,7 +741,7 @@ QPair<bool, bool> GraphicsScene::checkSnapToItem(BaseItem *item, const QPointF &
|
||||
qreal diffY = 8;
|
||||
qreal diffYdX = 2000;
|
||||
|
||||
for (BaseItem *it : qAsConst(m_baseItems)) {
|
||||
for (BaseItem *it : std::as_const(m_baseItems)) {
|
||||
if (!it->isSelected() && it != item && it->parentItem() == parentItem && it->type() >= InitialStateType) {
|
||||
QPointF c = it->sceneCenter();
|
||||
qreal dX = qAbs(c.x() - p.x());
|
||||
@@ -779,7 +779,7 @@ void GraphicsScene::selectionChanged(bool para)
|
||||
int baseCount = 0;
|
||||
int stateTypeCount = 0;
|
||||
|
||||
for (BaseItem *item : qAsConst(m_baseItems)) {
|
||||
for (BaseItem *item : std::as_const(m_baseItems)) {
|
||||
if (item->isSelected()) {
|
||||
if (item->type() >= TransitionType)
|
||||
baseCount++;
|
||||
@@ -825,7 +825,7 @@ void GraphicsScene::removeWarningItem(WarningItem *item)
|
||||
void GraphicsScene::warningVisibilityChanged(int type, WarningItem *item)
|
||||
{
|
||||
if (!m_autoLayoutRunning && !m_initializing) {
|
||||
for (WarningItem *it : qAsConst(m_allWarnings))
|
||||
for (WarningItem *it : std::as_const(m_allWarnings))
|
||||
if (it != item && (type == 0 || it->type() == type))
|
||||
it->check();
|
||||
}
|
||||
@@ -834,7 +834,7 @@ void GraphicsScene::warningVisibilityChanged(int type, WarningItem *item)
|
||||
ScxmlTag *GraphicsScene::tagByWarning(const ScxmlEditor::OutputPane::Warning *w) const
|
||||
{
|
||||
ScxmlTag *tag = nullptr;
|
||||
for (WarningItem *it : qAsConst(m_allWarnings))
|
||||
for (WarningItem *it : std::as_const(m_allWarnings))
|
||||
if (it->warning() == w) {
|
||||
tag = it->tag();
|
||||
break;
|
||||
@@ -896,7 +896,7 @@ void GraphicsScene::removeChild(BaseItem *item)
|
||||
|
||||
void GraphicsScene::checkItemsVisibility(double scaleFactor)
|
||||
{
|
||||
for (BaseItem *item : qAsConst(m_baseItems)) {
|
||||
for (BaseItem *item : std::as_const(m_baseItems)) {
|
||||
item->checkVisibility(scaleFactor);
|
||||
}
|
||||
}
|
||||
@@ -905,7 +905,7 @@ void GraphicsScene::checkInitialState()
|
||||
{
|
||||
if (m_document) {
|
||||
QList<QGraphicsItem*> sceneItems;
|
||||
for (BaseItem *item : qAsConst(m_baseItems)) {
|
||||
for (BaseItem *item : std::as_const(m_baseItems)) {
|
||||
if (item->type() >= InitialStateType && !item->parentItem())
|
||||
sceneItems << item;
|
||||
}
|
||||
@@ -919,14 +919,14 @@ void GraphicsScene::checkInitialState()
|
||||
|
||||
void GraphicsScene::clearAllTags()
|
||||
{
|
||||
for (BaseItem *it : qAsConst(m_baseItems)) {
|
||||
for (BaseItem *it : std::as_const(m_baseItems)) {
|
||||
it->setTag(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
void GraphicsScene::setBlockUpdates(bool block)
|
||||
{
|
||||
for (BaseItem *it : qAsConst(m_baseItems)) {
|
||||
for (BaseItem *it : std::as_const(m_baseItems)) {
|
||||
it->setBlockUpdates(block);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,16 +51,16 @@ void ParallelItem::doLayout(int d)
|
||||
}
|
||||
|
||||
// 2. Adjust sizes
|
||||
for (StateItem *itt : qAsConst(children))
|
||||
for (StateItem *itt : std::as_const(children))
|
||||
itt->shrink();
|
||||
|
||||
qreal maxw = 0;
|
||||
for (StateItem *itt : qAsConst(children)) {
|
||||
for (StateItem *itt : std::as_const(children)) {
|
||||
QRectF rr = itt->boundingRect();
|
||||
maxw = qMax(rr.width(), maxw);
|
||||
}
|
||||
|
||||
for (StateItem *itt : qAsConst(children)) {
|
||||
for (StateItem *itt : std::as_const(children)) {
|
||||
QRectF rr = itt->boundingRect();
|
||||
if (!qFuzzyCompare(rr.width(), maxw))
|
||||
rr.setWidth(maxw);
|
||||
|
||||
@@ -295,7 +295,7 @@ void layout(const QList<QGraphicsItem*> &items)
|
||||
}
|
||||
|
||||
// Finally set initial and final positions
|
||||
for (ConnectableItem *item : qAsConst(childItems)) {
|
||||
for (ConnectableItem *item : std::as_const(childItems)) {
|
||||
if (item == firstItem)
|
||||
initialItem->setPos(firstItem->pos() + firstItem->boundingRect().topLeft()
|
||||
- QPointF(50, 50));
|
||||
|
||||
@@ -54,7 +54,7 @@ bool hasSiblingStates(T *item)
|
||||
children << it;
|
||||
}
|
||||
|
||||
for (QGraphicsItem *it : qAsConst(children))
|
||||
for (QGraphicsItem *it : std::as_const(children))
|
||||
if (it != item && it->type() == item->type())
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ void ScxmlDocument::addNamespace(ScxmlNamespace *ns)
|
||||
|
||||
ScxmlTag *scxmlTag = scxmlRootTag();
|
||||
if (scxmlTag) {
|
||||
for (ScxmlNamespace *ns : qAsConst(m_namespaces)) {
|
||||
for (ScxmlNamespace *ns : std::as_const(m_namespaces)) {
|
||||
QString prefix = ns->prefix();
|
||||
if (prefix.isEmpty())
|
||||
prefix = "xmlns";
|
||||
@@ -149,7 +149,7 @@ bool ScxmlDocument::generateSCXML(QIODevice *io, ScxmlTag *tag) const
|
||||
ScxmlTag *ScxmlDocument::createScxmlTag()
|
||||
{
|
||||
auto tag = new ScxmlTag(Scxml, this);
|
||||
for (ScxmlNamespace *ns : qAsConst(m_namespaces)) {
|
||||
for (ScxmlNamespace *ns : std::as_const(m_namespaces)) {
|
||||
QString prefix = ns->prefix();
|
||||
if (prefix.isEmpty())
|
||||
prefix = "xmlns";
|
||||
@@ -291,7 +291,7 @@ bool ScxmlDocument::pasteData(const QByteArray &data, const QPointF &minPos, con
|
||||
QBuffer buffer(&d);
|
||||
buffer.open(QIODevice::ReadOnly);
|
||||
QXmlStreamReader xml(&buffer);
|
||||
for (ScxmlNamespace *ns : qAsConst(m_namespaces)) {
|
||||
for (ScxmlNamespace *ns : std::as_const(m_namespaces)) {
|
||||
xml.addExtraNamespaceDeclaration(QXmlStreamNamespaceDeclaration(ns->prefix(), ns->name()));
|
||||
}
|
||||
|
||||
@@ -576,7 +576,7 @@ QString ScxmlDocument::nextUniqueId(const QString &key)
|
||||
name = QString::fromLatin1("%1_%2").arg(key).arg(id);
|
||||
|
||||
// Check duplicate
|
||||
for (const ScxmlTag *tag : qAsConst(m_tags)) {
|
||||
for (const ScxmlTag *tag : std::as_const(m_tags)) {
|
||||
if (tag->attribute("id") == name) {
|
||||
bFound = true;
|
||||
break;
|
||||
@@ -598,7 +598,7 @@ QString ScxmlDocument::getUniqueCopyId(const ScxmlTag *tag)
|
||||
while (true) {
|
||||
bFound = false;
|
||||
// Check duplicate
|
||||
for (const ScxmlTag *t : qAsConst(m_tags)) {
|
||||
for (const ScxmlTag *t : std::as_const(m_tags)) {
|
||||
if (t->attribute("id") == name && t != tag) {
|
||||
name = QString::fromLatin1("%1_Copy%2").arg(key).arg(counter);
|
||||
bFound = true;
|
||||
|
||||
@@ -251,7 +251,7 @@ bool ScxmlTag::hasData() const
|
||||
if (!m_attributeNames.isEmpty() || !m_content.isEmpty())
|
||||
return true;
|
||||
|
||||
for (ScxmlTag *tag : qAsConst(m_childTags)) {
|
||||
for (ScxmlTag *tag : std::as_const(m_childTags)) {
|
||||
if (tag->hasData())
|
||||
return true;
|
||||
}
|
||||
@@ -261,7 +261,7 @@ bool ScxmlTag::hasData() const
|
||||
|
||||
bool ScxmlTag::hasChild(TagType type) const
|
||||
{
|
||||
for (ScxmlTag *tag : qAsConst(m_childTags)) {
|
||||
for (ScxmlTag *tag : std::as_const(m_childTags)) {
|
||||
if (tag->tagType() == type)
|
||||
return true;
|
||||
}
|
||||
@@ -271,7 +271,7 @@ bool ScxmlTag::hasChild(TagType type) const
|
||||
|
||||
bool ScxmlTag::hasChild(const QString &name) const
|
||||
{
|
||||
for (ScxmlTag *tag : qAsConst(m_childTags)) {
|
||||
for (ScxmlTag *tag : std::as_const(m_childTags)) {
|
||||
if (tag->tagName() == name)
|
||||
return true;
|
||||
}
|
||||
@@ -484,7 +484,7 @@ QVector<ScxmlTag*> ScxmlTag::allChildren() const
|
||||
QVector<ScxmlTag*> ScxmlTag::children(const QString &name) const
|
||||
{
|
||||
QVector<ScxmlTag*> children;
|
||||
for (ScxmlTag *tag : qAsConst(m_childTags)) {
|
||||
for (ScxmlTag *tag : std::as_const(m_childTags)) {
|
||||
if (tag->tagName() == name)
|
||||
children << tag;
|
||||
}
|
||||
@@ -494,7 +494,7 @@ QVector<ScxmlTag*> ScxmlTag::children(const QString &name) const
|
||||
|
||||
ScxmlTag *ScxmlTag::child(const QString &name) const
|
||||
{
|
||||
for (ScxmlTag *tag : qAsConst(m_childTags)) {
|
||||
for (ScxmlTag *tag : std::as_const(m_childTags)) {
|
||||
if (tag->tagName() == name)
|
||||
return tag;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ bool checkPaste(const QString &copiedTagTypes, const ScxmlTag *currentTag)
|
||||
return false;
|
||||
|
||||
QVector<TagType> childTags = allowedChildTypes(currentTag->tagType());
|
||||
for (const TagType &type : qAsConst(tagTypes)) {
|
||||
for (const TagType &type : std::as_const(tagTypes)) {
|
||||
if (!childTags.contains(type))
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user