color item icon backgrounds in the UI from visuals.toml
This commit is contained in:
@@ -127,12 +127,17 @@ RecipeSelectionDialog::RecipeSelectionDialog(
|
||||
const RecipeSelectionOption& option = options[static_cast<std::size_t>(i)];
|
||||
|
||||
QPushButton* button = new QPushButton(this);
|
||||
// Icon-only when the produced item has an icon (REQ-UI-RECIPE-ICON); otherwise
|
||||
// fall back to the caption. The name stays reachable via the tooltip.
|
||||
if (!option.iconItemId.empty() && itemIcons->hasIcon(option.iconItemId))
|
||||
// Icon-only for a recipe option: the produced item's icon on its colored square,
|
||||
// or the square alone when the item has no icon file (REQ-UI-RECIPE-ICON). The
|
||||
// name stays reachable via the tooltip. Options carrying no item at all -- the
|
||||
// "(None)" entry and the Shipyard's schematics -- keep their text caption, as
|
||||
// does an item with neither square nor icon to show.
|
||||
const QPixmap icon = option.iconItemId.empty()
|
||||
? QPixmap()
|
||||
: itemIcons->getSquarePixmap(option.iconItemId, kOptionIconSize.width());
|
||||
if (!icon.isNull())
|
||||
{
|
||||
button->setIcon(QIcon(itemIcons->getPixmap(
|
||||
option.iconItemId, kOptionIconSize.width())));
|
||||
button->setIcon(QIcon(icon));
|
||||
button->setIconSize(kOptionIconSize);
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user