ask the icon cache for the inline block icon
The three block-icon call sites each spelled out the same expression that ItemIconCache::getInlineIcon() now is: the bare icon at the line's text height, null when the file is missing. They call the helper instead, and HeaderBar::blockIcon() -- which was that expression and nothing else -- is gone along with its stale "loaded once on first use" comment. Each site still passes its own widget font, so nothing about the sizing changes; the rule now lives in one place rather than four. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ne3mejABZoLWKLh8fgpM3x
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user