diff options
author | Petr Mrázek <peterix@gmail.com> | 2021-11-22 03:55:16 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2021-11-22 03:55:16 +0100 |
commit | b258eac215c791b2a8eed10cecbbf9551c87f0b9 (patch) | |
tree | 1ae72f62d344f6a9c982b9dc5d598d32fc742acc /launcher/widgets/IconLabel.cpp | |
parent | 5040231f8d6ca865ea50250509c3315ea0c7400e (diff) | |
download | PrismLauncher-b258eac215c791b2a8eed10cecbbf9551c87f0b9.tar.gz PrismLauncher-b258eac215c791b2a8eed10cecbbf9551c87f0b9.tar.bz2 PrismLauncher-b258eac215c791b2a8eed10cecbbf9551c87f0b9.zip |
NOISSUE continue reshuffling the codebase
Diffstat (limited to 'launcher/widgets/IconLabel.cpp')
-rw-r--r-- | launcher/widgets/IconLabel.cpp | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/launcher/widgets/IconLabel.cpp b/launcher/widgets/IconLabel.cpp deleted file mode 100644 index bf1c2358..00000000 --- a/launcher/widgets/IconLabel.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include "IconLabel.h" - -#include <QStyle> -#include <QStyleOption> -#include <QLayout> -#include <QPainter> -#include <QRect> - -IconLabel::IconLabel(QWidget *parent, QIcon icon, QSize size) - : QWidget(parent), m_size(size), m_icon(icon) -{ - setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); -} - -QSize IconLabel::sizeHint() const -{ - return m_size; -} - -void IconLabel::setIcon(QIcon icon) -{ - m_icon = icon; - update(); -} - -void IconLabel::paintEvent(QPaintEvent *) -{ - QPainter p(this); - QRect rect = contentsRect(); - int width = rect.width(); - int height = rect.height(); - if(width < height) - { - rect.setHeight(width); - rect.translate(0, (height - width) / 2); - } - else if (width > height) - { - rect.setWidth(height); - rect.translate((width - height) / 2, 0); - } - m_icon.paint(&p, rect); -} |