summaryrefslogtreecommitdiffstats
path: root/gui/widgets/IconLabel.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2014-10-26 23:44:20 +0100
committerPetr Mrázek <peterix@gmail.com>2014-10-26 23:44:20 +0100
commit8f7aec032b11a2e2b3034c9d9719a74726dad130 (patch)
tree607355469c2305aca17e40af49d85f0365c30f4f /gui/widgets/IconLabel.cpp
parent92560bf0cd8bab77405081f30711a32282e29ba2 (diff)
downloadMultiMC-8f7aec032b11a2e2b3034c9d9719a74726dad130.tar
MultiMC-8f7aec032b11a2e2b3034c9d9719a74726dad130.tar.gz
MultiMC-8f7aec032b11a2e2b3034c9d9719a74726dad130.tar.lz
MultiMC-8f7aec032b11a2e2b3034c9d9719a74726dad130.tar.xz
MultiMC-8f7aec032b11a2e2b3034c9d9719a74726dad130.zip
Add dark, light, blue and colored theme from pe.
Replaces the old dark and light themes
Diffstat (limited to 'gui/widgets/IconLabel.cpp')
-rw-r--r--gui/widgets/IconLabel.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/gui/widgets/IconLabel.cpp b/gui/widgets/IconLabel.cpp
index 773f0b99..86c8a431 100644
--- a/gui/widgets/IconLabel.cpp
+++ b/gui/widgets/IconLabel.cpp
@@ -26,5 +26,18 @@ void IconLabel::setIcon(QIcon icon)
void IconLabel::paintEvent(QPaintEvent *)
{
QPainter p(this);
- m_icon.paint(&p, contentsRect());
+ 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);
}