Show building_block icon in header stock, expand button and build costs
This commit is contained in:
16
src/ui/IconCaption.h
Normal file
16
src/ui/IconCaption.h
Normal 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);
|
||||
Reference in New Issue
Block a user