diff options
author | Sefa Eyeoglu <contact@scrumplex.net> | 2023-08-04 19:42:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-04 19:42:36 +0200 |
commit | ae793f6cf11658c9abc5111e82d5ba7b3e6af127 (patch) | |
tree | ed41f30e2c0f02e4be1d42324b3f05fbab75b2cd /launcher/ui/widgets/IconLabel.cpp | |
parent | 50c7d39e082f0a7dbd977401e16d5adf534d9770 (diff) | |
parent | 1d638e018ac40fbfb35dd117f9a948c0cf35eadd (diff) | |
download | PrismLauncher-ae793f6cf11658c9abc5111e82d5ba7b3e6af127.tar.gz PrismLauncher-ae793f6cf11658c9abc5111e82d5ba7b3e6af127.tar.bz2 PrismLauncher-ae793f6cf11658c9abc5111e82d5ba7b3e6af127.zip |
Merge pull request #1459 from Scrumplex/format
Diffstat (limited to 'launcher/ui/widgets/IconLabel.cpp')
-rw-r--r-- | launcher/ui/widgets/IconLabel.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/launcher/ui/widgets/IconLabel.cpp b/launcher/ui/widgets/IconLabel.cpp index bf1c2358..28776686 100644 --- a/launcher/ui/widgets/IconLabel.cpp +++ b/launcher/ui/widgets/IconLabel.cpp @@ -1,13 +1,12 @@ #include "IconLabel.h" -#include <QStyle> -#include <QStyleOption> #include <QLayout> #include <QPainter> #include <QRect> +#include <QStyle> +#include <QStyleOption> -IconLabel::IconLabel(QWidget *parent, QIcon icon, QSize size) - : QWidget(parent), m_size(size), m_icon(icon) +IconLabel::IconLabel(QWidget* parent, QIcon icon, QSize size) : QWidget(parent), m_size(size), m_icon(icon) { setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); } @@ -23,19 +22,16 @@ void IconLabel::setIcon(QIcon icon) update(); } -void IconLabel::paintEvent(QPaintEvent *) +void IconLabel::paintEvent(QPaintEvent*) { QPainter p(this); QRect rect = contentsRect(); int width = rect.width(); int height = rect.height(); - if(width < height) - { + if (width < height) { rect.setHeight(width); rect.translate(0, (height - width) / 2); - } - else if (width > height) - { + } else if (width > height) { rect.setWidth(height); rect.translate((width - height) / 2, 0); } |