30 lines
881 B
C++
30 lines
881 B
C++
#include "CountRow.h"
|
|
|
|
#include <QHBoxLayout>
|
|
#include <QLabel>
|
|
|
|
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<count>" 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);
|
|
}
|