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:
Laurent Trinques
2025-02-14 15:52:23 +01:00
parent adcf77e34a
commit dba7caed30
88 changed files with 512 additions and 409 deletions

View File

@@ -75,9 +75,7 @@ GraphicsTablePropertiesEditor::~GraphicsTablePropertiesEditor()
void GraphicsTablePropertiesEditor::setTable(QetGraphicsTableItem *table)
{
if (m_table_item) {
for (auto c : m_connect_list) {
disconnect(c);
}
for (const auto& c : std::as_const(m_connect_list)) { disconnect(c); }
if (m_current_model_editor)
{
ui->m_content_layout->removeWidget(m_current_model_editor);
@@ -308,9 +306,11 @@ 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 (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();
ui->m_next_pb->setEnabled(m_table_item->nextTable());
@@ -433,7 +433,8 @@ void GraphicsTablePropertiesEditor::updateInfoLabel()
*/
void GraphicsTablePropertiesEditor::setUpEditConnection()
{
for (QMetaObject::Connection c : m_edit_connection) {
for (const QMetaObject::Connection& c : std::as_const(m_edit_connection))
{
disconnect(c);
}
@@ -542,7 +543,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 : vector_)
for (auto table : std::as_const(vector_))
{
new QPropertyUndoCommand(table, "pos", table->pos(), new_pos, parent_undo);
new QPropertyUndoCommand(table, "size", table->size(), new_size, parent_undo);