Revert "Try Clazy fix-its"

Segfault on old Qt versions!
This reverts commit dba7caed3035585af4b301ed87bd4131dcac994c.
This commit is contained in:
Laurent Trinques 2025-02-14 16:17:58 +01:00
parent dba7caed30
commit 43f0107eb1
88 changed files with 409 additions and 512 deletions

View File

@ -779,8 +779,7 @@ void ElementsCollectionWidget::search()
const QStringList text_list = text.split("+", Qt::SkipEmptyParts);
#endif
QModelIndexList match_index;
for (const QString& txt : text_list)
{
for (QString txt : text_list) {
match_index << m_model->match(m_showed_index.isValid()
? m_model->index(0,0,m_showed_index)
: m_model->index(0,0),
@ -791,7 +790,7 @@ void ElementsCollectionWidget::search()
| Qt::MatchRecursive);
}
for (QModelIndex index : std::as_const(match_index))
for(QModelIndex index : match_index)
showAndExpandItem(index);
}

View File

@ -41,8 +41,8 @@ ElementsTreeView::ElementsTreeView(QWidget *parent) :
QPalette qp = palette();
qp.setColor(QPalette::Text, Qt::black);
qp.setColor(QPalette::Base, Qt::white);
qp.setColor(QPalette::AlternateBase, QColor(0xe8e8e8));
qp.setColor(QPalette::Highlight, QColor(0x678db2));
qp.setColor(QPalette::AlternateBase, QColor("#e8e8e8"));
qp.setColor(QPalette::Highlight, QColor("#678db2"));
qp.setColor(QPalette::HighlightedText, Qt::black);
setPalette(qp);
}

View File

@ -206,8 +206,7 @@ void XmlProjectElementCollectionItem::setUpData()
ElementsLocation location(embeddedPath(), m_project);
DiagramContext context = location.elementInformations();
QStringList search_list;
for (const QString& key : context.keys())
{
for (QString key : context.keys()) {
search_list.append(context.value(key).toString());
}
search_list.append(localName());

View File

@ -59,7 +59,7 @@ void NameListWidget::addLine()
*/
void NameListWidget::setNames(const NamesList &name_list)
{
for (const QString& lang : name_list.langs())
for (QString lang : name_list.langs())
{
QString value = name_list[lang];
QStringList values;
@ -138,8 +138,7 @@ void NameListWidget::setClipboardValue(QHash<QString, QString> value)
QStringList list = value.keys();
list.sort();
for (const QString& key : list)
{
for (QString key : list) {
ui->m_clipboard_cb->addItem(key, value.value(key));
}
}

View File

@ -98,8 +98,7 @@ void QWidgetAnimation::show()
int available_ = m_orientation == Qt::Horizontal
? m_widget->parentWidget()->width()
: m_widget->parentWidget()->height();
for (auto w : std::as_const(m_widget_to_substract))
{
for (auto w : m_widget_to_substract) {
available_ -= m_orientation == Qt::Horizontal
? w->minimumSizeHint().width()
: w->minimumSizeHint().height();

View File

@ -128,7 +128,7 @@ void SearchAndReplaceWorker::replaceElement(QList<Element *> list)
{
DiagramContext old_context;
DiagramContext new_context = old_context = elmt->elementInformations();
for (const QString& key : QETInformation::elementInfoKeys())
for (QString key : QETInformation::elementInfoKeys())
{
new_context.addValue(key, applyChange(old_context.value(key).toString(),
m_element_context.value(key).toString()));
@ -219,7 +219,7 @@ void SearchAndReplaceWorker::replaceConductor(QList<Conductor *> list)
{
QSet <Conductor *> conductors_list = c->relatedPotentialConductors(true);
conductors_list << c;
for (Conductor* cc : std::as_const(conductors_list))
for (Conductor *cc : conductors_list)
{
QVariant old_value, new_value;
old_value.setValue(cc->properties());
@ -270,26 +270,22 @@ void SearchAndReplaceWorker::replaceAdvanced(
return;
}
for (Diagram* dd : std::as_const(diagrams))
{
for (Diagram *dd : diagrams) {
if (dd->project() != project_) {
return;
}
}
for (Element* elmt : std::as_const(elements))
{
for (Element *elmt : elements) {
if (!elmt->diagram() || elmt->diagram()->project() != project_) {
return;
}
}
for (IndependentTextItem* text : std::as_const(texts))
{
for (IndependentTextItem *text : texts) {
if (!text->diagram() || text->diagram()->project() != project_) {
return;
}
}
for (Conductor* cc : std::as_const(conductors))
{
for (Conductor *cc : conductors) {
if (!cc->diagram() || cc->diagram()->project() != project_) {
return;
}
@ -304,7 +300,7 @@ void SearchAndReplaceWorker::replaceAdvanced(
project_->undoStack()->beginMacro(QObject::tr("Rechercher / remplacer avancé"));
if (who == 0)
{
for (Diagram* diagram : std::as_const(diagrams))
for (Diagram *diagram : diagrams)
{
TitleBlockProperties old_properties = diagram->border_and_titleblock.exportTitleBlock();
TitleBlockProperties new_properties = replaceAdvanced(diagram);
@ -315,7 +311,7 @@ void SearchAndReplaceWorker::replaceAdvanced(
}
else if (who == 1)
{
for (Element* element : std::as_const(elements))
for (Element *element : elements)
{
DiagramContext old_context = element->elementInformations();
DiagramContext new_context = replaceAdvanced(element);
@ -326,7 +322,7 @@ void SearchAndReplaceWorker::replaceAdvanced(
}
else if (who == 2)
{
for (Conductor* conductor : std::as_const(conductors))
for (Conductor *conductor : conductors)
{
ConductorProperties old_properties = conductor->properties();
ConductorProperties new_properties = replaceAdvanced(conductor);
@ -335,7 +331,7 @@ void SearchAndReplaceWorker::replaceAdvanced(
QSet <Conductor *> potential_conductors = conductor->relatedPotentialConductors(true);
potential_conductors << conductor;
for (Conductor* c : std::as_const(potential_conductors))
for (Conductor *c : potential_conductors)
{
QVariant old_value, new_value;
old_value.setValue(c->properties());
@ -347,7 +343,7 @@ void SearchAndReplaceWorker::replaceAdvanced(
}
else if (who == 3)
{
for (IndependentTextItem* text : std::as_const(texts))
for (IndependentTextItem *text : texts)
{
QRegularExpression rx(m_advanced_struct.search);
if (!rx.isValid())

View File

@ -95,20 +95,17 @@ void replaceAdvancedDialog::fillWhatComboBox(int index)
if (index == 0)
{
for (const QString& str : QETInformation::diagramInfoKeys())
{
for (QString str : QETInformation::diagramInfoKeys()) {
ui->m_what_cb->addItem(QETInformation::translatedInfoKey(str), str);
}
}
else if (index == 1) {
for (const QString& str : QETInformation::elementInfoKeys())
{
for (QString str : QETInformation::elementInfoKeys()) {
ui->m_what_cb->addItem(QETInformation::translatedInfoKey(str), str);
}
}
else if (index == 2) {
for (const auto& str : QETInformation::conductorInfoKeys())
{
for (auto str : QETInformation::conductorInfoKeys()) {
ui->m_what_cb->addItem(QETInformation::translatedInfoKey(str), str);
}
}

View File

@ -48,9 +48,8 @@ ReplaceElementDialog::~ReplaceElementDialog()
void ReplaceElementDialog::setContext(DiagramContext context)
{
m_context = context;
for (ElementInfoPartWidget* eipw : std::as_const(m_eipw_list))
{
for (ElementInfoPartWidget *eipw : m_eipw_list) {
eipw->setText(m_context[eipw->key()].toString());
}
}
@ -74,8 +73,8 @@ void ReplaceElementDialog::buildWidget()
connect(ui->m_button_box, &QDialogButtonBox::clicked, [this](QAbstractButton *button_) {
this->done(ui->m_button_box->buttonRole(button_));
});
for (const QString& str : QETInformation::elementInfoKeys())
for (QString str : QETInformation::elementInfoKeys())
{
ElementInfoPartWidget *eipw = new ElementInfoPartWidget(str, QETInformation::translatedInfoKey(str), this);
eipw->setEraseTextVisible(true);

View File

@ -127,7 +127,7 @@ void SearchAndReplaceWidget::clear()
qDeleteAll(m_conductor_hash.keys());
m_conductor_hash.clear();
for (QTreeWidgetItem* qtwi : std::as_const(m_category_qtwi))
for (QTreeWidgetItem *qtwi : m_category_qtwi)
qtwi->setHidden(false);
ui->m_tree_widget->collapseAll();
@ -284,17 +284,18 @@ void SearchAndReplaceWidget::fillItemsList()
dc += DiagramContent(diagram, false);
}
for (Element* elmt : std::as_const(dc.m_elements)) addElement(elmt);
for (Element *elmt : dc.m_elements)
addElement(elmt);
//Sort child of each "element type" tree item.
//we hide, "element type" tree item, if they do not have children
for (QTreeWidgetItem* qtwi : std::as_const(m_qtwi_elmts))
for(QTreeWidgetItem *qtwi : m_qtwi_elmts)
{
qtwi->sortChildren(0, Qt::AscendingOrder);
qtwi->setHidden(qtwi->childCount() ? false : true);
}
for (IndependentTextItem* iti : std::as_const(dc.m_text_fields))
for (IndependentTextItem *iti : dc.m_text_fields)
{
QTreeWidgetItem *qtwi = new QTreeWidgetItem(m_indi_text_qtwi);
qtwi->setText(0, iti->toPlainText());
@ -305,7 +306,7 @@ void SearchAndReplaceWidget::fillItemsList()
m_indi_text_qtwi->sortChildren(0, Qt::AscendingOrder);
for (Conductor* c : std::as_const(dc.m_potential_conductors))
for (Conductor *c : dc.m_potential_conductors)
{
QTreeWidgetItem *qtwi = new QTreeWidgetItem(m_conductor_qtwi);
qtwi->setText(0, c->properties().text);
@ -378,8 +379,7 @@ void SearchAndReplaceWidget::search()
(*it)->setHidden(false);
}
for (QTreeWidgetItem* item : std::as_const(m_category_qtwi))
{
for (QTreeWidgetItem *item : m_category_qtwi) {
item->setExpanded(false);
}
m_root_qtwi->setExpanded(true);
@ -442,9 +442,9 @@ void SearchAndReplaceWidget::search()
}
QPalette background = ui->m_search_le->palette();
background.setColor(
QPalette::Base,
match ? QColor(0xE0FFF0) : QColor(0xFFE0EF));
background.setColor(QPalette::Base, match
? QColor("#E0FFF0")
: QColor("#FFE0EF"));
ui->m_search_le->setPalette(background);
//Go to the first occurrence
@ -488,8 +488,7 @@ void SearchAndReplaceWidget::setUpConenctions()
connect(m_select_elements, &QAction::triggered, [this]()
{
DiagramContent dc(m_diagram_hash.value(ui->m_tree_widget->currentItem()), false);
for (auto elmt : std::as_const(dc.m_elements))
{
for (auto elmt : dc.m_elements) {
if (auto item = m_element_hash.key(elmt)) {
item->setCheckState(0, Qt::Checked);
}
@ -509,8 +508,7 @@ void SearchAndReplaceWidget::setUpConenctions()
connect(m_select_texts, &QAction::triggered, [this]()
{
DiagramContent dc(m_diagram_hash.value(ui->m_tree_widget->currentItem()), false);
for (auto text : std::as_const(dc.m_text_fields))
{
for (auto text : dc.m_text_fields) {
if (auto item = m_text_hash.key(text)) {
item->setCheckState(0, Qt::Checked);
}
@ -860,8 +858,7 @@ QStringList SearchAndReplaceWidget::searchTerms(Diagram *diagram)
list.append(prop.indexrev);
list.append(prop.folio);
list.append(prop.date.toString());
for (const QString& key : prop.context.keys())
{
for (QString key : prop.context.keys()) {
list.append(prop.context.value(key).toString());
}
@ -877,7 +874,7 @@ QStringList SearchAndReplaceWidget::searchTerms(Element *element)
{
QStringList list;
DiagramContext context = element->elementInformations();
for (const QString& key : QETInformation::elementInfoKeys())
for (QString key : QETInformation::elementInfoKeys())
{
QString str = context.value(key).toString();
if (!str.isEmpty()) {

View File

@ -241,8 +241,7 @@ int TerminalStripDrawer::height() const
height_ = std::max(height_, m_pattern->m_spacer_rect.y() + m_pattern->m_spacer_rect.height());
for (const auto& rect : std::as_const(m_pattern->m_terminal_rect))
{
for (const auto &rect : m_pattern->m_terminal_rect) {
height_ = std::max(height_, rect.y() + rect.height());
}

View File

@ -74,8 +74,7 @@ RemoveTerminalStripCommand::~RemoveTerminalStripCommand()
void RemoveTerminalStripCommand::undo()
{
if (m_project && m_strip) {
for (const auto& elmt : std::as_const(m_elements))
{
for (auto elmt : m_elements) {
m_strip->addTerminal(elmt);
}
m_project->addTerminalStrip(m_strip);
@ -85,8 +84,7 @@ void RemoveTerminalStripCommand::undo()
void RemoveTerminalStripCommand::redo()
{
if (m_project && m_strip) {
for (const auto& elmt : std::as_const(m_elements))
{
for (auto elmt : m_elements) {
m_strip->removeTerminal(elmt);
}
m_project->removeTerminalStrip(m_strip);

View File

@ -161,8 +161,7 @@ MoveTerminalCommand::MoveTerminalCommand(QSharedPointer<PhysicalTerminal> termin
m_new_strip {new_strip}
{
QString t_label;
for (const auto& real_t : terminal->realTerminals())
{
for (auto real_t : terminal->realTerminals()) {
if (!t_label.isEmpty())
t_label.append(", ");
t_label.append(real_t->label());

View File

@ -31,8 +31,7 @@ PhysicalTerminal::PhysicalTerminal(TerminalStrip *parent_strip,
m_parent_terminal_strip(parent_strip),
m_real_terminal(terminals)
{
for (const auto& real_t : std::as_const(m_real_terminal))
{
for (const auto &real_t : m_real_terminal) {
if (real_t) {
real_t->setPhysicalTerminal(sharedRef());
}
@ -87,8 +86,7 @@ QDomElement PhysicalTerminal::toXml(QDomDocument &parent_document) const
*/
void PhysicalTerminal::setTerminals(const QVector<QSharedPointer<RealTerminal>> &terminals) {
m_real_terminal = terminals;
for (const auto& real_t : std::as_const(m_real_terminal))
{
for (const auto &real_t : m_real_terminal) {
if (real_t) {
real_t->setPhysicalTerminal(sharedRef());
}
@ -150,8 +148,7 @@ void PhysicalTerminal::setParentStrip(TerminalStrip *strip)
PhysicalTerminal::~PhysicalTerminal()
{
for (const auto& real_t : std::as_const(m_real_terminal))
{
for (const auto &real_t : m_real_terminal) {
if (real_t) {
real_t->setPhysicalTerminal(QSharedPointer<PhysicalTerminal>());
}

View File

@ -315,8 +315,7 @@ void FreeTerminalModel::fillTerminalVector()
b->elementData().m_informations.value(QETInformation::ELMT_LABEL).toString());
});
for (const auto& terminal_ : std::as_const(free_terminal_vector))
{
for (const auto &terminal_ : free_terminal_vector) {
m_terminal_vector.append(terminal_->realTerminal());
m_real_t_data.append(modelRealTerminalData::data(terminal_->realTerminal()));
}

View File

@ -456,7 +456,7 @@ void TerminalStripEditor::on_m_group_terminals_pb_clicked()
QVector<QSharedPointer<RealTerminal>> vector_;
int count_ = 0;
for (const auto& mrtd : std::as_const(mrtd_vector))
for (const auto & mrtd : mrtd_vector)
{
const auto real_t = mrtd.real_terminal.toStrongRef();
vector_.append(real_t);

View File

@ -428,7 +428,7 @@ modelRealTerminalData TerminalStripModel::modelRealTerminalDataForIndex(const QM
void TerminalStripModel::buildBridgePixmap(const QSize &pixmap_size)
{
m_bridges_pixmaps.clear();
for (const auto& color_ : TerminalStripBridge::bridgeColor())
for (auto color_ : TerminalStripBridge::bridgeColor())
{
QPen pen;
pen.setColor(color_);

View File

@ -102,7 +102,7 @@ QString ConductorNumExport::wiresNum() const
QStringList list = m_hash.keys();
list.sort();
for (const QString& key : list)
for (QString key : list)
{
for (int i=0; i<m_hash.value(key) ; ++i) {
csv.append(key + "\n");

View File

@ -513,7 +513,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
//Color
c_value = clist.first().color;
for (const ConductorProperties& cp : clist)
for(ConductorProperties cp : clist)
{
if (cp.color != c_value)
equal = false;
@ -524,7 +524,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
//bicolor
b_value = clist.first().m_bicolor;
for (const ConductorProperties& cp : clist)
for(ConductorProperties cp : clist)
{
if (cp.m_bicolor != b_value)
equal = false;
@ -535,7 +535,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
//second color
c_value = clist.first().m_color_2;
for (const ConductorProperties& cp : clist)
for(ConductorProperties cp : clist)
{
if (cp.m_color_2 != c_value)
equal = false;
@ -546,7 +546,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
//Dash size
i_value = clist.first().m_dash_size;
for (const ConductorProperties& cp : clist)
for(ConductorProperties cp : clist)
{
if (cp.m_dash_size != i_value)
equal = false;
@ -557,7 +557,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
//text
s_value = clist.first().text;
for (const ConductorProperties& cp : clist)
for(ConductorProperties cp : clist)
{
if (cp.text != s_value)
equal = false;
@ -568,7 +568,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
//text color
c_value = clist.first().text_color;
for (const ConductorProperties& cp : clist)
for(ConductorProperties cp : clist)
{
if (cp.text_color != c_value)
equal = false;
@ -579,7 +579,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
//formula
s_value = clist.first().m_formula;
for (const ConductorProperties& cp : clist)
for(ConductorProperties cp : clist)
{
if (cp.m_formula != s_value)
equal = false;
@ -590,7 +590,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
//cable
s_value = clist.first().m_cable;
for (const ConductorProperties& cp : clist)
for(ConductorProperties cp : clist)
{
if (cp.m_cable != s_value)
equal = false;
@ -601,7 +601,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
//bus
s_value = clist.first().m_bus;
for (const ConductorProperties& cp : clist)
for(ConductorProperties cp : clist)
{
if (cp.m_bus != s_value)
equal = false;
@ -612,7 +612,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
//function
s_value = clist.first().m_function;
for (const ConductorProperties& cp : clist)
for(ConductorProperties cp : clist)
{
if (cp.m_function != s_value)
equal = false;
@ -623,7 +623,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
//Tension protocol
s_value = clist.first().m_tension_protocol;
for (const ConductorProperties& cp : clist)
for(ConductorProperties cp : clist)
{
if (cp.m_tension_protocol != s_value)
equal = false;
@ -634,7 +634,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
//conductor_color
s_value = clist.first().m_wire_color;
for (const ConductorProperties& cp : clist)
for(ConductorProperties cp : clist)
{
if (cp.m_wire_color != s_value)
equal = false;
@ -645,7 +645,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
//conductor_section
s_value = clist.first().m_wire_section;
for (const ConductorProperties& cp : clist)
for(ConductorProperties cp : clist)
{
if (cp.m_wire_section != s_value)
equal = false;
@ -657,7 +657,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
//text size
i_value = clist.first().text_size;
for (const ConductorProperties& cp : clist)
for(ConductorProperties cp : clist)
{
if (cp.text_size != i_value)
equal = false;
@ -668,7 +668,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
//conductor size
d_value = clist.first().cond_size;
for (const ConductorProperties& cp : clist)
for(ConductorProperties cp : clist)
{
if (cp.cond_size != d_value)
equal = false;
@ -679,7 +679,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
//show text
b_value = clist.first().m_show_text;
for (const ConductorProperties& cp : clist)
for(ConductorProperties cp : clist)
{
if (cp.m_show_text != b_value)
equal = false;
@ -690,7 +690,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
//One text per folio
b_value = clist.first().m_one_text_per_folio;
for (const ConductorProperties& cp : clist)
for(ConductorProperties cp : clist)
{
if (cp.m_one_text_per_folio != b_value)
equal = false;
@ -701,7 +701,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
//Text rotation for vertical conducor
d_value = clist.first().verti_rotate_text;
for (const ConductorProperties& cp : clist)
for(ConductorProperties cp : clist)
{
if (cp.verti_rotate_text != d_value)
equal = false;
@ -712,7 +712,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
//Text rotation for horizontal conducor
d_value = clist.first().horiz_rotate_text;
for (const ConductorProperties& cp : clist)
for(ConductorProperties cp : clist)
{
if (cp.horiz_rotate_text != d_value)
equal = false;
@ -723,7 +723,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
//Text alignment for horizontal conducor
align_value = clist.first().m_horizontal_alignment;
for (const ConductorProperties& cp : clist)
for(ConductorProperties cp : clist)
{
if (cp.m_horizontal_alignment != align_value)
equal = false;
@ -734,7 +734,7 @@ void ConductorProperties::applyForEqualAttributes(QList<ConductorProperties> lis
//Text alignment for vertical conducor
align_value = clist.first().m_vertical_alignment;
for (const ConductorProperties& cp : clist)
for(ConductorProperties cp : clist)
{
if (cp.m_vertical_alignment != align_value)
equal = false;

View File

@ -160,8 +160,7 @@ void projectDataBase::removeElement(Element *element)
void projectDataBase::elementInfoChanged(Element *element)
{
auto hash = elementInfoToString(element);
for (const auto& str : QETInformation::elementInfoKeys())
{
for (auto str : QETInformation::elementInfoKeys()) {
m_update_element_query.bindValue(":" + str, hash.value(str));
}
m_update_element_query.bindValue(":uuid", element->uuid().toString());
@ -541,8 +540,7 @@ void projectDataBase::prepareQuery()
//UPDATE DIAGRAM INFO
QString update_diagram_str("UPDATE diagram_info SET ");
for (const auto& str : QETInformation::diagramInfoKeys())
{
for (auto str : QETInformation::diagramInfoKeys()) {
update_diagram_str.append(str + " = :" + str + ", ");
}
update_diagram_str.remove(update_diagram_str.length()-2, 2); //Remove the last ", "
@ -582,8 +580,7 @@ void projectDataBase::prepareQuery()
//UPDATE ELEMENT INFO
QString update_str("UPDATE element_info SET ");
for (const auto& string : QETInformation::elementInfoKeys())
{
for (auto string : QETInformation::elementInfoKeys()) {
update_str.append(string + " = :" + string + ", ");
}
update_str.remove(update_str.length()-2, 2); //Remove the last ", "
@ -600,7 +597,7 @@ void projectDataBase::prepareQuery()
QHash<QString, QString> projectDataBase::elementInfoToString(Element *elmt)
{
QHash<QString, QString> hash; //Store the value for each columns
for (const auto& key : QETInformation::elementInfoKeys())
for (auto key : QETInformation::elementInfoKeys())
{
if (key == "label") {
hash.insert(key, elmt->actualLabel());

View File

@ -130,9 +130,9 @@ void ElementQueryWidget::setQuery(const QString &query)
//Get the select -> the item in the right list
QStringList split = select.split(",");
for (const auto& str : std::as_const(split))
for (auto str : split)
{
for (auto item : std::as_const(m_items_list))
for (auto item : m_items_list)
{
if (item->data(Qt::UserRole).toString() == str) {
ui->m_var_list->takeItem(ui->m_var_list->row(item));
@ -209,8 +209,7 @@ void ElementQueryWidget::setQuery(const QString &query)
//Filter for selected data
QStringList strl;
for (auto item : std::as_const(m_items_list))
{
for (auto item : m_items_list) {
strl.append(item->data(Qt::UserRole).toString());
}
@ -237,7 +236,7 @@ void ElementQueryWidget::setQuery(const QString &query)
QRegularExpressionMatch rxm;
for (const auto& str : split_where)
for (auto str : split_where)
{
rxm = rx_is_not_null.match(str);
if (rxm.hasMatch()) {
@ -298,8 +297,7 @@ QString ElementQueryWidget::queryStr() const
QString column;
bool first = true;
for (auto key : std::as_const(keys))
{
for (auto key: keys) {
if (first) {
first = false;
} else {
@ -456,7 +454,7 @@ QStringList ElementQueryWidget::selectedKeys() const
*/
void ElementQueryWidget::setUpItems()
{
for (const QString& key : QETInformation::elementInfoKeys())
for(QString key : QETInformation::elementInfoKeys())
{
if (key == "formula")
continue;
@ -466,7 +464,8 @@ void ElementQueryWidget::setUpItems()
m_items_list << item;
}
for (const auto& key : m_export_info.keys())
for (auto key : m_export_info.keys())
{
auto item = new QListWidgetItem(m_export_info.value(key), ui->m_var_list);
item->setData(Qt::UserRole, key);

View File

@ -67,8 +67,7 @@ QString SummaryQueryWidget::queryStr() const
QString column;
bool first = true;
for (const auto& key : std::as_const(keys))
{
for (auto key: keys) {
if (first) {
first = false;
} else {
@ -105,9 +104,9 @@ void SummaryQueryWidget::setQuery(const QString &query)
//Get the select -> the item in the right list
QStringList split = select.split(",");
for (const auto& str : std::as_const(split))
for (auto str : split)
{
for (auto item : std::as_const(m_items_list))
for (auto item : m_items_list)
{
if (item->data(Qt::UserRole).toString() == str) {
ui->m_available_list->takeItem(ui->m_available_list->row(item));
@ -124,7 +123,7 @@ void SummaryQueryWidget::setQuery(const QString &query)
*/
void SummaryQueryWidget::setUpItems()
{
for (const auto& key : QETInformation::diagramInfoKeys())
for (auto key : QETInformation::diagramInfoKeys())
{
if (key == "filename" || key == "display_folio") {
continue;

View File

@ -377,7 +377,7 @@ void Diagram::keyPressEvent(QKeyEvent *event)
switch(event->key())
{
case Qt::Key_Left:
for (Element* item : std::as_const(dc.m_elements))
for (Element *item : dc.m_elements)
{
left_position = item->sceneBoundingRect().x();
if(left_position <= 5)
@ -389,7 +389,7 @@ void Diagram::keyPressEvent(QKeyEvent *event)
movement = QPointF(+xKeyGrid, 0.0);
break;
case Qt::Key_Up:
for (Element* item : std::as_const(dc.m_elements))
for(Element *item : dc.m_elements)
{
top_position = item->sceneBoundingRect().y();
if(top_position <= 5)
@ -420,7 +420,7 @@ void Diagram::keyPressEvent(QKeyEvent *event)
switch(event->key())
{
case Qt::Key_Left:
for (Element* item : std::as_const(dc.m_elements))
for (Element *item : dc.m_elements)
{
left_position = item->sceneBoundingRect().x();
if(left_position <= 5)
@ -432,7 +432,7 @@ void Diagram::keyPressEvent(QKeyEvent *event)
movement = QPointF(+xKeyGridFine, 0.0);
break;
case Qt::Key_Up:
for (Element* item : std::as_const(dc.m_elements))
for(Element *item : dc.m_elements)
{
top_position = item->sceneBoundingRect().y();
if(top_position <= 5)
@ -949,8 +949,7 @@ QDomDocument Diagram::toXml(bool whole_content) {
if (!list_elements.isEmpty()) {
auto dom_elements = document.createElement(QStringLiteral("elements"));
for (auto elmt : std::as_const(list_elements))
{
for (auto elmt : list_elements) {
dom_elements.appendChild(elmt->toXml(document,
table_adr_id));
}
@ -959,8 +958,7 @@ QDomDocument Diagram::toXml(bool whole_content) {
if (!list_conductors.isEmpty()) {
auto dom_conductors = document.createElement(QStringLiteral("conductors"));
for (auto cond : std::as_const(list_conductors))
{
for (auto cond : list_conductors) {
dom_conductors.appendChild(cond->toXml(document,
table_adr_id));
}
@ -969,8 +967,7 @@ QDomDocument Diagram::toXml(bool whole_content) {
if (!list_texts.isEmpty()) {
auto dom_texts = document.createElement(QStringLiteral("inputs"));
for (auto dti : std::as_const(list_texts))
{
for (auto dti : list_texts) {
dom_texts.appendChild(dti->toXml(document));
}
dom_root.appendChild(dom_texts);
@ -978,8 +975,7 @@ QDomDocument Diagram::toXml(bool whole_content) {
if (!list_images.isEmpty()) {
auto dom_images = document.createElement(QStringLiteral("images"));
for (auto dii : std::as_const(list_images))
{
for (auto dii : list_images) {
dom_images.appendChild(dii->toXml(document));
}
dom_root.appendChild(dom_images);
@ -987,8 +983,7 @@ QDomDocument Diagram::toXml(bool whole_content) {
if (!list_shapes.isEmpty()) {
auto dom_shapes = document.createElement(QStringLiteral("shapes"));
for (auto dii : std::as_const(list_shapes))
{
for (auto dii : list_shapes) {
dom_shapes.appendChild(dii -> toXml(document));
}
dom_root.appendChild(dom_shapes);
@ -996,8 +991,7 @@ QDomDocument Diagram::toXml(bool whole_content) {
if (table_vector.size()) {
auto tables = document.createElement(QStringLiteral("tables"));
for (auto table : std::as_const(table_vector))
{
for (auto table : table_vector) {
tables.appendChild(table->toXml(document));
}
dom_root.appendChild(tables);
@ -1382,11 +1376,9 @@ bool Diagram::fromXml(QDomElement &document,
// Load text
QList<IndependentTextItem *> added_texts;
for (const auto& text_xml : QET::findInDomElement(
root,
QStringLiteral("inputs"),
QStringLiteral("input")))
{
for (auto text_xml : QET::findInDomElement(root,
QStringLiteral("inputs"),
QStringLiteral("input"))) {
IndependentTextItem *iti = new IndependentTextItem();
iti -> fromXml(text_xml);
addItem(iti);
@ -1395,11 +1387,9 @@ bool Diagram::fromXml(QDomElement &document,
// Load image
QList<DiagramImageItem *> added_images;
for (const auto& image_xml : QET::findInDomElement(
root,
QStringLiteral("images"),
QStringLiteral("image")))
{
for (auto image_xml : QET::findInDomElement(root,
QStringLiteral("images"),
QStringLiteral("image"))) {
DiagramImageItem *dii = new DiagramImageItem ();
dii -> fromXml(image_xml);
addItem(dii);
@ -1408,11 +1398,9 @@ bool Diagram::fromXml(QDomElement &document,
// Load shape
QList<QetShapeItem *> added_shapes;
for (const auto& shape_xml : QET::findInDomElement(
root,
QStringLiteral("shapes"),
QStringLiteral("shape")))
{
for (auto shape_xml : QET::findInDomElement(root,
QStringLiteral("shapes"),
QStringLiteral("shape"))) {
QetShapeItem *dii = new QetShapeItem (QPointF(0,0));
dii -> fromXml(shape_xml);
addItem(dii);
@ -1475,8 +1463,7 @@ bool Diagram::fromXml(QDomElement &document,
//Get the top left corner of the rectangle that contain all added items
QRectF items_rect;
for (auto item : std::as_const(added_items))
{
for (auto item : added_items) {
items_rect = items_rect.united(
item->mapToScene(
item->boundingRect()
@ -1488,7 +1475,7 @@ bool Diagram::fromXml(QDomElement &document,
position.y() - point_.y()));
//Translate all added items
for (auto qgi : std::as_const(added_items))
for (auto qgi : added_items)
qgi->setPos(qgi->pos() += pos_);
}
@ -1847,7 +1834,7 @@ void Diagram::changeZValue(QET::DepthOption option)
DiagramContent::Shapes | \
DiagramContent::Images);
QList<QGraphicsObject *> list;
for (QGraphicsItem* item : std::as_const(l))
for(QGraphicsItem *item : l)
list << item->toGraphicsObject();
qreal maxz=0,
@ -1863,7 +1850,7 @@ void Diagram::changeZValue(QET::DepthOption option)
if(option == QET::Raise)
{
for (QGraphicsObject* qgo : std::as_const(list))
for(QGraphicsObject *qgo : list)
if(qgo->zValue() < (Terminal::Z-2)) //Ensure item is always below terminal
new QPropertyUndoCommand(qgo,
"z",
@ -1873,7 +1860,7 @@ void Diagram::changeZValue(QET::DepthOption option)
}
else if(option == QET::Lower)
{
for (QGraphicsObject* qgo : std::as_const(list))
for(QGraphicsObject *qgo : list)
if(qgo->zValue() < (Terminal::Z-2)) //Ensure item is always below terminal
new QPropertyUndoCommand(qgo,
"z",
@ -1883,13 +1870,21 @@ void Diagram::changeZValue(QET::DepthOption option)
}
else if (option == QET::BringForward)
{
for (QGraphicsObject* qgo : std::as_const(list))
new QPropertyUndoCommand(qgo, "z", qgo->zValue(), maxz + 1, undo);
for(QGraphicsObject *qgo : list)
new QPropertyUndoCommand(qgo,
"z",
qgo->zValue(),
maxz+1,
undo);
}
else if(option == QET::SendBackward)
{
for (QGraphicsObject* qgo : std::as_const(list))
new QPropertyUndoCommand(qgo, "z", qgo->zValue(), minz - 1, undo);
for(QGraphicsObject *qgo : list)
new QPropertyUndoCommand(qgo,
"z",
qgo->zValue(),
minz-1,
undo);
}
if(undo->childCount())

View File

@ -95,7 +95,7 @@ DiagramContent::DiagramContent(Diagram *diagram, bool selected) :
//For each selected element, we determine if conductors must be moved or updated.
for (Element* elmt : std::as_const(m_elements))
for(Element *elmt : m_elements)
{
if (elmt->isSelected())
{
@ -176,7 +176,7 @@ QList<Conductor *> DiagramContent::conductors(int filter) const
if (filter & ConductorsToUpdate) result += m_conductors_to_update;
if (filter & OtherConductors) result += m_other_conductors;
if (filter & SelectedOnly) {
for (Conductor* conductor : std::as_const(result))
for(Conductor *conductor : result)
{
if (!conductor->isSelected())
result.removeAll(conductor);

View File

@ -31,7 +31,9 @@
*/
void DiagramContext::add(DiagramContext other)
{
for (const QString& key : other.keys()) { addValue(key, other.value(key)); }
for (QString key : other.keys()) {
addValue(key, other.value(key));
}
}
/**
@ -256,8 +258,7 @@ bool DiagramContext::isKeyAcceptable(const QString &key)
QDebug operator <<(QDebug debug, const DiagramContext &context)
{
debug << "DiagramContext";
for (const auto& key : context.keys())
{
for (auto key : context.keys()) {
debug.nospace() << key << " : " << context.value(key) << "\n";
}
debug << " end DiagramContext";

View File

@ -61,8 +61,7 @@ PastePartsCommand::~PastePartsCommand()
void PastePartsCommand::undo()
{
m_scene->blockSignals(true);
for (auto qgi : std::as_const(m_pasted_content))
{
for (auto qgi : m_pasted_content) {
m_scene->removeItem(qgi);
}
m_scene->blockSignals(false);
@ -85,8 +84,7 @@ void PastePartsCommand::redo()
m_first_redo = false;
} else {
m_scene->blockSignals(true);
for (auto qgi : std::as_const(m_pasted_content))
{
for (auto qgi : m_pasted_content) {
m_scene->addItem(qgi);
}
m_scene->blockSignals(false);

View File

@ -93,9 +93,8 @@ void ArcEditor::setUpChangeConnections()
void ArcEditor::disconnectChangeConnections()
{
for (const QMetaObject::Connection& c : std::as_const(m_change_connections))
{
disconnect(c);
for (QMetaObject::Connection c : m_change_connections) {
disconnect(c);
}
m_change_connections.clear();
}

View File

@ -521,7 +521,7 @@ ElementEditionCommand(QObject::tr("Pivoter la selection", "undo caption"), scene
*/
void RotateElementsCommand::undo()
{
for (QGraphicsItem* item : std::as_const(m_items))
for (QGraphicsItem *item : m_items)
{
if (item->type() == PartTerminal::Type) {
PartTerminal* term = qgraphicsitem_cast<PartTerminal*>(item);
@ -549,7 +549,7 @@ void RotateElementsCommand::undo()
*/
void RotateElementsCommand::redo()
{
for (QGraphicsItem* item : std::as_const(m_items))
for (QGraphicsItem *item : m_items)
{
if (item->type() == PartTerminal::Type) {
PartTerminal* term = qgraphicsitem_cast<PartTerminal*>(item);

View File

@ -613,13 +613,13 @@ void ElementPrimitiveDecorator::addHandler()
if (m_handler_vector.isEmpty() && scene())
{
m_handler_vector = QetGraphicsHandlerItem::handlerForPoint(mapFromScene(getResizingsPoints()));
for (QetGraphicsHandlerItem* handler : std::as_const(m_handler_vector))
{
scene()->addItem(handler);
handler->setColor(Qt::darkGreen);
handler->installSceneEventFilter(this);
handler->setZValue(this->zValue() + 1);
for(QetGraphicsHandlerItem *handler : m_handler_vector)
{
scene()->addItem(handler);
handler->setColor(Qt::darkGreen);
handler->installSceneEventFilter(this);
handler->setZValue(this->zValue()+1);
}
}
}
@ -727,12 +727,12 @@ QVariant ElementPrimitiveDecorator::itemChange(QGraphicsItem::GraphicsItemChange
else if (change == ItemVisibleHasChanged)
{
bool visible = value.toBool();
for (QetGraphicsHandlerItem* qghi : std::as_const(m_handler_vector))
for(QetGraphicsHandlerItem *qghi : m_handler_vector)
qghi->setVisible(visible);
}
else if (change == ItemZValueHasChanged && !m_handler_vector.isEmpty())
{
for (QetGraphicsHandlerItem* qghi : std::as_const(m_handler_vector))
for (QetGraphicsHandlerItem *qghi : m_handler_vector)
qghi->setZValue(this->zValue()+1);
}

View File

@ -1099,7 +1099,7 @@ void ElementScene::reset()
items_list << qgi;
}
for (QGraphicsItem* qgi : std::as_const(items_list))
for (QGraphicsItem *qgi : items_list)
{
removeItem(qgi);
qgiManager().release(qgi);

View File

@ -530,7 +530,7 @@ void CustomElementGraphicPart::stylesFromXml(const QDomElement &qde)
//Check each pair of style
QRegularExpression rx("^\\s*([a-z-]+)\\s*:\\s*([a-zA-Z-]+)\\s*$");
for (const auto& style : std::as_const(styles))
for (auto style : styles)
{
auto rx_match = rx.match(style);
if (!rx_match.hasMatch()) {

View File

@ -265,7 +265,7 @@ void PartArc::switchResizeMode()
if (m_resize_mode == 1)
{
m_resize_mode = 2;
for (QetGraphicsHandlerItem* qghi : std::as_const(m_handler_vector))
for (QetGraphicsHandlerItem *qghi : m_handler_vector)
qghi->setColor(Qt::darkGreen);
}
else if (m_resize_mode == 2)
@ -276,7 +276,7 @@ void PartArc::switchResizeMode()
removeHandler();
addHandler();
for (QetGraphicsHandlerItem* qghi : std::as_const(m_handler_vector))
for (QetGraphicsHandlerItem *qghi : m_handler_vector)
qghi->setColor(Qt::magenta);
}
else
@ -287,7 +287,7 @@ void PartArc::switchResizeMode()
removeHandler();
addHandler();
for (QetGraphicsHandlerItem* qghi : std::as_const(m_handler_vector))
for (QetGraphicsHandlerItem *qghi : m_handler_vector)
qghi->setColor(Qt::blue);
}
}
@ -445,7 +445,7 @@ void PartArc::addHandler()
else
m_handler_vector = QetGraphicsHandlerItem::handlerForPoint(mapToScene(QetGraphicsHandlerUtility::pointsForRect(m_rect)));
for (QetGraphicsHandlerItem* handler : std::as_const(m_handler_vector))
for(QetGraphicsHandlerItem *handler : m_handler_vector)
{
QColor color = Qt::blue;
if (m_resize_mode == 2)

View File

@ -241,13 +241,13 @@ void PartEllipse::switchResizeMode()
if (m_resize_mode == 1)
{
m_resize_mode = 2;
for (QetGraphicsHandlerItem* qghi : std::as_const(m_handler_vector))
for (QetGraphicsHandlerItem *qghi : m_handler_vector)
qghi->setColor(Qt::darkGreen);
}
else
{
m_resize_mode = 1;
for (QetGraphicsHandlerItem* qghi : std::as_const(m_handler_vector))
for (QetGraphicsHandlerItem *qghi : m_handler_vector)
qghi->setColor(Qt::blue);
}
}
@ -334,7 +334,7 @@ void PartEllipse::addHandler()
{
m_handler_vector = QetGraphicsHandlerItem::handlerForPoint(mapToScene(QetGraphicsHandlerUtility::pointsForRect(m_rect)));
for (QetGraphicsHandlerItem* handler : std::as_const(m_handler_vector))
for(QetGraphicsHandlerItem *handler : m_handler_vector)
{
QColor color = Qt::blue;
if (m_resize_mode == 2)

View File

@ -304,7 +304,7 @@ void PartLine::addHandler()
m_handler_vector = QetGraphicsHandlerItem::handlerForPoint(mapToScene(points_vector));
for (QetGraphicsHandlerItem* handler : std::as_const(m_handler_vector))
for(QetGraphicsHandlerItem *handler : m_handler_vector)
{
handler->setColor(Qt::blue);
scene()->addItem(handler);

View File

@ -277,8 +277,7 @@ void PartPolygon::setClosed(bool close)
*/
void PartPolygon::setHandlerColor(QPointF pos, const QColor &color)
{
for (QetGraphicsHandlerItem* qghi : std::as_const(m_handler_vector))
{
for (QetGraphicsHandlerItem *qghi : m_handler_vector) {
if (qghi->pos() == mapToScene(pos)) {
qghi->setColor(color);
}
@ -291,8 +290,7 @@ void PartPolygon::setHandlerColor(QPointF pos, const QColor &color)
*/
void PartPolygon::resetAllHandlerColor()
{
for (QetGraphicsHandlerItem* qghi : std::as_const(m_handler_vector))
{
for (QetGraphicsHandlerItem *qghi : m_handler_vector) {
qghi->setColor(Qt::blue);
}
}
@ -382,7 +380,7 @@ void PartPolygon::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
list << m_insert_point;
if (m_handler_vector.count() > 2)
{
for (QetGraphicsHandlerItem* qghi : std::as_const(m_handler_vector))
for (QetGraphicsHandlerItem *qghi : m_handler_vector)
{
if (qghi->contains(qghi->mapFromScene(event->scenePos())))
{
@ -478,7 +476,7 @@ void PartPolygon::addHandler()
{
m_handler_vector = QetGraphicsHandlerItem::handlerForPoint(mapToScene(m_polygon));
for (QetGraphicsHandlerItem* handler : std::as_const(m_handler_vector))
for(QetGraphicsHandlerItem *handler : m_handler_vector)
{
handler->setColor(Qt::blue);
scene()->addItem(handler);

View File

@ -361,7 +361,7 @@ void PartRectangle::switchResizeMode()
if (m_resize_mode == 1)
{
m_resize_mode = 2;
for (QetGraphicsHandlerItem* qghi : std::as_const(m_handler_vector))
for (QetGraphicsHandlerItem *qghi : m_handler_vector)
qghi->setColor(Qt::darkGreen);
}
else if (m_resize_mode == 2)
@ -370,8 +370,7 @@ void PartRectangle::switchResizeMode()
qDeleteAll(m_handler_vector);
m_handler_vector.clear();
addHandler();
for (QetGraphicsHandlerItem* qghi : std::as_const(m_handler_vector))
{
for (QetGraphicsHandlerItem *qghi : m_handler_vector) {
qghi->setColor(Qt::magenta);
}
}
@ -381,8 +380,7 @@ void PartRectangle::switchResizeMode()
qDeleteAll(m_handler_vector);
m_handler_vector.clear();
addHandler();
for (QetGraphicsHandlerItem* qghi : std::as_const(m_handler_vector))
{
for (QetGraphicsHandlerItem *qghi : m_handler_vector) {
qghi->setColor(Qt::blue);
}
}
@ -514,7 +512,7 @@ void PartRectangle::addHandler()
m_handler_vector = QetGraphicsHandlerItem::handlerForPoint(mapToScene(QetGraphicsHandlerUtility::pointForRadiusRect(m_rect, m_xRadius, m_yRadius)));
}
for (QetGraphicsHandlerItem* handler : std::as_const(m_handler_vector))
for (QetGraphicsHandlerItem *handler : m_handler_vector)
{
QColor color;
if(m_resize_mode == 1) {color = Qt::blue;}

View File

@ -469,7 +469,7 @@ void StyleEditor::updateForm()
size_weight -> setCurrentIndex(first_part -> lineWeight());
filling_color -> setCurrentIndex(first_part -> filling());
for (auto cegp : std::as_const(m_part_list))
for (auto cegp : m_part_list)
{
if (first_part -> antialiased() != cegp -> antialiased()) antialiasing -> setChecked(false);
if (first_part -> color() != cegp -> color()) outline_color -> setCurrentIndex(-1);

View File

@ -51,9 +51,7 @@ DynamicTextFieldEditor::~DynamicTextFieldEditor()
{
delete ui;
if(!m_connection_list.isEmpty()) {
for (const QMetaObject::Connection& con :
std::as_const(m_connection_list))
{
for(const QMetaObject::Connection& con : m_connection_list) {
disconnect(con);
}
}
@ -205,8 +203,7 @@ void DynamicTextFieldEditor::disconnectConnections()
{
//Remove previous connection
if(!m_connection_list.isEmpty())
for (const auto& connection : std::as_const(m_connection_list))
{
for(const auto &connection : m_connection_list) {
disconnect(connection);
}
m_connection_list.clear();

View File

@ -171,8 +171,7 @@ void EllipseEditor::setUpChangeConnections()
*/
void EllipseEditor::disconnectChangeConnections()
{
for (const QMetaObject::Connection& c : std::as_const(m_change_connections))
{
for (QMetaObject::Connection c : m_change_connections) {
disconnect(c);
}
m_change_connections.clear();

View File

@ -223,8 +223,7 @@ void LineEditor::setUpChangeConnections()
*/
void LineEditor::disconnectChangeConnections()
{
for (const auto& connection : std::as_const(m_change_connections))
{
for (auto connection : m_change_connections) {
disconnect(connection);
}

View File

@ -76,8 +76,7 @@ void PolygonEditor::setUpChangeConnections()
void PolygonEditor::disconnectChangeConnections()
{
for (const QMetaObject::Connection& c : std::as_const(m_change_connections))
{
for (QMetaObject::Connection c : m_change_connections) {
disconnect(c);
}
m_change_connections.clear();

View File

@ -545,7 +545,7 @@ void QETElementEditor::updateInformations()
QString selection_xml_name = part -> xmlName();
bool same_xml_name = true;
bool style_editable = true;
for (QGraphicsItem* qgi : std::as_const(selected_qgis))
for (QGraphicsItem *qgi: selected_qgis)
{
if (CustomElementPart *cep = dynamic_cast<CustomElementPart *>(qgi)) {
cep_list << cep;
@ -582,11 +582,9 @@ void QETElementEditor::updateInformations()
bool equal = true;
QList<CustomElementPart*> parts = editor -> currentParts();
if (parts.length() == cep_list.length()) {
for (auto cep : std::as_const(cep_list))
{
for (auto cep: cep_list) {
bool part_found = false;
for (auto part : std::as_const(parts))
{
for (auto part: parts) {
if (part == cep) {
part_found = true;
break;
@ -791,12 +789,12 @@ bool QETElementEditor::checkElement()
dialog_message += "<ol>";
QList<QETWarning> total = warnings << errors;
for (const QETWarning& warning : total)
for(QETWarning warning : total)
{
dialog_message += "<li>";
dialog_message +=
QString(tr("<b>%1</b> : %2", "warning title: warning description"))
.arg(warning.first, warning.second);
dialog_message += QString(
tr("<b>%1</b> : %2", "warning title: warning description")
).arg(warning.first).arg(warning.second);
dialog_message += "</li>";
}
dialog_message += "</ol>";

View File

@ -59,8 +59,7 @@ void RectangleEditor::setUpChangeConnections()
void RectangleEditor::disconnectChangeConnections()
{
for (const QMetaObject::Connection& c : std::as_const(m_change_connections))
{
for (QMetaObject::Connection c : m_change_connections) {
disconnect(c);
}
m_change_connections.clear();

View File

@ -92,9 +92,8 @@ void TextEditor::disconnectChangeConnection()
void TextEditor::disconnectEditConnection()
{
for (const QMetaObject::Connection& c : std::as_const(m_edit_connection))
{
disconnect(c);
for (QMetaObject::Connection c : m_edit_connection) {
disconnect(c);
}
m_edit_connection.clear();
}

View File

@ -153,8 +153,7 @@ QVector<QetGraphicsTableItem *> ElementProvider::table(
}
}
for (auto d : std::as_const(m_diagram_list))
{
for (auto d : m_diagram_list) {
for (auto item_ : d->items())
{
if(item_->type() == QetGraphicsTableItem::Type)

View File

@ -58,8 +58,8 @@ ElementsPanel::ElementsPanel(QWidget *parent) :
QPalette qp = palette();
qp.setColor(QPalette::Text, Qt::black);
qp.setColor(QPalette::Base, Qt::white);
qp.setColor(QPalette::AlternateBase, QColor(0xe8e8e8));
qp.setColor(QPalette::Highlight, QColor(0x678db2));
qp.setColor(QPalette::AlternateBase, QColor("#e8e8e8"));
qp.setColor(QPalette::Highlight, QColor("#678db2"));
qp.setColor(QPalette::HighlightedText, Qt::black);
setPalette(qp);

View File

@ -220,7 +220,7 @@ void ImportElementTextPattern::apply(QString name, bool erase) const
//Replace the original uuid of texts in the xml description, by a new one for every texts
QHash<QUuid, QUuid> uuid_hash;
for (QDomElement text : std::as_const(texts))
for(QDomElement text : texts)
{
QUuid original_uuid(text.attribute("uuid"));
QUuid new_uuid = QUuid::createUuid();
@ -231,7 +231,7 @@ void ImportElementTextPattern::apply(QString name, bool erase) const
//In each group of the xml description, replace the original uuids, by the news created upper.
QList <QDomElement> groups = QET::findInDomElement(root, "texts_groups", "texts_group");
for (const QDomElement& group : std::as_const(groups))
for(const QDomElement& group : groups)
{
for(QDomElement text : QET::findInDomElement(group, "texts", "text"))
{
@ -260,14 +260,14 @@ void ImportElementTextPattern::apply(QString name, bool erase) const
}
//Add the texts to element
for (const QDomElement& text : std::as_const(texts))
for(const QDomElement& text : texts)
{
DynamicElementTextItem *deti = new DynamicElementTextItem(m_element);
undo_stack.push(new AddElementTextCommand(m_element, deti));
deti->fromXml(text);
}
//Add the groups to element
for (const QDomElement& xml_group : std::as_const(groups))
for(const QDomElement& xml_group : groups)
undo_stack.push(new AddTextsGroupCommand(m_element, xml_group));
undo_stack.endMacro();

View File

@ -505,7 +505,7 @@ void ExportDialog::generateDxf(
ElementPictureFactory::primitives primitives = ElementPictureFactory::instance()->getPrimitives(elmt->location());
for (QGraphicsSimpleTextItem* text : std::as_const(primitives.m_texts))
for(QGraphicsSimpleTextItem *text : primitives.m_texts)
{
qreal fontSize = text->font().pointSizeF();
if (fontSize < 0)
@ -524,7 +524,7 @@ void ExportDialog::generateDxf(
y = transformed_point.y() - xdir * fontSize * 0.5;
QStringList lines = text->text().split('\n');
qreal offset = fontSize * 1.6;
for (const QString& line : std::as_const(lines))
for (QString line : lines)
{
if (line.size() > 0 && line != "_" ) {
Createdxf::drawText(file_path, line, QPointF(x, y), fontSize, 360 - angle, 0, 0.72);
@ -534,29 +534,28 @@ void ExportDialog::generateDxf(
}
}
for (QLineF line : std::as_const(primitives.m_lines))
for (QLineF line : primitives.m_lines)
{
QTransform t = QTransform().translate(elem_pos_x,elem_pos_y).rotate(rotation_angle);
QLineF l = t.map(line);
Createdxf::drawLine(file_path, l, 0);
}
for (QRectF rect : std::as_const(primitives.m_rectangles))
for (QRectF rect : primitives.m_rectangles)
{
QTransform t = QTransform().translate(elem_pos_x,elem_pos_y).rotate(rotation_angle);
QRectF r = t.mapRect(rect);
Createdxf::drawRectangle(file_path,r,0);
}
for (QRectF circle_rect : std::as_const(primitives.m_circles))
for (QRectF circle_rect : primitives.m_circles)
{
QTransform t = QTransform().translate(elem_pos_x,elem_pos_y).rotate(rotation_angle);
QPointF c = t.map(QPointF(circle_rect.center().x(),circle_rect.center().y()));
Createdxf::drawCircle(file_path,c,circle_rect.width()/2,0);
}
for (const QVector<QPointF>& polygon :
std::as_const(primitives.m_polygons))
for (QVector<QPointF> polygon : primitives.m_polygons)
{
if (polygon.size() == 0)
continue;
@ -569,7 +568,7 @@ void ExportDialog::generateDxf(
}
// Draw arcs and ellipses
for (const QVector<qreal>& arc : std::as_const(primitives.m_arcs))
for (QVector<qreal> arc : primitives.m_arcs)
{
if (arc.size() == 0)
continue;

View File

@ -130,8 +130,7 @@ ElementPictureFactory::primitives ElementPictureFactory::getPrimitives(
ElementPictureFactory::~ElementPictureFactory()
{
for (const primitives& p : m_primitives_H.values())
{
for (primitives p : m_primitives_H.values()) {
qDeleteAll(p.m_texts);
}
}
@ -581,7 +580,7 @@ void ElementPictureFactory::setPainterStyle(const QDomElement &dom, QPainter &pa
<< rx.patternErrorOffset();
return;
}
for (const auto& style : styles)
for (auto style : styles)
{
QRegularExpressionMatch match = rx.match(style);
if (!match.hasMatch()) {

View File

@ -356,12 +356,14 @@ QTreeWidgetItem *GenericPanel::updateDiagramItem(QTreeWidgetItem *diagram_qtwi,
int diagram_folio_idx = diagram -> folioIndex();
if (diagram_folio_idx != -1)
{
displayed_label =
QString(tr("%1 - %2",
"label displayed for a diagram in the panel ;"
" %1 is the folio index, %2 is the diagram title"))
.arg(displayed_label, displayed_title);
diagram_qtwi->setText(0, displayed_label);
displayed_label = QString(
tr(
"%1 - %2",
"label displayed for a diagram in the panel ;"
" %1 is the folio index, %2 is the diagram title"
)
).arg(displayed_label).arg(displayed_title);
diagram_qtwi -> setText(0, displayed_label);
}
}
@ -908,8 +910,8 @@ void GenericPanel::deleteItem(QTreeWidgetItem *item, bool deleted_on_cascade) {
*/
void GenericPanel::markItemAsUnused(QTreeWidgetItem *qtwi) {
QLinearGradient t(0, 0, 200, 0);
t.setColorAt(0, QColor(0xffc0c0));
t.setColorAt(1, QColor(0xffffff));
t.setColorAt(0, QColor("#ffc0c0"));
t.setColorAt(1, QColor("#ffffff"));
qtwi -> setBackground(0, QBrush(t));
qtwi -> setToolTip(0,
QString(tr("%1 [non utilisé dans le projet]")).arg(

View File

@ -309,7 +309,7 @@ void ProjectPrintWindow::printDiagram(Diagram *diagram, bool fit_page, QPainter
//Scrolls through the page for print
bool first_ = true;
for (auto page : std::as_const(page_to_print))
for (auto page : page_to_print)
{
first_ ? first_ = false : m_printer->newPage();
diagram->render(painter, QRect(QPoint(0,0), page.size()), page.translated(diagram_rect.topLeft()), Qt::KeepAspectRatio);
@ -320,8 +320,7 @@ void ProjectPrintWindow::printDiagram(Diagram *diagram, bool fit_page, QPainter
for (auto view : diagram->views()) {
view->setInteractive(true);
}
for (auto qgi : std::as_const(focusable_items))
{
for (auto qgi : focusable_items) {
qgi->setFlag(QGraphicsItem::ItemIsFocusable, true);
}
saveReloadDiagramParameters(diagram, option, false);

View File

@ -89,8 +89,7 @@ void XRefProperties::fromSettings(const QSettings &settings,
QMetaEnum var = QMetaEnum::fromType<Qt::Alignment>();
m_xref_pos = Qt::AlignmentFlag(var.keyToValue((settings.value(prefix + "xrefpos").toString()).toStdString().data()));
for (const QString& key : std::as_const(m_prefix_keys))
{
for (QString key : m_prefix_keys) {
m_prefix.insert(key, settings.value(prefix + key + "prefix").toString());
}
}

View File

@ -2405,7 +2405,7 @@ void QETApp::checkBackupFiles()
text.append(tr("<b>Les fichiers de restauration suivant on été trouvé,<br>"
"Voulez-vous les ouvrir ?</b><br>"));
}
for (const KAutoSaveFile* kasf : std::as_const(stale_files))
for(const KAutoSaveFile *kasf : stale_files)
{
# ifdef Q_OS_WIN
//Remove the first character '/' before the name of the drive
@ -2439,7 +2439,7 @@ void QETApp::checkBackupFiles()
else //Clear backup file
{
//Remove the stale files
for (KAutoSaveFile* stale : std::as_const(stale_files))
for (KAutoSaveFile *stale : stale_files)
{
stale->open(QIODevice::ReadWrite);
delete stale;

View File

@ -929,10 +929,7 @@ void QETDiagramEditor::save()
QString title = (project_view -> project() -> title ());
if (title.isEmpty()) title = "QElectroTech ";
QString filePath = (project_view -> project() -> filePath ());
statusBar()->showMessage(
tr("Projet %1 enregistré dans le repertoire: %2.")
.arg(title, filePath),
2000);
statusBar()-> showMessage(tr("Projet %1 enregistré dans le repertoire: %2.").arg(title).arg (filePath), 2000);
m_element_collection_widget->highlightUnusedElement();
}
else {
@ -955,10 +952,7 @@ void QETDiagramEditor::saveAs()
QString title = (project_view -> project() -> title ());
if (title.isEmpty()) title = "QElectroTech ";
QString filePath = (project_view -> project() -> filePath ());
statusBar()->showMessage(
tr("Projet %1 enregistré dans le repertoire: %2.")
.arg(title, filePath),
2000);
statusBar()->showMessage(tr("Projet %1 enregistré dans le repertoire: %2.").arg(title).arg (filePath), 2000);
m_element_collection_widget->highlightUnusedElement();
}
else {
@ -1620,7 +1614,7 @@ void QETDiagramEditor::slot_updateComplexActions()
<< m_rotate_selection
<< m_edit_selection
<< m_group_selected_texts;
for (QAction* action : std::as_const(action_list))
for(QAction *action : action_list)
action->setEnabled(false);
return;
@ -1652,13 +1646,13 @@ void QETDiagramEditor::slot_updateComplexActions()
QList<ElementTextItemGroup *> groups = DiagramContent(diagram_).selectedTextsGroup();
int selected_texts = texts.count();
int selected_conductor_texts = 0;
for (DiagramTextItem* dti : std::as_const(texts))
for(DiagramTextItem *dti : texts)
{
if(dti->type() == ConductorTextItem::Type)
selected_conductor_texts++;
}
int selected_dynamic_elmt_text = 0;
for (DiagramTextItem* dti : std::as_const(texts))
for(DiagramTextItem *dti : texts)
{
if(dti->type() == DynamicElementTextItem::Type)
selected_dynamic_elmt_text++;
@ -1671,7 +1665,7 @@ void QETDiagramEditor::slot_updateComplexActions()
{
Element *elmt = deti_list.first()->parentElement();
bool ok = true;
for (DynamicElementTextItem* deti : std::as_const(deti_list))
for(DynamicElementTextItem *deti : deti_list)
{
if(elmt != deti->parentElement())
ok = false;

View File

@ -133,7 +133,7 @@ void QetGraphicsHeaderItem::paint(
//Draw vertical lines
auto offset= 0;
for (auto size : std::as_const(m_current_sections_width))
for(auto size : m_current_sections_width)
{
QPointF p1(offset+size, m_current_rect.top());
QPointF p2(offset+size, m_current_rect.bottom());
@ -188,7 +188,7 @@ bool QetGraphicsHeaderItem::toDXF(const QString &filepath)
//Draw vertical lines
auto offset= 0;
for (auto size : std::as_const(m_current_sections_width))
for(auto size : m_current_sections_width)
{
QPointF p1(offset+size, m_current_rect.top());
QPointF p2(offset+size, m_current_rect.bottom());

View File

@ -75,7 +75,9 @@ GraphicsTablePropertiesEditor::~GraphicsTablePropertiesEditor()
void GraphicsTablePropertiesEditor::setTable(QetGraphicsTableItem *table)
{
if (m_table_item) {
for (const auto& c : std::as_const(m_connect_list)) { disconnect(c); }
for (auto c : m_connect_list) {
disconnect(c);
}
if (m_current_model_editor)
{
ui->m_content_layout->removeWidget(m_current_model_editor);
@ -306,11 +308,9 @@ void GraphicsTablePropertiesEditor::updateUi()
{
//Disconnect every connections of editor widgets
//to avoid an unwanted edition (QSpinBox emit valueChanged no matter if changer by user or by program)
for (const QMetaObject::Connection& c :
std::as_const(m_edit_connection))
{
disconnect(c);
}
for (QMetaObject::Connection c : m_edit_connection) {
disconnect(c);
}
m_edit_connection.clear();
ui->m_next_pb->setEnabled(m_table_item->nextTable());
@ -433,8 +433,7 @@ void GraphicsTablePropertiesEditor::updateInfoLabel()
*/
void GraphicsTablePropertiesEditor::setUpEditConnection()
{
for (const QMetaObject::Connection& c : std::as_const(m_edit_connection))
{
for (QMetaObject::Connection c : m_edit_connection) {
disconnect(c);
}
@ -543,7 +542,7 @@ void GraphicsTablePropertiesEditor::on_m_apply_geometry_to_linked_table_pb_click
auto new_displayN_row = m_table_item->displayNRow();
//Apply to all linked table
auto parent_undo = new QUndoCommand(tr("Appliquer la géometrie d'un tableau aux tableau liée à celui-ci"));
for (auto table : std::as_const(vector_))
for (auto table : vector_)
{
new QPropertyUndoCommand(table, "pos", table->pos(), new_pos, parent_undo);
new QPropertyUndoCommand(table, "size", table->size(), new_size, parent_undo);

View File

@ -803,7 +803,7 @@ void Conductor::handlerMousePressEvent(QetGraphicsHandlerItem *qghi, QGraphicsSc
m_moved_segment = segmentsList().at(m_vector_index+1);
before_mov_text_pos_ = m_text_item -> pos();
for (QetGraphicsHandlerItem* handler : std::as_const(m_handler_vector))
for(QetGraphicsHandlerItem *handler : m_handler_vector)
if(handler != qghi)
handler->hide();
}
@ -871,7 +871,7 @@ void Conductor::addHandler()
{
m_handler_vector = QetGraphicsHandlerItem::handlerForPoint(mapToScene(handlerPoints()), QETUtils::graphicsHandlerSize(this));
for (QetGraphicsHandlerItem* handler : std::as_const(m_handler_vector))
for(QetGraphicsHandlerItem *handler : m_handler_vector)
{
handler->setColor(Qt::blue);
scene()->addItem(handler);
@ -1703,7 +1703,7 @@ QSet<Conductor *> Conductor::relatedPotentialConductors(const bool all_diagram,
this_terminal << terminal1 << terminal2;
// Return all conductors of terminal 1 and 2
for (Terminal* terminal : std::as_const(this_terminal))
for (Terminal *terminal : this_terminal)
{
if (!t_list->contains(terminal))
{
@ -1723,8 +1723,7 @@ QSet<Conductor *> Conductor::relatedPotentialConductors(const bool all_diagram,
other_conductors_list_t.removeAll(this);
//Get the conductors at the same potential for each conductors of other_conductors_list_t
for (Conductor* c : std::as_const(other_conductors_list_t))
{
for (Conductor *c : other_conductors_list_t) {
other_conductors += c->relatedPotentialConductors(all_diagram, t_list);
}
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) // ### Qt 6: remove
@ -2017,7 +2016,7 @@ QPointF Conductor::movePointIntoPolygon(const QPointF &point, const QPainterPath
QList<QLineF> lines;
QList<QPointF> points;
for (const QPolygonF& polygon : polygons)
for (QPolygonF polygon : polygons)
{
if (polygon.count() <= 1)
continue;
@ -2032,7 +2031,7 @@ QPointF Conductor::movePointIntoPolygon(const QPointF &point, const QPainterPath
// we make orthogonal projections of the point on the different
// segments of the polygon, sorting them by increasing length
QMap<qreal, QPointF> intersections;
for (QLineF line : std::as_const(lines))
for (QLineF line : lines)
{
QPointF intersection_point;
if (QET::orthogonalProjection(point, line, &intersection_point)) {

View File

@ -98,7 +98,7 @@ void CrossRefItem::init()
*/
void CrossRefItem::setUpConnection()
{
for (const QMetaObject::Connection& c : std::as_const(m_update_connection))
for(const QMetaObject::Connection& c : m_update_connection)
disconnect(c);
m_update_connection.clear();
@ -424,7 +424,7 @@ void CrossRefItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
*/
void CrossRefItem::linkedChanged()
{
for (const QMetaObject::Connection& c : std::as_const(m_slave_connection))
for(const QMetaObject::Connection& c : m_slave_connection)
disconnect(c);
m_slave_connection.clear();
@ -524,7 +524,7 @@ void CrossRefItem::setUpCrossBoundingRect(QPainter &painter)
//Bounding rect of the NO text
QRectF no_bounding;
for (const auto& str : no_str)
for (auto str : no_str)
{
QRectF bounding = painter.boundingRect(QRectF (), Qt::AlignCenter, str);
no_bounding = no_bounding.united(bounding);
@ -538,7 +538,7 @@ void CrossRefItem::setUpCrossBoundingRect(QPainter &painter)
//Bounding rect of the NC text
QRectF nc_bounding;
for (const auto& str : nc_str)
for (auto str : nc_str)
{
QRectF bounding = painter.boundingRect(QRectF (), Qt::AlignCenter, str);
nc_bounding = nc_bounding.united(bounding);

View File

@ -1000,8 +1000,7 @@ void DynamicElementTextItem::setupFormulaConnection()
void DynamicElementTextItem::clearFormulaConnection()
{
for (const QMetaObject::Connection& con :
std::as_const(m_formula_connection))
for (const QMetaObject::Connection& con : m_formula_connection)
disconnect(con);
m_formula_connection.clear();
}

View File

@ -732,7 +732,7 @@ bool Element::fromXml(QDomElement &e,
{
if (auto terminal_ = qgraphicsitem_cast<Terminal *>(qgi))
{
for (auto qde : std::as_const(liste_terminals))
for(auto qde : liste_terminals)
{
if (terminal_ -> fromXml(qde))
{
@ -812,7 +812,7 @@ bool Element::fromXml(QDomElement &e,
//Before loading the dynamic text field,
//we remove the dynamic text field created from the description of this element, to avoid doublons.
for (DynamicElementTextItem* deti : std::as_const(m_dynamic_text_list))
for(DynamicElementTextItem *deti : m_dynamic_text_list)
delete deti;
m_dynamic_text_list.clear();
@ -868,10 +868,10 @@ bool Element::fromXml(QDomElement &e,
//We must block the update of the alignment when loading the information
//otherwise the pos of the text will not be the same as it was at save time.
for (DynamicElementTextItem* deti : std::as_const(m_dynamic_text_list))
for(DynamicElementTextItem *deti : m_dynamic_text_list)
deti->m_block_alignment = true;
setElementInformations(dc);
for (DynamicElementTextItem* deti : std::as_const(m_dynamic_text_list))
for(DynamicElementTextItem *deti : m_dynamic_text_list)
deti->m_block_alignment = false;
m_state = QET::GIOK;
@ -1011,15 +1011,15 @@ QDomElement Element::toXml(
//Remove the texts from group
QList<DynamicElementTextItem *> deti_list = group->texts();
for (DynamicElementTextItem* deti : std::as_const(deti_list))
for(DynamicElementTextItem *deti : deti_list)
group->removeFromGroup(deti);
//Save the texts to xml
for (DynamicElementTextItem* deti : std::as_const(deti_list))
for (DynamicElementTextItem *deti : deti_list)
dyn_text.appendChild(deti->toXml(document));
//Re add texts to group
for (DynamicElementTextItem* deti : std::as_const(deti_list))
for(DynamicElementTextItem *deti : deti_list)
group->addToGroup(deti);
//Restorr the alignment
@ -1079,7 +1079,7 @@ void Element::removeDynamicTextItem(DynamicElementTextItem *deti)
return;
}
for (ElementTextItemGroup* group : std::as_const(m_texts_group))
for(ElementTextItemGroup *group : m_texts_group)
{
if(group->texts().contains(deti))
{

View File

@ -214,7 +214,7 @@ void ElementTextItemGroup::updateAlignment()
else if (texts.size() > 1)
{
qreal width = 0;
for (QGraphicsItem* item : std::as_const(texts))
for(QGraphicsItem *item : texts)
if(item->boundingRect().width() > width)
width = item->boundingRect().width();
@ -226,8 +226,8 @@ void ElementTextItemGroup::updateAlignment()
if(m_alignment == Qt::AlignLeft)
{
QPointF ref = texts.first()->pos();
for (QGraphicsItem* item : std::as_const(texts))
for(QGraphicsItem *item : texts)
{
item->setPos(0, ref.y()+y_offset);
y_offset+=item->boundingRect().height() + m_vertical_adjustment;
@ -236,8 +236,8 @@ void ElementTextItemGroup::updateAlignment()
else if(m_alignment == Qt::AlignVCenter)
{
QPointF ref(width/2,0);
for (QGraphicsItem* item : std::as_const(texts))
for(QGraphicsItem *item : texts)
{
item->setPos(ref.x() - item->boundingRect().width()/2,
ref.y() + y_offset);
@ -247,8 +247,8 @@ void ElementTextItemGroup::updateAlignment()
else if (m_alignment == Qt::AlignRight)
{
QPointF ref(width,0);
for (QGraphicsItem* item : std::as_const(texts))
for(QGraphicsItem *item : texts)
{
item->setPos(ref.x() - item->boundingRect().width(),
ref.y() + y_offset);

View File

@ -49,14 +49,11 @@ QetShapeItem::QetShapeItem(QPointF p1, QPointF p2, ShapeType type, QGraphicsItem
setAcceptHoverEvents(true);
m_pen.setStyle(Qt::SolidLine);
//ensure handlers are always above this item
connect(
this,
&QetShapeItem::zChanged,
[this]()
{
for (QetGraphicsHandlerItem* qghi : std::as_const(m_handler_vector))
qghi->setZValue(this->zValue() + 1);
});
connect(this, &QetShapeItem::zChanged, [this]()
{
for(QetGraphicsHandlerItem *qghi : m_handler_vector)
qghi->setZValue(this->zValue()+1);
});
m_insert_point = new QAction(tr("Ajouter un point"), this);
m_insert_point->setIcon(QET::Icons::Add);
@ -490,8 +487,7 @@ void QetShapeItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
if (m_handler_vector.count() > 2)
{
for (QetGraphicsHandlerItem* qghi :
std::as_const(m_handler_vector))
for (QetGraphicsHandlerItem *qghi : m_handler_vector)
{
if (qghi->contains(qghi->mapFromScene(event->scenePos())))
{
@ -524,16 +520,14 @@ void QetShapeItem::switchResizeMode()
if (m_resize_mode == 1)
{
m_resize_mode = 2;
for (QetGraphicsHandlerItem* qghi : std::as_const(m_handler_vector))
{
for (QetGraphicsHandlerItem *qghi : m_handler_vector) {
qghi->setColor(Qt::darkGreen);
}
}
else
{
m_resize_mode = 1;
for (QetGraphicsHandlerItem* qghi : std::as_const(m_handler_vector))
{
for (QetGraphicsHandlerItem *qghi : m_handler_vector) {
qghi->setColor(Qt::blue);
}
}
@ -543,7 +537,7 @@ void QetShapeItem::switchResizeMode()
if (m_resize_mode == 1)
{
m_resize_mode = 2;
for (QetGraphicsHandlerItem* qghi : std::as_const(m_handler_vector))
for (QetGraphicsHandlerItem *qghi : m_handler_vector)
qghi->setColor(Qt::darkGreen);
}
else if (m_resize_mode == 2)
@ -552,8 +546,7 @@ void QetShapeItem::switchResizeMode()
qDeleteAll(m_handler_vector);
m_handler_vector.clear();
addHandler();
for (QetGraphicsHandlerItem* qghi : std::as_const(m_handler_vector))
{
for (QetGraphicsHandlerItem *qghi : m_handler_vector) {
qghi->setColor(Qt::magenta);
}
}
@ -563,10 +556,10 @@ void QetShapeItem::switchResizeMode()
qDeleteAll(m_handler_vector);
m_handler_vector.clear();
addHandler();
for (QetGraphicsHandlerItem* qghi : std::as_const(m_handler_vector))
{
for (QetGraphicsHandlerItem *qghi : m_handler_vector) {
qghi->setColor(Qt::blue);
}
}
}
}

View File

@ -29,7 +29,7 @@
QColor Terminal::neutralColor = QColor(Qt::blue);
QColor Terminal::allowedColor = QColor(Qt::darkGreen);
QColor Terminal::warningColor = QColor(0xff8000);
QColor Terminal::warningColor = QColor("#ff8000");
QColor Terminal::forbiddenColor = QColor(Qt::red);
const qreal Terminal::terminalSize = 4.0;
const qreal Terminal::Z = 1000;

View File

@ -73,8 +73,7 @@ QString QETInformation::titleblockInfoKeysToVar(const QString &info)
QHash<QString, QString> QETInformation::titleblockTranslatedKeyHashVar()
{
QHash <QString, QString> hash_;
for (const QString& str : titleblockInfoKeys())
{
for (QString str : titleblockInfoKeys()) {
hash_.insert(translatedInfoKey(str), titleblockInfoKeysToVar(str));
}
return hash_;

View File

@ -516,7 +516,7 @@ void QETXML::modelHeaderDataFromXml(
auto meta_enum_orientation = QMetaEnum::fromType<Qt::Orientations>();
auto meta_enum_role = QMetaEnum::fromType<Qt::ItemDataRole>();
for (const auto& child : QETXML::directChild(element, "data"))
for (auto child : QETXML::directChild(element, "data"))
{
auto section_ = child.attribute("section", "-1").toInt();
auto orientation_ = Qt::Orientation(

View File

@ -201,8 +201,8 @@ void QTextOrientationWidget::paintEvent(QPaintEvent *event) {
p.setRenderHint(QPainter::TextAntialiasing, true);
// cercle gris a fond jaune
p.setPen(QPen(QBrush(QColor(0x9FA8A8)), 2.0));
p.setBrush(QBrush(QColor(0xffffaa)));
p.setPen(QPen(QBrush(QColor("#9FA8A8")), 2.0));
p.setBrush(QBrush(QColor("#ffffaa")));
p.drawEllipse(drawing_rectangle);
// ligne rouge indiquant l'angle actuel
@ -230,10 +230,10 @@ void QTextOrientationWidget::paintEvent(QPaintEvent *event) {
qreal square_offset = - squares_size / 2.0;
QRectF square_qrect = QRect(square_offset, square_offset, squares_size, squares_size);
p.setPen(Qt::NoPen);
p.setBrush(QBrush(QColor(0x248A34)));
p.setBrush(QBrush(QColor("#248A34")));
for (double drawing_angle = 0.0 ; drawing_angle < 360.0 ; drawing_angle += squares_interval_) {
if (must_highlight_angle_ && highlight_angle_ == drawing_angle && underMouse()) {
p.setBrush(QBrush(QColor(0x43FF5F)));
p.setBrush(QBrush(QColor("#43FF5F")));
}
p.resetTransform();
p.translate(drawing_rectangle_center);
@ -242,7 +242,7 @@ void QTextOrientationWidget::paintEvent(QPaintEvent *event) {
p.rotate(-45.0);
p.drawRect(square_qrect);
if (must_highlight_angle_ && highlight_angle_ == drawing_angle) {
p.setBrush(QBrush(QColor(0x248A34)));
p.setBrush(QBrush(QColor("#248A34")));
}
}

View File

@ -96,13 +96,13 @@ void HelperCell::paint(QPainter *painter, const QStyleOptionGraphicsItem *option
*/
void HelperCell::setType(QET::TitleBlockColumnLength type) {
if (type == QET::Absolute) {
background_color = QColor(0xC0FFFF);
background_color = QColor("#C0FFFF");
foreground_color = Qt::black;
} else if (type == QET::RelativeToTotalLength) {
background_color = QColor(0xFFA858);
background_color = QColor("#FFA858");
foreground_color = Qt::black;
} else if (type == QET::RelativeToRemainingLength) {
background_color = QColor(0xFFC0C0);
background_color = QColor("#FFC0C0");
foreground_color = Qt::black;
}
}

View File

@ -82,15 +82,14 @@ QET::Action IntegrationMoveTitleBlockTemplatesHandler::templateAlreadyExists(con
@param message Error message.
*/
QET::Action IntegrationMoveTitleBlockTemplatesHandler::errorWithATemplate(const TitleBlockTemplateLocation &tbt, const QString &message) {
QString error_message =
QString("Une erreur s'est produite avec le modèle %1 : %2")
.arg(tbt.toString(), message);
QString error_message = QString("Une erreur s'est produite avec le modèle %1 : %2").arg(tbt.toString()).arg(message);
QET::QetMessageBox::critical(
parent_widget_,
tr("Erreur", "message box title"),
error_message,
QMessageBox::Ok,
QMessageBox::Ok);
QMessageBox::Ok
);
return(QET::Ignore);
}
@ -117,7 +116,7 @@ QString IntegrationMoveTitleBlockTemplatesHandler::dateString() const
This name is based on the current date.
*/
QString IntegrationMoveTitleBlockTemplatesHandler::newNameForTemplate(const TitleBlockTemplateLocation &tbt) {
return (QString("%1-%2.elmt").arg(tbt.name(), dateString()));
return(QString("%1-%2.elmt").arg(tbt.name()).arg(dateString()));
}
/**

View File

@ -620,11 +620,12 @@ QString QETTitleBlockTemplateEditor::currentlyEditedTitle() const
if (read_only_) {
tag = tr("[Lecture seule]", "window title tag");
}
titleblock_title =
QString(tr("%1 %2",
"part of the window title - %1 is the filepath or "
"template name, %2 is the [Changed] or [Read only] tag"))
.arg(titleblock_title, tag);
titleblock_title = QString(
tr(
"%1 %2",
"part of the window title - %1 is the filepath or template name, %2 is the [Changed] or [Read only] tag"
)
).arg(titleblock_title).arg(tag);
}
return(titleblock_title);
@ -724,10 +725,12 @@ void QETTitleBlockTemplateEditor::updateEditorTitle()
if (titleblock_title.isEmpty()) {
title = min_title;
} else {
title = QString(tr("%1 - %2",
"window title: %1 is the base window title, %2 is a "
"template name"))
.arg(min_title, titleblock_title);
title = QString(
tr(
"%1 - %2",
"window title: %1 is the base window title, %2 is a template name"
)
).arg(min_title).arg(titleblock_title);
}
setWindowTitle(title);
}

View File

@ -557,7 +557,7 @@ QString TitleBlockTemplatesFilesCollection::toTemplateName(const QString &file_n
@return the file name for \a template_name
*/
QString TitleBlockTemplatesFilesCollection::toFileName(const QString &template_name) {
return (QString("%1%2").arg(template_name, TITLEBLOCKS_FILE_EXTENSION));
return(QString("%1%2").arg(template_name).arg(TITLEBLOCKS_FILE_EXTENSION));
}
/**

View File

@ -1150,10 +1150,11 @@ TitleBlockTemplateCellsSet TitleBlockTemplateView::makeCellsSetFromGraphicsItems
QString TitleBlockTemplateView::makePrettyToolTip(const QString &string) {
QString css_style = QString("white-space: pre;");
QString final_tooltip_content =
QString("<div style=\"%1\">%2</div>").arg(css_style, string);
QString final_tooltip_content = QString(
"<div style=\"%1\">%2</div>"
).arg(css_style).arg(string);
return (final_tooltip_content);
return(final_tooltip_content);
}
/**

View File

@ -1717,12 +1717,10 @@ QString TitleBlockTemplate::finalTextForCell(
if (cell.display_label && !cell.label.isEmpty()) {
cell_label = interpreteVariables(cell_label, diagram_context);
cell_text = QString(tr(" %1 : %2",
"titleblock content - please let the blank "
"space at the beginning"))
.arg(cell_label, cell_text);
cell_text = QString(tr(" %1 : %2", "titleblock content - please let the blank space at the beginning")).arg(cell_label).arg(cell_text);
} else {
cell_text = QString(tr(" %1")).arg(cell_text);
}
else { cell_text = QString(tr(" %1")).arg(cell_text); }
return(cell_text);
}

View File

@ -236,7 +236,7 @@ void AboutQETDialog::addAuthor(QLabel *label, const QString &name, const QString
QString author_template = "<span style=\"text-decoration: underline;\">%1</span> : %2 &lt;<a href=\"mailto:%3\">%3</a>&gt;&lrm;<br/><br/>";
// Add the function of the person
new_text += author_template.arg(work, name, email);
new_text += author_template.arg(work).arg(name).arg(email);
label->setText(new_text);
}
@ -253,7 +253,7 @@ void AboutQETDialog::addLibrary(QLabel *label, const QString &name, const QStrin
QString Library_template = "<span style=\"text-decoration: underline;\">%1</span> : &lt;<a href=\"%3\">%3</a>&gt;&lrm;<br/><br/>";
// Add the function of the person
new_text += Library_template.arg(name, link);
new_text += Library_template.arg(name).arg(link);
label->setText(new_text);
}

View File

@ -71,7 +71,7 @@ void DiagramContextWidget::setContext (const DiagramContext &context)
clear();
int i = 0;
for (const QString& key : context.keys(DiagramContext::Alphabetical))
for (QString key : context.keys(DiagramContext::Alphabetical))
{
ui->m_table->setItem(i, 0, new QTableWidgetItem(key));
ui->m_table->setItem(i, 1, new QTableWidgetItem(context[key].toString()));

View File

@ -79,23 +79,23 @@ void DynamicElementTextItemEditor::apply()
deti_list << m_element.data()->dynamicTextItems();
for(ElementTextItemGroup *group : m_element.data()->textGroups())
deti_list << group->texts();
for (DynamicElementTextItem *deti : deti_list)
{
QUndoCommand *undo = m_model->undoForEditedText(deti);
for (DynamicElementTextItem* deti : std::as_const(deti_list))
if (undo->childCount() == 1)
{
QUndoCommand* undo = m_model->undoForEditedText(deti);
if (undo->childCount() == 1)
{
QPropertyUndoCommand* quc = new QPropertyUndoCommand(
static_cast<const QPropertyUndoCommand*>(undo->child(0)));
if (quc->text().isEmpty()) quc->setText(undo->text());
undo_list << quc;
delete undo;
}
else if (undo->childCount() > 1)
undo_list << undo;
else
delete undo;
QPropertyUndoCommand *quc = new QPropertyUndoCommand(static_cast<const QPropertyUndoCommand *>(undo->child(0)));
if (quc->text().isEmpty())
quc->setText(undo->text());
undo_list << quc;
delete undo;
}
else if(undo->childCount() > 1)
undo_list << undo;
else
delete undo;
}
//Get all texts groups of the edited element
@ -127,7 +127,8 @@ void DynamicElementTextItemEditor::apply()
{
QUndoStack &us = m_element->diagram()->undoStack();
us.beginMacro(tr("Modifier des textes d'élément"));
for (QUndoCommand* quc : std::as_const(undo_list)) us.push(quc);
for (QUndoCommand *quc : undo_list)
us.push(quc);
us.endMacro();
}
}

View File

@ -1936,8 +1936,8 @@ QStringList DynamicTextItemDelegate::availableInfo(
QStringList info_list = QETInformation::elementInfoKeys();
info_list.removeAll("formula"); //No need to have formula
DiagramContext dc = elmt->elementInformations();
for (const QString& info : std::as_const(info_list))
for(const QString& info : info_list)
{
if(dc.contains(info))
qstrl << info;

View File

@ -158,7 +158,7 @@ bool ElementInfoWidget::event(QEvent *event)
*/
void ElementInfoWidget::enableLiveEdit()
{
for (ElementInfoPartWidget* eipw : std::as_const(m_eipw_list))
for (ElementInfoPartWidget *eipw : m_eipw_list)
connect(eipw, &ElementInfoPartWidget::textChanged, this, &ElementInfoWidget::apply);
}
@ -168,7 +168,7 @@ void ElementInfoWidget::enableLiveEdit()
*/
void ElementInfoWidget::disableLiveEdit()
{
for (ElementInfoPartWidget* eipw : std::as_const(m_eipw_list))
for (ElementInfoPartWidget *eipw : m_eipw_list)
disconnect(eipw, &ElementInfoPartWidget::textChanged, this, &ElementInfoWidget::apply);
}
@ -185,14 +185,11 @@ void ElementInfoWidget::buildInterface()
keys = QETInformation::elementInfoKeys();
}
for (const auto& str : std::as_const(keys))
{
ElementInfoPartWidget* eipw = new ElementInfoPartWidget(
str,
QETInformation::translatedInfoKey(str),
this);
ui->scroll_vlayout->addWidget(eipw);
m_eipw_list << eipw;
for (auto str : keys)
{
ElementInfoPartWidget *eipw = new ElementInfoPartWidget(str, QETInformation::translatedInfoKey(str), this);
ui->scroll_vlayout->addWidget(eipw);
m_eipw_list << eipw;
}
ui->scroll_vlayout->addStretch();
@ -230,9 +227,8 @@ void ElementInfoWidget::updateUi()
if (m_live_edit) disableLiveEdit();
const auto element_info{m_element->elementInformations()};
for (ElementInfoPartWidget* eipw : std::as_const(m_eipw_list))
{
for (ElementInfoPartWidget *eipw : m_eipw_list) {
eipw -> setText (element_info[eipw->key()].toString());
}

View File

@ -140,8 +140,7 @@ void ElementPropertiesWidget::setDynamicText(DynamicElementTextItem *text)
if(text->parentElement())
{
setElement(text->parentElement());
for (AbstractElementPropertiesEditorWidget* aepew :
std::as_const(m_list_editor))
for(AbstractElementPropertiesEditorWidget *aepew : m_list_editor)
{
if (QString(aepew->metaObject()->className()) == "DynamicElementTextItemEditor")
{
@ -167,8 +166,7 @@ void ElementPropertiesWidget::setTextsGroup(ElementTextItemGroup *group)
if(group->parentItem() && group->parentItem()->type() == Element::Type)
{
setElement(static_cast<Element *>(group->parentItem()));
for (AbstractElementPropertiesEditorWidget* aepew :
std::as_const(m_list_editor))
for(AbstractElementPropertiesEditorWidget *aepew : m_list_editor)
{
if (QString(aepew->metaObject()->className()) == "DynamicElementTextItemEditor")
{
@ -316,8 +314,7 @@ void ElementPropertiesWidget::updateUi()
m_list_editor << new DynamicElementTextItemEditor(m_element, this);
//Add each editors in tab widget
for (AbstractElementPropertiesEditorWidget* aepew :
std::as_const(m_list_editor))
for (AbstractElementPropertiesEditorWidget *aepew : m_list_editor)
{
aepew->setLiveEdit(m_live_edit);
m_tab->addTab(aepew, aepew->title());

View File

@ -71,8 +71,7 @@ IndiTextPropertiesWidget::~IndiTextPropertiesWidget()
void IndiTextPropertiesWidget::setText(IndependentTextItem *text)
{
if (m_text) {
for (const QMetaObject::Connection& c : std::as_const(m_connect_list))
{
for (QMetaObject::Connection c : m_connect_list) {
disconnect(c);
}
}
@ -90,8 +89,7 @@ void IndiTextPropertiesWidget::setText(IndependentTextItem *text)
void IndiTextPropertiesWidget::setText(QList<IndependentTextItem *> text_list)
{
for (const QMetaObject::Connection& c : std::as_const(m_connect_list))
{
for (QMetaObject::Connection c : m_connect_list) {
disconnect(c);
}
m_connect_list.clear();
@ -127,9 +125,7 @@ void IndiTextPropertiesWidget::apply()
if (m_text && m_text->diagram()) {
d = m_text->diagram();
} else if (!m_text_list.isEmpty()) {
for (const QPointer<IndependentTextItem>& piti :
std::as_const(m_text_list))
{
for (QPointer<IndependentTextItem> piti : m_text_list) {
if (piti->diagram()) {
d = piti->diagram();
break;
@ -162,9 +158,7 @@ bool IndiTextPropertiesWidget::setLiveEdit(bool live_edit)
setUpEditConnection();
}
else {
for (const QMetaObject::Connection& c :
std::as_const(m_edit_connection))
{
for (QMetaObject::Connection c : m_edit_connection) {
disconnect(c);
}
m_edit_connection.clear();
@ -226,7 +220,7 @@ QUndoCommand *IndiTextPropertiesWidget::associatedUndo() const
qreal rotation_ = m_text_list.first()->rotation();
int size_ = m_text_list.first()->font().pointSize();
QFont font_ = m_text_list.first()->font();
for (const QPointer<IndependentTextItem>& piti : m_text_list)
for (QPointer<IndependentTextItem> piti : m_text_list)
{
if (piti->rotation() != rotation_) {
angle_equal = false;
@ -242,7 +236,7 @@ QUndoCommand *IndiTextPropertiesWidget::associatedUndo() const
if ((angle_equal && (ui->m_angle_sb->value() != rotation_)) ||
(!angle_equal && (ui->m_angle_sb->value() != ui->m_angle_sb->minimum())))
{
for (const QPointer<IndependentTextItem>& piti : m_text_list)
for (QPointer<IndependentTextItem> piti : m_text_list)
{
if (piti)
{
@ -257,7 +251,7 @@ QUndoCommand *IndiTextPropertiesWidget::associatedUndo() const
else if ((size_equal && (ui->m_size_sb->value() != size_)) ||
(!size_equal && (ui->m_size_sb->value() != ui->m_size_sb->minimum())))
{
for (const QPointer<IndependentTextItem>& piti : m_text_list)
for (QPointer<IndependentTextItem> piti : m_text_list)
{
if (piti)
{
@ -273,7 +267,7 @@ QUndoCommand *IndiTextPropertiesWidget::associatedUndo() const
else if ((m_font_is_selected && !font_equal) ||
(m_font_is_selected && (font_equal && (m_selected_font != font_))))
{
for (const QPointer<IndependentTextItem>& piti : m_text_list)
for (QPointer<IndependentTextItem> piti : m_text_list)
{
if (piti)
{
@ -330,8 +324,7 @@ QUndoCommand *IndiTextPropertiesWidget::associatedUndo() const
*/
void IndiTextPropertiesWidget::setUpEditConnection()
{
for (const QMetaObject::Connection& c : std::as_const(m_edit_connection))
{
for (QMetaObject::Connection c : m_edit_connection) {
disconnect(c);
}
m_edit_connection.clear();
@ -361,8 +354,7 @@ void IndiTextPropertiesWidget::updateUi()
//Disconnect every connections of editor widgets
//to avoid an unwanted edition (QSpinBox emit valueChanged no matter if changer by user or by program)
for (const QMetaObject::Connection& c : std::as_const(m_edit_connection))
{
for (QMetaObject::Connection c : m_edit_connection) {
disconnect(c);
}
m_edit_connection.clear();
@ -396,8 +388,7 @@ void IndiTextPropertiesWidget::updateUi()
int size_ = m_text_list.first()->font().pointSize();
QFont font_ = m_text_list.first()->font();
for (const QPointer<IndependentTextItem>& piti :
std::as_const(m_text_list))
for (QPointer<IndependentTextItem> piti : m_text_list)
{
if (piti->rotation() != rotation_) {
angle_equal = false;
@ -412,9 +403,7 @@ void IndiTextPropertiesWidget::updateUi()
ui->m_angle_sb->setValue(angle_equal ? rotation_ : 0);
bool valid_ = true;
for (const QPointer<IndependentTextItem>& piti :
std::as_const(m_text_list))
{
for (QPointer<IndependentTextItem> piti : m_text_list) {
if (piti->isHtml()) {
valid_ = false;
}
@ -447,11 +436,10 @@ void IndiTextPropertiesWidget::on_m_break_html_pb_clicked()
if (m_text) {
m_text->setPlainText(m_text->toPlainText());
}
for (const QPointer<IndependentTextItem>& piti : std::as_const(m_text_list))
{
for (QPointer<IndependentTextItem> piti : m_text_list) {
piti->setPlainText(piti->toPlainText());
}
updateUi();
}

View File

@ -117,7 +117,7 @@ void MultiPasteDialog::on_m_button_box_accepted()
m_diagram->clearSelection();
m_diagram->undoStack().push(new PasteDiagramCommand(m_diagram, m_pasted_content));
for (const DiagramContent& dc : std::as_const(m_pasted_content_list))
for(DiagramContent dc : m_pasted_content_list)
{
QList<Element *> pasted_elements = dc.m_elements;
//Sort the list element by there pos (top -> bottom)

View File

@ -204,7 +204,7 @@ ConductorProperties PotentialSelectorDialog::chosenProperties(QList<ConductorPro
layout.addWidget(&label);
QHash <QRadioButton *, ConductorProperties> H;
for (const ConductorProperties& cp : list)
for (ConductorProperties cp : list)
{
QString text;
if(!cp.text.isEmpty())

View File

@ -121,7 +121,7 @@ void ShapeGraphicsItemPropertiesWidget::apply()
}
else if (!m_shapes_list.isEmpty())
{
for (const QPointer<QetShapeItem>& qsi : std::as_const(m_shapes_list))
for (QPointer<QetShapeItem> qsi : m_shapes_list)
{
if (qsi->diagram()) {
d = qsi->diagram();
@ -222,7 +222,7 @@ QUndoCommand* ShapeGraphicsItemPropertiesWidget::associatedUndo() const
if (ui->m_style_cb->currentIndex() != -1 &&
Qt::PenStyle(ui->m_style_cb->currentIndex() + 1) != shape_->pen().style())
{
for (const QPointer<QetShapeItem>& qsi : m_shapes_list)
for (QPointer<QetShapeItem> qsi : m_shapes_list)
{
QPen pen = qsi->pen();
@ -239,7 +239,7 @@ QUndoCommand* ShapeGraphicsItemPropertiesWidget::associatedUndo() const
if (ui->m_size_dsb->value() > 0 &&
ui->m_size_dsb->value() != shape_->pen().widthF())
{
for (const QPointer<QetShapeItem>& qsi : m_shapes_list)
for (QPointer<QetShapeItem> qsi : m_shapes_list)
{
QPen pen = pen_H.contains(qsi) ? pen_H.value(qsi) : qsi->pen();
pen.setWidthF(ui->m_size_dsb->value());
@ -250,7 +250,7 @@ QUndoCommand* ShapeGraphicsItemPropertiesWidget::associatedUndo() const
QColor c =ui->m_color_kpb->color();
if (c != QPalette().color(QPalette::Button) && shape_->pen().color() != c)
{
for (const QPointer<QetShapeItem>& qsi : m_shapes_list)
for (QPointer<QetShapeItem> qsi : m_shapes_list)
{
QPen pen = pen_H.contains(qsi) ? pen_H.value(qsi) : qsi->pen();
pen.setColor(c);
@ -258,7 +258,7 @@ QUndoCommand* ShapeGraphicsItemPropertiesWidget::associatedUndo() const
}
}
for (const QPointer<QetShapeItem>& qsi : pen_H.keys())
for (QPointer<QetShapeItem> qsi : pen_H.keys())
{
if (!parent_undo) {
parent_undo = new QUndoCommand(tr("Modifier une forme simple"));
@ -271,7 +271,7 @@ QUndoCommand* ShapeGraphicsItemPropertiesWidget::associatedUndo() const
if (ui->m_brush_style_cb->currentIndex() != -1 &&
shape_->brush().style() != Qt::BrushStyle(ui->m_brush_style_cb->currentIndex()))
{
for (const QPointer<QetShapeItem>& qsi : m_shapes_list)
for (QPointer<QetShapeItem> qsi : m_shapes_list)
{
QBrush brush = qsi->brush();
brush.setStyle(Qt::BrushStyle(ui->m_brush_style_cb->currentIndex()));
@ -282,7 +282,7 @@ QUndoCommand* ShapeGraphicsItemPropertiesWidget::associatedUndo() const
c = ui->m_brush_color_kpb->color();
if (c != QPalette().color(QPalette::Button) && shape_->brush().color() != c)
{
for (const QPointer<QetShapeItem>& qsi : m_shapes_list)
for (QPointer<QetShapeItem> qsi : m_shapes_list)
{
QBrush brush = brush_H.contains(qsi) ? brush_H.value(qsi) : qsi->brush();
brush.setColor(c);
@ -290,7 +290,7 @@ QUndoCommand* ShapeGraphicsItemPropertiesWidget::associatedUndo() const
}
}
for (const QPointer<QetShapeItem>& qsi : brush_H.keys())
for (QPointer<QetShapeItem> qsi : brush_H.keys())
{
if (!parent_undo) {
parent_undo = new QUndoCommand(tr("Modifier une forme simple"));
@ -383,8 +383,7 @@ void ShapeGraphicsItemPropertiesWidget::updateUi()
bool same = true;
//Pen
Qt::PenStyle ps = m_shapes_list.first()->pen().style();
for (QetShapeItem* qsi : std::as_const(m_shapes_list))
{
for (QetShapeItem *qsi : m_shapes_list) {
if (qsi->pen().style() != ps) {
same = false;
break;
@ -394,8 +393,7 @@ void ShapeGraphicsItemPropertiesWidget::updateUi()
same = true;
qreal pw = m_shapes_list.first()->pen().widthF();
for (QetShapeItem* qsi : std::as_const(m_shapes_list))
{
for (QetShapeItem *qsi : m_shapes_list) {
if (qsi->pen().widthF() != pw) {
same = false;
break;
@ -405,8 +403,7 @@ void ShapeGraphicsItemPropertiesWidget::updateUi()
same = true;
QColor pc = m_shapes_list.first()->pen().color();
for (QetShapeItem* qsi : std::as_const(m_shapes_list))
{
for (QetShapeItem *qsi : m_shapes_list) {
if (qsi->pen().color() != pc) {
same = false;
break;
@ -419,8 +416,7 @@ void ShapeGraphicsItemPropertiesWidget::updateUi()
same = true;
Qt::BrushStyle bs = m_shapes_list.first()->brush().style();
for (QetShapeItem* qsi : std::as_const(m_shapes_list))
{
for (QetShapeItem *qsi : m_shapes_list) {
if (qsi->brush().style() != bs) {
same = false;
break;
@ -430,8 +426,7 @@ void ShapeGraphicsItemPropertiesWidget::updateUi()
same = true;
QColor bc = m_shapes_list.first()->brush().color();
for (QetShapeItem* qsi : std::as_const(m_shapes_list))
{
for (QetShapeItem *qsi : m_shapes_list) {
if (qsi->brush().color() != bc) {
same = false;
break;
@ -521,8 +516,7 @@ void ShapeGraphicsItemPropertiesWidget::on_m_lock_pos_cb_clicked()
m_shape->setMovable(!ui->m_lock_pos_cb->isChecked());
}
else if (!m_shapes_list.isEmpty()) {
for (const QPointer<QetShapeItem>& qsi : std::as_const(m_shapes_list))
{
for (QPointer<QetShapeItem> qsi : m_shapes_list) {
qsi->setMovable(!ui->m_lock_pos_cb->isChecked());
}
}

View File

@ -184,7 +184,7 @@ void AddTextsGroupCommand::redo()
}
else
{
for (DynamicElementTextItem* deti : std::as_const(m_deti_list))
for(DynamicElementTextItem *deti : m_deti_list)
m_element.data()->addTextToGroup(
deti,
m_group.data());
@ -194,7 +194,7 @@ void AddTextsGroupCommand::redo()
else if(m_group)
{
m_element.data()->addTextGroup(m_group.data());
for (DynamicElementTextItem* deti : std::as_const(m_deti_list))
for(DynamicElementTextItem *deti : m_deti_list)
m_element.data()->addTextToGroup(deti, m_group.data());
}
}
@ -236,9 +236,8 @@ void RemoveTextsGroupCommand::undo()
if(m_element && m_group)
{
m_element.data()->addTextGroup(m_group.data());
for (const QPointer<DynamicElementTextItem>& p :
std::as_const(m_text_list))
for(const QPointer<DynamicElementTextItem>& p : m_text_list)
if(p)
m_element.data()->addTextToGroup(
p.data(),
@ -253,8 +252,7 @@ void RemoveTextsGroupCommand::redo()
{
if(m_element && m_group)
{
for (const QPointer<DynamicElementTextItem>& p :
std::as_const(m_text_list))
for(const QPointer<DynamicElementTextItem>& p : m_text_list)
if(p)
m_element.data()->removeTextFromGroup(
p.data(),

View File

@ -60,8 +60,7 @@ bool ChangeElementInformationCommand::mergeWith(const QUndoCommand *other)
//In case of other undo_undo have the same elements as keys
if (m_map.size() == other_undo->m_map.size())
{
for (const auto& key : other_undo->m_map.keys())
{
for (auto key : other_undo->m_map.keys()) {
if (!m_map.keys().contains(key)) {
return false;
}
@ -70,13 +69,12 @@ bool ChangeElementInformationCommand::mergeWith(const QUndoCommand *other)
//Other_undo will be merged with this undo :
//Replace the new_info values of this m_map
//by the new_info values of other_undo's m_map
for (const auto& key : other_undo->m_map.keys())
{
m_map.insert(
key,
qMakePair(
m_map.value(key).first,
other_undo->m_map.value(key).second));
for (auto key : other_undo->m_map.keys())
{
m_map.insert(key,
qMakePair(
m_map.value(key).first,
other_undo->m_map.value(key).second));
}
return true;
}
@ -115,7 +113,8 @@ void ChangeElementInformationCommand::updateProjectDB()
//need to have a list of element instead of QPointer<Element>
//for the function elementInfoChange of the database
QList<Element *> list_;
for (const auto& p_elmt : m_map.keys()) list_ << p_elmt.data();
for (auto p_elmt : m_map.keys())
list_ << p_elmt.data();
elmt->diagram()->project()->dataBase()->elementInfoChanged(list_);
}

View File

@ -55,8 +55,7 @@ DeleteQGraphicsItemCommand::DeleteQGraphicsItemCommand(
//When removing a deti we must know its parent item, for re-adding deti as child of the parent
//when undoing this command
for (DynamicElementTextItem* deti :
std::as_const(m_removed_contents.m_element_texts))
for(DynamicElementTextItem *deti : m_removed_contents.m_element_texts)
{
if(deti->parentGroup())
m_grp_texts_hash.insert(deti, deti->parentGroup());
@ -74,9 +73,7 @@ DeleteQGraphicsItemCommand::DeleteQGraphicsItemCommand(
}
//The deletion of the groups is not managed by this undo, but by a RemoveTextsGroupCommand
for (ElementTextItemGroup* group :
std::as_const(m_removed_contents.m_texts_groups))
{
for(ElementTextItemGroup *group : m_removed_contents.m_texts_groups) {
new RemoveTextsGroupCommand(group->parentElement(), group, this);
}
@ -84,7 +81,7 @@ DeleteQGraphicsItemCommand::DeleteQGraphicsItemCommand(
setPotentialsOfRemovedElements();
//Get all linkeds table of removed table.
for (auto table : std::as_const(m_removed_contents.m_tables))
for (auto table : m_removed_contents.m_tables)
{
//Table is already managed, jump to next loop
if (m_table_scene_hash.keys().contains(table))
@ -125,7 +122,7 @@ DeleteQGraphicsItemCommand::~DeleteQGraphicsItemCommand()
*/
void DeleteQGraphicsItemCommand::setPotentialsOfRemovedElements()
{
for (Element* elmt : std::as_const(m_removed_contents.m_elements))
for (Element *elmt : m_removed_contents.m_elements)
{
//a list of terminals who have at least two conductors docked in.
QList<Terminal *> terminals_list;
@ -182,8 +179,7 @@ void DeleteQGraphicsItemCommand::setPotentialsOfRemovedElements()
//If a conductor was already created between these two terminals
//in this undo command, from another removed element, we do nothing
bool exist_ = false;
for (QPair<Terminal*, Terminal*> pair :
std::as_const(m_connected_terminals))
for (QPair<Terminal *, Terminal *> pair : m_connected_terminals)
{
if (pair.first == hub_terminal && pair.second == t) {
exist_ = true;
@ -230,7 +226,7 @@ Terminal *DeleteQGraphicsItemCommand::terminalInSamePotential(
{
QList<Conductor *> conductor_list = terminal->conductors();
conductor_list.removeAll(conductor_to_exclude);
for (Conductor* c : std::as_const(conductor_list))
for(Conductor *c : conductor_list)
{
Terminal *other_terminal = c->terminal1 == terminal ? c->terminal2 : c->terminal1;
if(!m_removed_contents.items(DiagramContent::Elements).contains(other_terminal->parentElement())) {
@ -238,7 +234,7 @@ Terminal *DeleteQGraphicsItemCommand::terminalInSamePotential(
}
}
//No one of direct conductor of terminal are docked to an element which is not removed
for (Conductor* c : std::as_const(conductor_list))
for(Conductor *c : conductor_list)
{
Terminal *other_terminal = c->terminal1 == terminal ? c->terminal2 : c->terminal1;
Terminal *terminal_to_return = terminalInSamePotential(other_terminal, c);
@ -262,12 +258,11 @@ void DeleteQGraphicsItemCommand::undo()
m_diagram->addItem(item);
//We relink element after every element was added to diagram
for (Element* e : std::as_const(m_removed_contents.m_elements))
for(Element *e : m_removed_contents.m_elements)
for(Element *elmt : m_link_hash[e])
e->linkToElement(elmt);
for (DynamicElementTextItem* deti :
std::as_const(m_removed_contents.m_element_texts))
for(DynamicElementTextItem *deti : m_removed_contents.m_element_texts)
{
if(m_elmt_text_hash.keys().contains(deti))
m_elmt_text_hash.value(deti)->addDynamicTextItem(deti);
@ -312,15 +307,14 @@ void DeleteQGraphicsItemCommand::redo()
}
}
for (Element* e : std::as_const(m_removed_contents.m_elements))
for(Element *e : m_removed_contents.m_elements)
{
//Get linked element, for relink it at undo
if (!e->linkedElements().isEmpty())
m_link_hash.insert(e, e->linkedElements());
}
for (DynamicElementTextItem* deti :
std::as_const(m_removed_contents.m_element_texts))
for(DynamicElementTextItem *deti : m_removed_contents.m_element_texts)
{
if(deti->parentGroup() && deti->parentGroup()->parentElement())
deti->parentGroup()->parentElement()->removeTextFromGroup(deti, deti->parentGroup());

View File

@ -203,7 +203,7 @@ void LinkElementCommand::redo()
QStringList str_txt;
QStringList str_funct;
QStringList str_tens;
for (const Conductor* c : std::as_const(c_list))
for (const Conductor *c : c_list)
{
str_txt << c->properties().text;
str_funct << c->properties().m_function;

View File

@ -74,8 +74,8 @@ m_diagram(diagram)
break;
}
}
for (QPropertyUndoCommand* undo : std::as_const(m_undo))
for (QPropertyUndoCommand *undo : m_undo)
undo->setAnimated(true, false);
}
}
@ -87,8 +87,8 @@ void RotateSelectionCommand::undo()
{
m_diagram->showMe();
QUndoCommand::undo();
for (const QPointer<ConductorTextItem>& cti : std::as_const(m_cond_text))
for(const QPointer<ConductorTextItem>& cti : m_cond_text)
{
cti->forceRotateByUser(m_rotate_by_user.value(cti.data()));
if(!cti->wasRotateByUser())
@ -103,11 +103,11 @@ void RotateSelectionCommand::redo()
{
m_diagram->showMe();
QUndoCommand::redo();
for (const QPointer<ConductorTextItem>& cti : std::as_const(m_cond_text))
{
m_rotate_by_user.insert(cti, cti->wasRotateByUser());
cti->forceRotateByUser(true);
for(const QPointer<ConductorTextItem>& cti : m_cond_text)
{
m_rotate_by_user.insert(cti, cti->wasRotateByUser());
cti->forceRotateByUser(true);
}
}

View File

@ -69,10 +69,10 @@ m_diagram(diagram)
}
if(!text.isNull())
setText(text);
for (DiagramTextItem* dti : std::as_const(texts_list))
for(DiagramTextItem *dti : texts_list)
setupAnimation(dti, "rotation", dti->rotation(), m_rotation);
for (ElementTextItemGroup* grp : std::as_const(groups_list))
for(ElementTextItemGroup *grp : groups_list)
setupAnimation(grp, "rotation", grp->rotation(), m_rotation);
}
else

View File

@ -49,7 +49,7 @@ ConductorCreator::ConductorCreator(Diagram *d, QList<Terminal *> terminals_list)
d->undoStack().beginMacro(QObject::tr("Création de conducteurs"));
QList<Conductor *> c_list;
for (Terminal* t : std::as_const(m_terminals_list))
for (Terminal *t : m_terminals_list)
{
if (t == hub_terminal) {
continue;
@ -108,14 +108,12 @@ void ConductorCreator::setUpPropertieToUse()
if (potentials.size() >= 2)
{
QList <ConductorProperties> cp_list;
for (Conductor* c : std::as_const(potentials))
{
for(Conductor *c : potentials) {
cp_list.append(c->properties());
}
m_properties = PotentialSelectorDialog::chosenProperties(cp_list);
for (Conductor* c : std::as_const(potentials))
{
for (Conductor *c : potentials) {
if (c->properties() == m_properties) {
m_sequential_number = c->sequenceNum();
}
@ -143,8 +141,8 @@ QList<Conductor *> ConductorCreator::existingPotential()
{
QList<Conductor *> c_list;
QList<Terminal *> t_exclude;
for (Terminal* t : std::as_const(m_terminals_list))
for (Terminal *t : m_terminals_list)
{
if (t_exclude.contains(t)) {
continue;
@ -184,8 +182,8 @@ QList<Conductor *> ConductorCreator::existingPotential()
Terminal *ConductorCreator::hubTerminal()
{
Terminal *hub_terminal = m_terminals_list.first();
for (Terminal* tt : std::as_const(m_terminals_list))
for (Terminal *tt : m_terminals_list)
{
if (tt->scenePos().x() < hub_terminal->scenePos().x()) {
hub_terminal = tt;