#pragma once #include #include #include #include #include // 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); // A pixmap's size in device-independent pixels. The pixmaps composed by // renderCaptionWithIcon and its callers are rasterized at the device pixel ratio, so // their raw size is not the size to lay them out at. QSize getLogicalSize(const QPixmap& pixmap); // The items whose icons stand in for their names beside a number, drawn bare and without // their colored square (REQ-UI-ITEM-ICON): building blocks beside a cost or a stock // (REQ-UI-BLOCKS-ICON, REQ-UI-BUILD-COST, REQ-UI-EXPAND-BUTTON), and scrap beside the // amount left in debris (REQ-UI-DEBRIS-PANEL, REQ-UI-FIELD-MULTI-SELECTION). They live // next to the caption helper because every caller of one is a caller of the other; // ItemIconCache::getInlineIcon() is what turns an id here into that icon. const char* const kBlockItemId = "building_block"; const char* const kScrapItemId = "scrap";