ask the icon cache for the inline block icon
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
#include <cmath>
|
||||
#include <string>
|
||||
|
||||
#include <QFontMetrics>
|
||||
#include <QHBoxLayout>
|
||||
#include <QIcon>
|
||||
#include <QLabel>
|
||||
@@ -120,19 +119,11 @@ void HeaderBar::handleEvent(std::shared_ptr<const ExpansionCostChangedEvent> /*e
|
||||
updateExpandButton();
|
||||
}
|
||||
|
||||
QPixmap HeaderBar::blockIcon() const
|
||||
{
|
||||
if (!m_itemIcons->hasIcon(kBlockItemId)) { return QPixmap(); }
|
||||
// Sized to the header text height so it sits inline with the caption.
|
||||
const int sizePx = QFontMetrics(font()).height();
|
||||
return m_itemIcons->getPixmap(kBlockItemId, sizePx);
|
||||
}
|
||||
|
||||
void HeaderBar::updateBlocksLabel()
|
||||
{
|
||||
const int blocks = m_sim->getBuildingBlocksStock();
|
||||
|
||||
const QPixmap icon = blockIcon();
|
||||
const QPixmap icon = m_itemIcons->getInlineIcon(kBlockItemId, font());
|
||||
if (icon.isNull())
|
||||
{
|
||||
// Fallback text form when no building_block icon exists (REQ-UI-BLOCKS-ICON).
|
||||
@@ -151,7 +142,7 @@ void HeaderBar::updateExpandButton()
|
||||
|
||||
m_expandButton->setEnabled(blocks >= expansionCost);
|
||||
|
||||
const QPixmap icon = blockIcon();
|
||||
const QPixmap icon = m_itemIcons->getInlineIcon(kBlockItemId, font());
|
||||
if (icon.isNull())
|
||||
{
|
||||
// Fallback text form when no building_block icon exists (REQ-UI-EXPAND-BUTTON).
|
||||
|
||||
Reference in New Issue
Block a user