mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 13:30:34 +01:00
Fixed deprecated qAsConst() to std::as_const()
This commit is contained in:
@@ -203,7 +203,7 @@ void TerminalStripDrawer::paint(QPainter *painter)
|
||||
painter->restore();
|
||||
|
||||
//Draw the bridges
|
||||
for (const auto &points_ : qAsConst(bridges_anchor_points))
|
||||
for (const auto &points_ : std::as_const(bridges_anchor_points))
|
||||
{
|
||||
painter->save();
|
||||
auto pen_{painter->pen()};
|
||||
|
||||
@@ -126,7 +126,7 @@ void RemoveTerminalFromStripCommand::redo()
|
||||
if (m_strip)
|
||||
{
|
||||
QVector<QSharedPointer<RealTerminal>> real_t;
|
||||
for (const auto &real_t_vector : qAsConst(m_terminals)) {
|
||||
for (const auto &real_t_vector : std::as_const(m_terminals)) {
|
||||
real_t.append(real_t_vector);
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ void UnGroupTerminalsCommand::undo()
|
||||
m_terminal_strip->groupTerminals(key, m_physical_real_H.value(key));
|
||||
}
|
||||
//Second, set level.
|
||||
for (const auto &pair : qAsConst(m_real_t_level)) {
|
||||
for (const auto &pair : std::as_const(m_real_t_level)) {
|
||||
m_terminal_strip->setLevel(pair.first, pair.second);
|
||||
}
|
||||
}
|
||||
@@ -78,7 +78,7 @@ void UnGroupTerminalsCommand::redo()
|
||||
{
|
||||
if (m_terminal_strip)
|
||||
{
|
||||
for (const auto &value : qAsConst(m_physical_real_H)) {
|
||||
for (const auto &value : std::as_const(m_physical_real_H)) {
|
||||
m_terminal_strip->unGroupTerminals(value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -466,7 +466,7 @@ QSharedPointer<RealTerminal> TerminalStrip::realTerminalForUuid(const QUuid &uui
|
||||
QVector<QSharedPointer<RealTerminal>> TerminalStrip::realTerminals() const
|
||||
{
|
||||
QVector<QSharedPointer<RealTerminal>> vector_;
|
||||
for (const auto &phy : qAsConst(m_physical_terminals)) {
|
||||
for (const auto &phy : std::as_const(m_physical_terminals)) {
|
||||
vector_.append(phy->realTerminals());
|
||||
}
|
||||
return vector_;
|
||||
@@ -856,7 +856,7 @@ QSharedPointer<TerminalStripBridge> TerminalStrip::isBridged(const QSharedPointe
|
||||
{
|
||||
if (real_terminal)
|
||||
{
|
||||
for (const auto &bridge_ : qAsConst(m_bridge)) {
|
||||
for (const auto &bridge_ : std::as_const(m_bridge)) {
|
||||
if (bridge_->realTerminals().contains(real_terminal))
|
||||
return bridge_;
|
||||
}
|
||||
@@ -983,7 +983,7 @@ QDomElement TerminalStrip::toXml(QDomDocument &parent_document)
|
||||
}
|
||||
root_elmt.appendChild(xml_layout);
|
||||
|
||||
for (const auto &bridge_ : qAsConst(m_bridge)) {
|
||||
for (const auto &bridge_ : std::as_const(m_bridge)) {
|
||||
root_elmt.appendChild(bridge_->toXml(parent_document));
|
||||
}
|
||||
|
||||
@@ -1024,7 +1024,7 @@ bool TerminalStrip::fromXml(QDomElement &xml_element)
|
||||
for (auto &xml_real : QETXML::findInDomElement(xml_physical, RealTerminal::xmlTagName()))
|
||||
{
|
||||
const auto uuid_ = QUuid(xml_real.attribute(QStringLiteral("element_uuid")));
|
||||
for (auto terminal_elmt : qAsConst(free_terminals))
|
||||
for (auto terminal_elmt : std::as_const(free_terminals))
|
||||
{
|
||||
if (terminal_elmt->uuid() == uuid_)
|
||||
{
|
||||
|
||||
@@ -85,7 +85,7 @@ QDomElement TerminalStripBridge::toXml(QDomDocument &parent_document) const
|
||||
root_elmt.setAttribute(QStringLiteral("color"), m_color.name());
|
||||
|
||||
auto terminals_elmt = parent_document.createElement(QStringLiteral("real_terminals"));
|
||||
for (const auto &real_t : qAsConst(m_real_terminals))
|
||||
for (const auto &real_t : std::as_const(m_real_terminals))
|
||||
{
|
||||
if (real_t)
|
||||
{
|
||||
|
||||
@@ -535,7 +535,7 @@ modelRealTerminalData TerminalStripModel::dataAtRow(int row) const
|
||||
else
|
||||
{
|
||||
auto current_row = 0;
|
||||
for (const auto &physical_data : qAsConst(m_physical_data))
|
||||
for (const auto &physical_data : std::as_const(m_physical_data))
|
||||
{
|
||||
for (const auto &real_data : physical_data.real_data)
|
||||
{
|
||||
@@ -567,7 +567,7 @@ void TerminalStripModel::replaceDataAtRow(modelRealTerminalData data, int row)
|
||||
auto current_row = 0;
|
||||
auto current_physical = 0;
|
||||
|
||||
for (const auto &physical_data : qAsConst(m_physical_data))
|
||||
for (const auto &physical_data : std::as_const(m_physical_data))
|
||||
{
|
||||
auto current_real = 0;
|
||||
for (int i=0 ; i<physical_data.real_data.count() ; ++i)
|
||||
@@ -606,7 +606,7 @@ modelPhysicalTerminalData TerminalStripModel::physicalDataAtIndex(int index) con
|
||||
int current_phy = -1;
|
||||
bool match_ = false;
|
||||
|
||||
for (const auto &ptd_ : qAsConst(m_physical_data))
|
||||
for (const auto &ptd_ : std::as_const(m_physical_data))
|
||||
{
|
||||
current_checked_index += ptd_.real_data.size();
|
||||
++current_phy;
|
||||
@@ -637,9 +637,9 @@ modelRealTerminalData TerminalStripModel::realDataAtIndex(int index) const
|
||||
|
||||
int current_checked_index = -1;
|
||||
|
||||
for (const auto & ptd_ : qAsConst(m_physical_data))
|
||||
for (const auto & ptd_ : std::as_const(m_physical_data))
|
||||
{
|
||||
for (const auto & rtd_ : qAsConst(ptd_.real_data)) {
|
||||
for (const auto & rtd_ : std::as_const(ptd_.real_data)) {
|
||||
++current_checked_index;
|
||||
if (current_checked_index == index) {
|
||||
return rtd_;
|
||||
|
||||
@@ -60,7 +60,7 @@ void TerminalStripTreeDockWidget::reload()
|
||||
m_uuid_terminal_H.clear();
|
||||
m_uuid_strip_H.clear();
|
||||
|
||||
for (const auto &connection_ : qAsConst(m_strip_changed_connection)) {
|
||||
for (const auto &connection_ : std::as_const(m_strip_changed_connection)) {
|
||||
disconnect(connection_);
|
||||
}
|
||||
m_strip_changed_connection.clear();
|
||||
@@ -222,7 +222,7 @@ void TerminalStripTreeDockWidget::buildTree()
|
||||
return a->name() < b->name();
|
||||
});
|
||||
|
||||
for (const auto &ts : qAsConst(ts_vector)) {
|
||||
for (const auto &ts : std::as_const(ts_vector)) {
|
||||
addTerminalStrip(ts);
|
||||
}
|
||||
addFreeTerminal();
|
||||
@@ -324,7 +324,7 @@ void TerminalStripTreeDockWidget::addFreeTerminal()
|
||||
|
||||
auto free_terminal_item = ui->m_tree_view->topLevelItem(1);
|
||||
|
||||
for (const auto terminal : qAsConst(vector_))
|
||||
for (const auto terminal : std::as_const(vector_))
|
||||
{
|
||||
QUuid uuid_ = terminal->uuid();
|
||||
QStringList strl{terminal->actualLabel()};
|
||||
|
||||
@@ -151,7 +151,7 @@ Diagram::~Diagram()
|
||||
continue;
|
||||
deletable_items.append(qgi);
|
||||
}
|
||||
for (const auto &item : qAsConst(deletable_items))
|
||||
for (const auto &item : std::as_const(deletable_items))
|
||||
{
|
||||
removeItem(item);
|
||||
delete item;
|
||||
@@ -1453,13 +1453,13 @@ bool Diagram::fromXml(QDomElement &document,
|
||||
if (position != QPointF())
|
||||
{
|
||||
QVector <QGraphicsItem *> added_items;
|
||||
for (auto element : qAsConst(added_elements )) added_items << element;
|
||||
for (auto cond : qAsConst(added_conductors )) added_items << cond;
|
||||
for (auto shape : qAsConst(added_shapes )) added_items << shape;
|
||||
for (auto text : qAsConst(added_texts )) added_items << text;
|
||||
for (auto image : qAsConst(added_images )) added_items << image;
|
||||
for (auto table : qAsConst(added_tables )) added_items << table;
|
||||
for (const auto &strip : qAsConst(added_strips)) added_items << strip;
|
||||
for (auto element : std::as_const(added_elements )) added_items << element;
|
||||
for (auto cond : std::as_const(added_conductors )) added_items << cond;
|
||||
for (auto shape : std::as_const(added_shapes )) added_items << shape;
|
||||
for (auto text : std::as_const(added_texts )) added_items << text;
|
||||
for (auto image : std::as_const(added_images )) added_items << image;
|
||||
for (auto table : std::as_const(added_tables )) added_items << table;
|
||||
for (const auto &strip : std::as_const(added_strips)) added_items << strip;
|
||||
|
||||
//Get the top left corner of the rectangle that contain all added items
|
||||
QRectF items_rect;
|
||||
@@ -1568,11 +1568,11 @@ void Diagram::refreshContents()
|
||||
conductor->refreshText();
|
||||
}
|
||||
|
||||
for (auto &table : qAsConst(dc_.m_tables)) {
|
||||
for (auto &table : std::as_const(dc_.m_tables)) {
|
||||
table->initLink();
|
||||
}
|
||||
|
||||
for (auto &strip :qAsConst(dc_.m_terminal_strip)) {
|
||||
for (auto &strip :std::as_const(dc_.m_terminal_strip)) {
|
||||
strip->refreshPending();
|
||||
}
|
||||
}
|
||||
@@ -1757,7 +1757,7 @@ void Diagram::invertSelection()
|
||||
item_list << item;
|
||||
}
|
||||
}
|
||||
for (auto item : qAsConst(item_list)) {
|
||||
for (auto item : std::as_const(item_list)) {
|
||||
item -> setSelected(!item -> isSelected());
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ DiagramContent::DiagramContent(Diagram *diagram, bool selected) :
|
||||
item_list = diagram->items();
|
||||
}
|
||||
|
||||
for (const auto &item : qAsConst(item_list))
|
||||
for (const auto &item : std::as_const(item_list))
|
||||
{
|
||||
switch (item->type())
|
||||
{
|
||||
@@ -391,10 +391,10 @@ QList<QGraphicsItem *> DiagramContent::items(int filter) const
|
||||
if (filter & ElementTextFields) for(auto qgi : m_element_texts) items_list << qgi;
|
||||
if (filter & TextGroup) for(auto qgi : m_texts_groups) items_list << qgi;
|
||||
if (filter & Tables) for(auto qgi : m_tables) items_list << qgi;
|
||||
if (filter & TerminalStrip) for(const auto qgi : qAsConst(m_terminal_strip)) items_list << qgi;
|
||||
if (filter & TerminalStrip) for(const auto qgi : std::as_const(m_terminal_strip)) items_list << qgi;
|
||||
|
||||
if (filter & SelectedOnly) {
|
||||
for(const auto &qgi : qAsConst(items_list)) {
|
||||
for(const auto &qgi : std::as_const(items_list)) {
|
||||
if (!qgi -> isSelected()) items_list.removeOne(qgi);
|
||||
}
|
||||
}
|
||||
@@ -420,7 +420,7 @@ int DiagramContent::count(int filter) const
|
||||
if (filter & ElementTextFields) for(auto deti : m_element_texts) { if (deti -> isSelected()) ++ count; }
|
||||
if (filter & TextGroup) for(auto etig : m_texts_groups) { if (etig -> isSelected()) ++ count; }
|
||||
if (filter & Tables) for(auto table : m_tables) { if (table -> isSelected()) ++ count; }
|
||||
if (filter & TerminalStrip) for(const auto &strip : qAsConst(m_terminal_strip)) {if (strip->isSelected()) ++ count;}
|
||||
if (filter & TerminalStrip) for(const auto &strip : std::as_const(m_terminal_strip)) {if (strip->isSelected()) ++ count;}
|
||||
}
|
||||
else {
|
||||
if (filter & Elements) count += m_elements.count();
|
||||
|
||||
@@ -1069,7 +1069,7 @@ void QETElementEditor::updateAction()
|
||||
<< ui->m_revert_selection_action
|
||||
<< ui->m_paste_from_file_action
|
||||
<< ui->m_paste_from_element_action;
|
||||
for (auto action : qAsConst(ro_list)) {
|
||||
for (auto action : std::as_const(ro_list)) {
|
||||
action->setDisabled(m_read_only);
|
||||
}
|
||||
|
||||
@@ -1084,7 +1084,7 @@ void QETElementEditor::updateAction()
|
||||
<< ui->m_flip_action
|
||||
<< ui->m_mirror_action;
|
||||
auto items_selected = !m_read_only && m_elmt_scene->selectedItems().count();
|
||||
for (auto action : qAsConst(select_list)) {
|
||||
for (auto action : std::as_const(select_list)) {
|
||||
action->setEnabled(items_selected);
|
||||
}
|
||||
|
||||
|
||||
@@ -229,7 +229,7 @@ void TerminalEditor::activeConnections(bool active)
|
||||
m_editor_connections << connect(ui->m_type_cb, QOverload<int>::of(&QComboBox::activated),
|
||||
this, &TerminalEditor::typeEdited);
|
||||
} else {
|
||||
for (auto const & con : qAsConst(m_editor_connections)) {
|
||||
for (auto const & con : std::as_const(m_editor_connections)) {
|
||||
QObject::disconnect(con);
|
||||
}
|
||||
m_editor_connections.clear();
|
||||
|
||||
@@ -84,7 +84,7 @@ void TextEditor::setUpChangeConnection(QPointer<PartText> part)
|
||||
|
||||
void TextEditor::disconnectChangeConnection()
|
||||
{
|
||||
for (const auto &connection : qAsConst(m_change_connection)) {
|
||||
for (const auto &connection : std::as_const(m_change_connection)) {
|
||||
disconnect(connection);
|
||||
}
|
||||
m_change_connection.clear();
|
||||
|
||||
@@ -59,11 +59,11 @@ QVector <QPointer<Element>> ElementProvider::freeElement(ElementData::Types filt
|
||||
QList<Element *> elmt_list;
|
||||
|
||||
//search in all diagram
|
||||
for (const auto &diagram_ : qAsConst(m_diagram_list))
|
||||
for (const auto &diagram_ : std::as_const(m_diagram_list))
|
||||
{
|
||||
//get all element in diagram d
|
||||
elmt_list = diagram_->elements();
|
||||
for (const auto &elmt_ : qAsConst(elmt_list))
|
||||
for (const auto &elmt_ : std::as_const(elmt_list))
|
||||
{
|
||||
if (filter & elmt_->elementData().m_type &&
|
||||
elmt_->isFree())
|
||||
@@ -106,7 +106,7 @@ QList <Element *> ElementProvider::fromUuids(QList<QUuid> uuid_list) const
|
||||
QVector<QPointer<Element>> ElementProvider::find(ElementData::Types elmt_type) const
|
||||
{
|
||||
QVector<QPointer<Element>> returned_vector;
|
||||
for (const auto &diagram_ : qAsConst(m_diagram_list))
|
||||
for (const auto &diagram_ : std::as_const(m_diagram_list))
|
||||
{
|
||||
const auto elmt_list = diagram_->elements();
|
||||
for (const auto &elmt_ : elmt_list)
|
||||
@@ -198,7 +198,7 @@ QVector<TerminalElement *> ElementProvider::freeTerminal() const
|
||||
{
|
||||
QVector<TerminalElement *> vector_;
|
||||
|
||||
for (const auto &diagram : qAsConst(m_diagram_list))
|
||||
for (const auto &diagram : std::as_const(m_diagram_list))
|
||||
{
|
||||
const auto elmt_list{diagram->elements()};
|
||||
|
||||
|
||||
@@ -594,7 +594,7 @@ void QetShapeItem::addHandler()
|
||||
{
|
||||
m_handler_vector = QetGraphicsHandlerItem::handlerForPoint(mapToScene(points_vector), QETUtils::graphicsHandlerSize(this));
|
||||
|
||||
for(const auto handler : qAsConst(m_handler_vector))
|
||||
for(const auto handler : std::as_const(m_handler_vector))
|
||||
{
|
||||
handler->setZValue(this->zValue()+1);
|
||||
handler->setColor(Qt::blue);
|
||||
|
||||
@@ -2077,7 +2077,7 @@ void QETProject::updateDiagramsFolioData()
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto &diagram_ : qAsConst(m_diagrams_list)) {
|
||||
for (const auto &diagram_ : std::as_const(m_diagrams_list)) {
|
||||
diagram_->update();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ void ElementInfoWidget::buildInterface()
|
||||
*/
|
||||
ElementInfoPartWidget *ElementInfoWidget::infoPartWidgetForKey(const QString &key) const
|
||||
{
|
||||
for (const auto &eipw : qAsConst(m_eipw_list))
|
||||
for (const auto &eipw : std::as_const(m_eipw_list))
|
||||
{
|
||||
if (eipw->key() == key)
|
||||
return eipw;
|
||||
@@ -245,7 +245,7 @@ DiagramContext ElementInfoWidget::currentInfo() const
|
||||
{
|
||||
DiagramContext info_;
|
||||
|
||||
for (const auto &eipw : qAsConst(m_eipw_list))
|
||||
for (const auto &eipw : std::as_const(m_eipw_list))
|
||||
{
|
||||
|
||||
//add value only if they're something to store
|
||||
|
||||
@@ -504,7 +504,7 @@ void ShapeGraphicsItemPropertiesWidget::setUpEditConnection()
|
||||
|
||||
void ShapeGraphicsItemPropertiesWidget::clearEditConnection()
|
||||
{
|
||||
for (const auto &c : qAsConst(m_edit_connection)) {
|
||||
for (const auto &c : std::as_const(m_edit_connection)) {
|
||||
disconnect(c);
|
||||
}
|
||||
m_edit_connection.clear();
|
||||
|
||||
@@ -139,7 +139,7 @@ void MoveGraphicsItemCommand::move(const QPointF &movement)
|
||||
}
|
||||
|
||||
//Move some conductors
|
||||
for (const auto &conductor : qAsConst(m_content.m_conductors_to_move)) {
|
||||
for (const auto &conductor : std::as_const(m_content.m_conductors_to_move)) {
|
||||
setupAnimation(conductor,
|
||||
"pos",
|
||||
conductor->pos(),
|
||||
@@ -147,7 +147,7 @@ void MoveGraphicsItemCommand::move(const QPointF &movement)
|
||||
}
|
||||
|
||||
//Recalculate the path of other conductors
|
||||
for (const auto &conductor : qAsConst(m_content.m_conductors_to_update)) {
|
||||
for (const auto &conductor : std::as_const(m_content.m_conductors_to_update)) {
|
||||
setupAnimation(conductor, "animPath", 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user