mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-21 16:50:53 +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:
@@ -51,7 +51,9 @@ DynamicTextFieldEditor::~DynamicTextFieldEditor()
|
||||
{
|
||||
delete ui;
|
||||
if(!m_connection_list.isEmpty()) {
|
||||
for(const QMetaObject::Connection& con : m_connection_list) {
|
||||
for (const QMetaObject::Connection& con :
|
||||
std::as_const(m_connection_list))
|
||||
{
|
||||
disconnect(con);
|
||||
}
|
||||
}
|
||||
@@ -203,7 +205,8 @@ void DynamicTextFieldEditor::disconnectConnections()
|
||||
{
|
||||
//Remove previous connection
|
||||
if(!m_connection_list.isEmpty())
|
||||
for(const auto &connection : m_connection_list) {
|
||||
for (const auto& connection : std::as_const(m_connection_list))
|
||||
{
|
||||
disconnect(connection);
|
||||
}
|
||||
m_connection_list.clear();
|
||||
|
||||
@@ -171,7 +171,8 @@ void EllipseEditor::setUpChangeConnections()
|
||||
*/
|
||||
void EllipseEditor::disconnectChangeConnections()
|
||||
{
|
||||
for (QMetaObject::Connection c : m_change_connections) {
|
||||
for (const QMetaObject::Connection& c : std::as_const(m_change_connections))
|
||||
{
|
||||
disconnect(c);
|
||||
}
|
||||
m_change_connections.clear();
|
||||
|
||||
@@ -223,7 +223,8 @@ void LineEditor::setUpChangeConnections()
|
||||
*/
|
||||
void LineEditor::disconnectChangeConnections()
|
||||
{
|
||||
for (auto connection : m_change_connections) {
|
||||
for (const auto& connection : std::as_const(m_change_connections))
|
||||
{
|
||||
disconnect(connection);
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,8 @@ void PolygonEditor::setUpChangeConnections()
|
||||
|
||||
void PolygonEditor::disconnectChangeConnections()
|
||||
{
|
||||
for (QMetaObject::Connection c : m_change_connections) {
|
||||
for (const QMetaObject::Connection& c : std::as_const(m_change_connections))
|
||||
{
|
||||
disconnect(c);
|
||||
}
|
||||
m_change_connections.clear();
|
||||
|
||||
@@ -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: selected_qgis)
|
||||
for (QGraphicsItem* qgi : std::as_const(selected_qgis))
|
||||
{
|
||||
if (CustomElementPart *cep = dynamic_cast<CustomElementPart *>(qgi)) {
|
||||
cep_list << cep;
|
||||
@@ -582,9 +582,11 @@ void QETElementEditor::updateInformations()
|
||||
bool equal = true;
|
||||
QList<CustomElementPart*> parts = editor -> currentParts();
|
||||
if (parts.length() == cep_list.length()) {
|
||||
for (auto cep: cep_list) {
|
||||
for (auto cep : std::as_const(cep_list))
|
||||
{
|
||||
bool part_found = false;
|
||||
for (auto part: parts) {
|
||||
for (auto part : std::as_const(parts))
|
||||
{
|
||||
if (part == cep) {
|
||||
part_found = true;
|
||||
break;
|
||||
@@ -789,12 +791,12 @@ bool QETElementEditor::checkElement()
|
||||
|
||||
dialog_message += "<ol>";
|
||||
QList<QETWarning> total = warnings << errors;
|
||||
for(QETWarning warning : total)
|
||||
for (const QETWarning& warning : total)
|
||||
{
|
||||
dialog_message += "<li>";
|
||||
dialog_message += QString(
|
||||
tr("<b>%1</b> : %2", "warning title: warning description")
|
||||
).arg(warning.first).arg(warning.second);
|
||||
dialog_message +=
|
||||
QString(tr("<b>%1</b> : %2", "warning title: warning description"))
|
||||
.arg(warning.first, warning.second);
|
||||
dialog_message += "</li>";
|
||||
}
|
||||
dialog_message += "</ol>";
|
||||
|
||||
@@ -59,7 +59,8 @@ void RectangleEditor::setUpChangeConnections()
|
||||
|
||||
void RectangleEditor::disconnectChangeConnections()
|
||||
{
|
||||
for (QMetaObject::Connection c : m_change_connections) {
|
||||
for (const QMetaObject::Connection& c : std::as_const(m_change_connections))
|
||||
{
|
||||
disconnect(c);
|
||||
}
|
||||
m_change_connections.clear();
|
||||
|
||||
@@ -92,8 +92,9 @@ void TextEditor::disconnectChangeConnection()
|
||||
|
||||
void TextEditor::disconnectEditConnection()
|
||||
{
|
||||
for (QMetaObject::Connection c : m_edit_connection) {
|
||||
disconnect(c);
|
||||
for (const QMetaObject::Connection& c : std::as_const(m_edit_connection))
|
||||
{
|
||||
disconnect(c);
|
||||
}
|
||||
m_edit_connection.clear();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user