Revert "Try Clazy fix-its"

Segfault on old Qt versions!
This reverts commit dba7caed30.
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

@@ -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