give the selection cards their own parts instead of label blobs
This commit is contained in:
29
src/ui/selection/CountRow.cpp
Normal file
29
src/ui/selection/CountRow.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#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);
|
||||
}
|
||||
Reference in New Issue
Block a user