From 8f7aec032b11a2e2b3034c9d9719a74726dad130 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sun, 26 Oct 2014 23:44:20 +0100 Subject: Add dark, light, blue and colored theme from pe. Replaces the old dark and light themes --- gui/widgets/IconLabel.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'gui/widgets') 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); } -- cgit v1.2.3