#include "CountRow.h" #include #include CountRow::CountRow(const QPixmap& symbol, const QString& name, int count, QWidget* parent) : QWidget(parent) { QHBoxLayout* layout = new QHBoxLayout(this); layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(6); m_symbolLabel = new QLabel(this); m_symbolLabel->setPixmap(symbol); m_symbolLabel->setVisible(!symbol.isNull()); m_nameLabel = new QLabel(name, this); // The same "x" notation the recipe tooltip and the header's aggregate count // use (REQ-UI-MULTI-SELECTION). m_countLabel = new QLabel(tr("x%1").arg(count), this); m_countLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter); layout->addWidget(m_symbolLabel); layout->addWidget(m_nameLabel); layout->addStretch(1); layout->addWidget(m_countLabel); }