Show building_block icon in header stock, expand button and build costs

This commit is contained in:
2026-07-23 21:13:37 +02:00
parent 0bba7686e6
commit 79b79ab7c3
9 changed files with 313 additions and 18 deletions

16
src/ui/IconCaption.h Normal file
View File

@@ -0,0 +1,16 @@
#pragma once
#include <QColor>
#include <QFont>
#include <QPixmap>
#include <QString>
// Renders `text` followed by `icon` to its right, vertically centered, onto a
// transparent pixmap sized to fit both (REQ-UI-BLOCKS-ICON, REQ-UI-BUILD-COST,
// REQ-UI-EXPAND-BUTTON). Used where a caption must show an inline item icon in
// place of a trailing word — something QPushButton/QLabel cannot do natively.
//
// `textColor` and `font` come from the target widget so the caption stays
// theme-correct; the result is devicePixelRatio-aware so text and icon stay crisp.
QPixmap renderCaptionWithIcon(const QString& text, const QPixmap& icon,
const QFont& font, const QColor& textColor);