mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 05:00:33 +01:00
Try Clazy fix-its
clazy is a compiler plugin which allows clang to understand Qt semantics. You get more than 50 Qt related compiler warnings, ranging from unneeded memory allocations to misusage of API, including fix-its for automatic refactoring. https://invent.kde.org/sdk/clazy
This commit is contained in:
@@ -128,7 +128,7 @@ void SearchAndReplaceWorker::replaceElement(QList<Element *> list)
|
||||
{
|
||||
DiagramContext old_context;
|
||||
DiagramContext new_context = old_context = elmt->elementInformations();
|
||||
for (QString key : QETInformation::elementInfoKeys())
|
||||
for (const 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 : conductors_list)
|
||||
for (Conductor* cc : std::as_const(conductors_list))
|
||||
{
|
||||
QVariant old_value, new_value;
|
||||
old_value.setValue(cc->properties());
|
||||
@@ -270,22 +270,26 @@ void SearchAndReplaceWorker::replaceAdvanced(
|
||||
return;
|
||||
}
|
||||
|
||||
for (Diagram *dd : diagrams) {
|
||||
for (Diagram* dd : std::as_const(diagrams))
|
||||
{
|
||||
if (dd->project() != project_) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (Element *elmt : elements) {
|
||||
for (Element* elmt : std::as_const(elements))
|
||||
{
|
||||
if (!elmt->diagram() || elmt->diagram()->project() != project_) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (IndependentTextItem *text : texts) {
|
||||
for (IndependentTextItem* text : std::as_const(texts))
|
||||
{
|
||||
if (!text->diagram() || text->diagram()->project() != project_) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
for (Conductor *cc : conductors) {
|
||||
for (Conductor* cc : std::as_const(conductors))
|
||||
{
|
||||
if (!cc->diagram() || cc->diagram()->project() != project_) {
|
||||
return;
|
||||
}
|
||||
@@ -300,7 +304,7 @@ void SearchAndReplaceWorker::replaceAdvanced(
|
||||
project_->undoStack()->beginMacro(QObject::tr("Rechercher / remplacer avancé"));
|
||||
if (who == 0)
|
||||
{
|
||||
for (Diagram *diagram : diagrams)
|
||||
for (Diagram* diagram : std::as_const(diagrams))
|
||||
{
|
||||
TitleBlockProperties old_properties = diagram->border_and_titleblock.exportTitleBlock();
|
||||
TitleBlockProperties new_properties = replaceAdvanced(diagram);
|
||||
@@ -311,7 +315,7 @@ void SearchAndReplaceWorker::replaceAdvanced(
|
||||
}
|
||||
else if (who == 1)
|
||||
{
|
||||
for (Element *element : elements)
|
||||
for (Element* element : std::as_const(elements))
|
||||
{
|
||||
DiagramContext old_context = element->elementInformations();
|
||||
DiagramContext new_context = replaceAdvanced(element);
|
||||
@@ -322,7 +326,7 @@ void SearchAndReplaceWorker::replaceAdvanced(
|
||||
}
|
||||
else if (who == 2)
|
||||
{
|
||||
for (Conductor *conductor : conductors)
|
||||
for (Conductor* conductor : std::as_const(conductors))
|
||||
{
|
||||
ConductorProperties old_properties = conductor->properties();
|
||||
ConductorProperties new_properties = replaceAdvanced(conductor);
|
||||
@@ -331,7 +335,7 @@ void SearchAndReplaceWorker::replaceAdvanced(
|
||||
QSet <Conductor *> potential_conductors = conductor->relatedPotentialConductors(true);
|
||||
potential_conductors << conductor;
|
||||
|
||||
for (Conductor *c : potential_conductors)
|
||||
for (Conductor* c : std::as_const(potential_conductors))
|
||||
{
|
||||
QVariant old_value, new_value;
|
||||
old_value.setValue(c->properties());
|
||||
@@ -343,7 +347,7 @@ void SearchAndReplaceWorker::replaceAdvanced(
|
||||
}
|
||||
else if (who == 3)
|
||||
{
|
||||
for (IndependentTextItem *text : texts)
|
||||
for (IndependentTextItem* text : std::as_const(texts))
|
||||
{
|
||||
QRegularExpression rx(m_advanced_struct.search);
|
||||
if (!rx.isValid())
|
||||
|
||||
Reference in New Issue
Block a user