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

@@ -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("#C0FFFF");
background_color = QColor(0xC0FFFF);
foreground_color = Qt::black;
} else if (type == QET::RelativeToTotalLength) {
background_color = QColor("#FFA858");
background_color = QColor(0xFFA858);
foreground_color = Qt::black;
} else if (type == QET::RelativeToRemainingLength) {
background_color = QColor("#FFC0C0");
background_color = QColor(0xFFC0C0);
foreground_color = Qt::black;
}
}

View File

@@ -82,14 +82,15 @@ 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()).arg(message);
QString error_message =
QString("Une erreur s'est produite avec le modèle %1 : %2")
.arg(tbt.toString(), message);
QET::QetMessageBox::critical(
parent_widget_,
tr("Erreur", "message box title"),
error_message,
QMessageBox::Ok,
QMessageBox::Ok
);
QMessageBox::Ok);
return(QET::Ignore);
}
@@ -116,7 +117,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()).arg(dateString()));
return (QString("%1-%2.elmt").arg(tbt.name(), dateString()));
}
/**

View File

@@ -620,12 +620,11 @@ 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).arg(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);
}
return(titleblock_title);
@@ -725,12 +724,10 @@ 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).arg(titleblock_title);
title = QString(tr("%1 - %2",
"window title: %1 is the base window title, %2 is a "
"template name"))
.arg(min_title, 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).arg(TITLEBLOCKS_FILE_EXTENSION));
return (QString("%1%2").arg(template_name, TITLEBLOCKS_FILE_EXTENSION));
}
/**

View File

@@ -1150,11 +1150,10 @@ 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).arg(string);
QString final_tooltip_content =
QString("<div style=\"%1\">%2</div>").arg(css_style, string);
return(final_tooltip_content);
return (final_tooltip_content);
}
/**