summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2017-11-14 01:03:32 +0100
committerPetr Mrázek <peterix@gmail.com>2017-11-14 01:03:32 +0100
commitb000b336615030b1c6889b1adf0703d06a163550 (patch)
treece6015d10c9aeb066c40b9084d34eaf8e2c76846
parent322922e013d310ee4de2fef402d20b1be4f1e07a (diff)
downloadMultiMC-b000b336615030b1c6889b1adf0703d06a163550.tar
MultiMC-b000b336615030b1c6889b1adf0703d06a163550.tar.gz
MultiMC-b000b336615030b1c6889b1adf0703d06a163550.tar.lz
MultiMC-b000b336615030b1c6889b1adf0703d06a163550.tar.xz
MultiMC-b000b336615030b1c6889b1adf0703d06a163550.zip
NOISSUE fix display of svg icons in instance toolbar
-rw-r--r--application/widgets/LabeledToolButton.cpp32
1 files changed, 13 insertions, 19 deletions
diff --git a/application/widgets/LabeledToolButton.cpp b/application/widgets/LabeledToolButton.cpp
index b5b2f78e..11c2a8ff 100644
--- a/application/widgets/LabeledToolButton.cpp
+++ b/application/widgets/LabeledToolButton.cpp
@@ -99,23 +99,17 @@ void LabeledToolButton::resizeEvent(QResizeEvent * event)
void LabeledToolButton::resetIcon()
{
- // prevent the label from changing our height
- auto sizes = m_icon.availableSizes();
- if(sizes.count() > 0)
- {
- //auto maxSz = size();
- auto iconSz = sizes[0];
- float w = iconSz.width();
- float h = iconSz.height();
- float ar = w/h;
- // FIXME: hardcoded max size of 160x80
- int newW = 80 * ar;
- if(newW > 160)
- newW = 160;
- QSize newSz (newW, 80);
- auto pixmap = m_icon.pixmap(newSz);
- m_label->setPixmap(pixmap);
- m_label->setMinimumHeight(80);
- m_label->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred );
- }
+ auto iconSz = m_icon.actualSize(QSize(160, 80));
+ float w = iconSz.width();
+ float h = iconSz.height();
+ float ar = w/h;
+ // FIXME: hardcoded max size of 160x80
+ int newW = 80 * ar;
+ if(newW > 160)
+ newW = 160;
+ QSize newSz (newW, 80);
+ auto pixmap = m_icon.pixmap(newSz);
+ m_label->setPixmap(pixmap);
+ m_label->setMinimumHeight(80);
+ m_label->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred );
}