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

@@ -98,7 +98,7 @@ void CrossRefItem::init()
*/
void CrossRefItem::setUpConnection()
{
for(const QMetaObject::Connection& c : m_update_connection)
for (const QMetaObject::Connection& c : std::as_const(m_update_connection))
disconnect(c);
m_update_connection.clear();
@@ -424,7 +424,7 @@ void CrossRefItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
*/
void CrossRefItem::linkedChanged()
{
for(const QMetaObject::Connection& c : m_slave_connection)
for (const QMetaObject::Connection& c : std::as_const(m_slave_connection))
disconnect(c);
m_slave_connection.clear();
@@ -524,7 +524,7 @@ void CrossRefItem::setUpCrossBoundingRect(QPainter &painter)
//Bounding rect of the NO text
QRectF no_bounding;
for (auto str : no_str)
for (const auto& str : no_str)
{
QRectF bounding = painter.boundingRect(QRectF (), Qt::AlignCenter, str);
no_bounding = no_bounding.united(bounding);
@@ -538,7 +538,7 @@ void CrossRefItem::setUpCrossBoundingRect(QPainter &painter)
//Bounding rect of the NC text
QRectF nc_bounding;
for (auto str : nc_str)
for (const auto& str : nc_str)
{
QRectF bounding = painter.boundingRect(QRectF (), Qt::AlignCenter, str);
nc_bounding = nc_bounding.united(bounding);