color item icon backgrounds in the UI from visuals.toml
This commit is contained in:
@@ -8,8 +8,9 @@
|
||||
namespace
|
||||
{
|
||||
|
||||
// Size the item icon is drawn at inside a chip, in device-independent pixels.
|
||||
const int kChipIconSizePx = 18;
|
||||
// Size the item's colored square is drawn at inside a chip, in device-independent
|
||||
// pixels. Larger than the artwork it carries, which the square insets (REQ-UI-ITEM-ICON).
|
||||
const int kChipIconSizePx = 22;
|
||||
|
||||
// Chips per row. Two fit the panel's capped width side by side; a third would force the
|
||||
// counts to shrink.
|
||||
@@ -64,11 +65,10 @@ void ItemChipRow::rebuildChips(const std::vector<Entry>& entries)
|
||||
for (std::size_t index = 0; index < entries.size(); ++index)
|
||||
{
|
||||
const std::string& itemId = entries[index].itemId;
|
||||
// A missing icon file is not an error (REQ-UI-ITEM-ICON): the chip is then laid
|
||||
// out around its count alone.
|
||||
const QPixmap icon = m_itemIcons->hasIcon(itemId)
|
||||
? m_itemIcons->getPixmap(itemId, kChipIconSizePx)
|
||||
: QPixmap();
|
||||
// The item's icon on its colored square (REQ-UI-ITEM-ICON). A missing icon file
|
||||
// is not an error: the chip then carries the square alone, and only an item with
|
||||
// no square either leaves the chip laid out around its count alone.
|
||||
const QPixmap icon = m_itemIcons->getSquarePixmap(itemId, kChipIconSizePx);
|
||||
|
||||
ItemChip* chip = new ItemChip(icon, this);
|
||||
m_layout->addWidget(chip, static_cast<int>(index) / kChipsPerRow,
|
||||
|
||||
Reference in New Issue
Block a user