mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#5902 Fix missing labels due to IconProvider
This commit is contained in:
parent
81571908af
commit
641d6e2384
@ -115,27 +115,39 @@ std::unique_ptr<QIcon> IconProvider::icon(const QSize& size /*= QSize(16, 16)*/)
|
||||
|
||||
QPixmap pixmap(size);
|
||||
|
||||
bool validIcon = false;
|
||||
if (!m_backgroundColorString.isEmpty() && QColor::isValidColor(m_backgroundColorString))
|
||||
{
|
||||
pixmap.fill(QColor(m_backgroundColorString));
|
||||
validIcon = true;
|
||||
}
|
||||
else pixmap.fill(Qt::transparent);
|
||||
|
||||
if (!m_iconResourceString.isEmpty())
|
||||
{
|
||||
QPixmap iconPixmap = QIcon(m_iconResourceString).pixmap(size, m_active ? QIcon::Normal : QIcon::Disabled);
|
||||
QIcon resourceStringIcon(m_iconResourceString);
|
||||
if (!resourceStringIcon.isNull())
|
||||
{
|
||||
QPixmap iconPixmap = resourceStringIcon.pixmap(size, m_active ? QIcon::Normal : QIcon::Disabled);
|
||||
QPainter painter(&pixmap);
|
||||
painter.drawPixmap(0, 0, iconPixmap);
|
||||
validIcon = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_overlayResourceString.isEmpty())
|
||||
{
|
||||
QPixmap overlayPixmap = QIcon(m_overlayResourceString).pixmap(size, m_active ? QIcon::Normal : QIcon::Disabled);
|
||||
QIcon overlayIcon (m_overlayResourceString);
|
||||
if (!overlayIcon.isNull())
|
||||
{
|
||||
QPixmap overlayPixmap = overlayIcon.pixmap(size, m_active ? QIcon::Normal : QIcon::Disabled);
|
||||
QPainter painter(&pixmap);
|
||||
painter.drawPixmap(0, 0, overlayPixmap);
|
||||
validIcon = true;
|
||||
}
|
||||
}
|
||||
|
||||
return std::unique_ptr<QIcon>(new QIcon(pixmap));
|
||||
return validIcon ? std::unique_ptr<QIcon>(new QIcon(pixmap)) : nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user