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
@ -112,30 +112,42 @@ std::unique_ptr<QIcon> IconProvider::icon(const QSize& size /*= QSize(16, 16)*/)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (m_pixmap) return std::unique_ptr<QIcon>(new QIcon(*m_pixmap));
|
if (m_pixmap) return std::unique_ptr<QIcon>(new QIcon(*m_pixmap));
|
||||||
|
|
||||||
QPixmap pixmap(size);
|
QPixmap pixmap(size);
|
||||||
|
|
||||||
|
bool validIcon = false;
|
||||||
if (!m_backgroundColorString.isEmpty() && QColor::isValidColor(m_backgroundColorString))
|
if (!m_backgroundColorString.isEmpty() && QColor::isValidColor(m_backgroundColorString))
|
||||||
{
|
{
|
||||||
pixmap.fill(QColor(m_backgroundColorString));
|
pixmap.fill(QColor(m_backgroundColorString));
|
||||||
|
validIcon = true;
|
||||||
}
|
}
|
||||||
else pixmap.fill(Qt::transparent);
|
else pixmap.fill(Qt::transparent);
|
||||||
|
|
||||||
if (!m_iconResourceString.isEmpty())
|
if (!m_iconResourceString.isEmpty())
|
||||||
{
|
{
|
||||||
QPixmap iconPixmap = QIcon(m_iconResourceString).pixmap(size, m_active ? QIcon::Normal : QIcon::Disabled);
|
QIcon resourceStringIcon(m_iconResourceString);
|
||||||
QPainter painter(&pixmap);
|
if (!resourceStringIcon.isNull())
|
||||||
painter.drawPixmap(0, 0, iconPixmap);
|
{
|
||||||
|
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())
|
if (!m_overlayResourceString.isEmpty())
|
||||||
{
|
{
|
||||||
QPixmap overlayPixmap = QIcon(m_overlayResourceString).pixmap(size, m_active ? QIcon::Normal : QIcon::Disabled);
|
QIcon overlayIcon (m_overlayResourceString);
|
||||||
QPainter painter(&pixmap);
|
if (!overlayIcon.isNull())
|
||||||
painter.drawPixmap(0, 0, overlayPixmap);
|
{
|
||||||
|
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