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

@@ -214,7 +214,7 @@ void ElementTextItemGroup::updateAlignment()
else if (texts.size() > 1)
{
qreal width = 0;
for(QGraphicsItem *item : texts)
for (QGraphicsItem* item : std::as_const(texts))
if(item->boundingRect().width() > width)
width = item->boundingRect().width();
@@ -226,8 +226,8 @@ void ElementTextItemGroup::updateAlignment()
if(m_alignment == Qt::AlignLeft)
{
QPointF ref = texts.first()->pos();
for(QGraphicsItem *item : texts)
for (QGraphicsItem* item : std::as_const(texts))
{
item->setPos(0, ref.y()+y_offset);
y_offset+=item->boundingRect().height() + m_vertical_adjustment;
@@ -236,8 +236,8 @@ void ElementTextItemGroup::updateAlignment()
else if(m_alignment == Qt::AlignVCenter)
{
QPointF ref(width/2,0);
for(QGraphicsItem *item : texts)
for (QGraphicsItem* item : std::as_const(texts))
{
item->setPos(ref.x() - item->boundingRect().width()/2,
ref.y() + y_offset);
@@ -247,8 +247,8 @@ void ElementTextItemGroup::updateAlignment()
else if (m_alignment == Qt::AlignRight)
{
QPointF ref(width,0);
for(QGraphicsItem *item : texts)
for (QGraphicsItem* item : std::as_const(texts))
{
item->setPos(ref.x() - item->boundingRect().width(),
ref.y() + y_offset);