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

@@ -158,7 +158,7 @@ bool ElementInfoWidget::event(QEvent *event)
*/
void ElementInfoWidget::enableLiveEdit()
{
for (ElementInfoPartWidget *eipw : m_eipw_list)
for (ElementInfoPartWidget* eipw : std::as_const(m_eipw_list))
connect(eipw, &ElementInfoPartWidget::textChanged, this, &ElementInfoWidget::apply);
}
@@ -168,7 +168,7 @@ void ElementInfoWidget::enableLiveEdit()
*/
void ElementInfoWidget::disableLiveEdit()
{
for (ElementInfoPartWidget *eipw : m_eipw_list)
for (ElementInfoPartWidget* eipw : std::as_const(m_eipw_list))
disconnect(eipw, &ElementInfoPartWidget::textChanged, this, &ElementInfoWidget::apply);
}
@@ -185,11 +185,14 @@ void ElementInfoWidget::buildInterface()
keys = QETInformation::elementInfoKeys();
}
for (auto str : keys)
{
ElementInfoPartWidget *eipw = new ElementInfoPartWidget(str, QETInformation::translatedInfoKey(str), this);
ui->scroll_vlayout->addWidget(eipw);
m_eipw_list << eipw;
for (const auto& str : std::as_const(keys))
{
ElementInfoPartWidget* eipw = new ElementInfoPartWidget(
str,
QETInformation::translatedInfoKey(str),
this);
ui->scroll_vlayout->addWidget(eipw);
m_eipw_list << eipw;
}
ui->scroll_vlayout->addStretch();
@@ -227,8 +230,9 @@ void ElementInfoWidget::updateUi()
if (m_live_edit) disableLiveEdit();
const auto element_info{m_element->elementInformations()};
for (ElementInfoPartWidget *eipw : m_eipw_list) {
for (ElementInfoPartWidget* eipw : std::as_const(m_eipw_list))
{
eipw -> setText (element_info[eipw->key()].toString());
}