diff --git a/src/ui/BlueprintSelectionDialog.cpp b/src/ui/BlueprintSelectionDialog.cpp index 6397793..bc5a321 100644 --- a/src/ui/BlueprintSelectionDialog.cpp +++ b/src/ui/BlueprintSelectionDialog.cpp @@ -266,9 +266,7 @@ void BlueprintSelectionDialog::rebuildGrid() // Block icon shown to the right of each cost (REQ-UI-BLUEPRINT-CARD); null when no // building_block icon exists, in which case the cost is the bare number. - const QPixmap blockIcon = m_itemIcons->hasIcon(kBlockItemId) - ? m_itemIcons->getPixmap(kBlockItemId, QFontMetrics(font()).height()) - : QPixmap(); + const QPixmap blockIcon = m_itemIcons->getInlineIcon(kBlockItemId, font()); const QSize cardSize = getCardSize(font()); diff --git a/src/ui/BuildButtonBar.cpp b/src/ui/BuildButtonBar.cpp index 5a30ecd..abf2e7d 100644 --- a/src/ui/BuildButtonBar.cpp +++ b/src/ui/BuildButtonBar.cpp @@ -175,9 +175,7 @@ BuildButtonBar::BuildButtonBar(Simulation* sim, const GameConfig* config, // Block icon shown to the right of each button's cost (REQ-UI-BUILD-COST); null // when no building_block icon exists, in which case the cost is the bare number. - const QPixmap blockIcon = m_itemIcons->hasIcon(kBlockItemId) - ? m_itemIcons->getPixmap(kBlockItemId, QFontMetrics(font()).height()) - : QPixmap(); + const QPixmap blockIcon = m_itemIcons->getInlineIcon(kBlockItemId, font()); for (const BuildingDef& def : config->buildings.buildings) { diff --git a/src/ui/HeaderBar.cpp b/src/ui/HeaderBar.cpp index 406661d..b2af4f6 100644 --- a/src/ui/HeaderBar.cpp +++ b/src/ui/HeaderBar.cpp @@ -3,7 +3,6 @@ #include #include -#include #include #include #include @@ -120,19 +119,11 @@ void HeaderBar::handleEvent(std::shared_ptr /*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). diff --git a/src/ui/HeaderBar.h b/src/ui/HeaderBar.h index 2bb1f87..267797e 100644 --- a/src/ui/HeaderBar.h +++ b/src/ui/HeaderBar.h @@ -61,10 +61,6 @@ private: // (REQ-UI-BLOCKS-ICON). void updateBlocksLabel(); - // The building_block icon at the header's text height, or a null pixmap when no - // icon file exists. Loaded once via m_itemIcons on first use. - QPixmap blockIcon() const; - QLabel* m_timeLabel; QLabel* m_blocksLabel; QLabel* m_artifactsLabel;