mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-07-08 13:08:29 +02:00
clang-tidy: clang-analyzer-*
This commit aims to fix all clang-analyzer-* warnings from clang-tidy.
Here is the list of the ones found in project:
"clang-analyzer-core.uninitialized.UndefReturn",
"clang-analyzer-deadcode.DeadStores",
"clang-analyzer-optin.core.EnumCastOutOfRange",
Some exceptions:
clang-analyzer-cplusplus.NewDeleteLeaks -> may need to disable it as
is a false positive
clang-analyzer-optin.cplusplus.VirtualCall -> may need to disable it
(or refactor a bunch of code to drop the virtual from those functions)
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
parent
323c25d83b
commit
6699d3eca0
11 changed files with 50 additions and 62 deletions
|
|
@ -214,6 +214,8 @@ void ExportToModListDialog::addExtra(ExportToModList::OptionalData option)
|
|||
case ExportToModList::FileName:
|
||||
ui->templateText->insertPlainText("{filename}");
|
||||
break;
|
||||
case ExportToModList::None:
|
||||
break;
|
||||
}
|
||||
}
|
||||
void ExportToModListDialog::enableCustom(bool enabled)
|
||||
|
|
|
|||
|
|
@ -511,8 +511,7 @@ void InstanceView::paintEvent([[maybe_unused]] QPaintEvent* event)
|
|||
|
||||
int wpWidth = viewport()->width();
|
||||
option.rect.setWidth(wpWidth);
|
||||
for (int i = 0; i < m_groups.size(); ++i) {
|
||||
VisualGroup* category = m_groups.at(i);
|
||||
for (auto* category : m_groups) {
|
||||
int y = category->verticalPosition();
|
||||
y -= verticalOffset();
|
||||
QRect backup = option.rect;
|
||||
|
|
@ -522,7 +521,6 @@ void InstanceView::paintEvent([[maybe_unused]] QPaintEvent* event)
|
|||
option.rect.setLeft(m_leftMargin);
|
||||
option.rect.setRight(wpWidth - m_rightMargin);
|
||||
category->drawHeader(&painter, option);
|
||||
y += category->totalHeight() + m_categoryMargin;
|
||||
option.rect = backup;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,9 +56,7 @@ class QGridLayout;
|
|||
class PageContainer : public QWidget, public BasePageContainer {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit PageContainer(BasePageProvider* pageProvider,
|
||||
QString defaultId = QString(),
|
||||
QWidget* parent = nullptr);
|
||||
explicit PageContainer(BasePageProvider* pageProvider, QString defaultId = QString(), QWidget* parent = nullptr);
|
||||
~PageContainer() override = default;
|
||||
|
||||
void addButtons(QWidget* buttons);
|
||||
|
|
|
|||
|
|
@ -47,30 +47,31 @@ void ProjectItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& o
|
|||
painter->setOpacity(0.4); // Fade out the entire item
|
||||
}
|
||||
// The default icon size will be a square (and height is usually the lower value).
|
||||
auto icon_width = rect.height(), icon_height = rect.height();
|
||||
auto icon_width = rect.height();
|
||||
int icon_x_margin = (rect.height() - icon_width) / 2;
|
||||
int icon_y_margin = (rect.height() - icon_height) / 2;
|
||||
|
||||
if (!opt.icon.isNull()) { // Icon painting
|
||||
auto icon_height = 0;
|
||||
{
|
||||
auto icon_size = opt.decorationSize;
|
||||
icon_width = icon_size.width();
|
||||
icon_height = icon_size.height();
|
||||
|
||||
icon_y_margin = (rect.height() - icon_height) / 2;
|
||||
icon_x_margin = icon_y_margin; // use same margins for consistency
|
||||
icon_x_margin = (rect.height() - icon_height) / 2; // use same margins for consistency
|
||||
}
|
||||
|
||||
// Centralize icon with a margin to separate from the other elements
|
||||
int x = rect.x() + icon_x_margin;
|
||||
int y = rect.y() + icon_y_margin;
|
||||
int y = rect.y() + icon_x_margin;
|
||||
|
||||
if (opt.features & QStyleOptionViewItem::HasCheckIndicator)
|
||||
if (opt.features & QStyleOptionViewItem::HasCheckIndicator) {
|
||||
rect.translate(icon_x_margin / 2, 0);
|
||||
}
|
||||
|
||||
// Prevent 'scaling null pixmap' warnings
|
||||
if (icon_width > 0 && icon_height > 0)
|
||||
if (icon_width > 0 && icon_height > 0) {
|
||||
opt.icon.paint(painter, x, y, icon_width, icon_height);
|
||||
}
|
||||
}
|
||||
|
||||
// Change the rect so that funther painting is easier
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue