Allow to draw produced-item icons in recipe dialog and game world

This commit is contained in:
2026-07-23 20:54:04 +02:00
parent 8b71fe1a03
commit f766ae4a86
12 changed files with 258 additions and 29 deletions

View File

@@ -20,6 +20,10 @@ struct RecipeSelectionOption
std::string id;
QString caption;
QString tooltip;
// Id of the item whose icon is shown on the option button (REQ-UI-RECIPE-ICON);
// empty for the "(None)" option and for Shipyard schematics, which keep their
// caption. When set but no icon file exists, the button falls back to the caption.
std::string iconItemId;
};
// Builds the lock-aware list of selectable options for a production building
@@ -39,8 +43,12 @@ class RecipeSelectionDialog : public QDialog
Q_OBJECT
public:
// itemIconDir is the directory holding per-item icon SVGs (REQ-UI-ITEM-ICON);
// used to render recipe options icon-only (REQ-UI-RECIPE-ICON). Options whose
// item has no icon file fall back to their caption text.
RecipeSelectionDialog(const std::vector<RecipeSelectionOption>& options,
const QString& title, QWidget* parent = nullptr);
const QString& title, const QString& itemIconDir,
QWidget* parent = nullptr);
std::optional<std::string> getChosenId() const;