Receive: show address index

This commit is contained in:
tobtoht 2023-03-07 21:36:15 +01:00
parent b93d61a164
commit 371aef9de0
No known key found for this signature in database
GPG key ID: E45B10DD027D2472
3 changed files with 11 additions and 4 deletions

View file

@ -26,9 +26,9 @@ ReceiveWidget::ReceiveWidget(Wallet *wallet, QWidget *parent)
ui->addresses->setModel(m_proxyModel);
ui->addresses->setColumnHidden(SubaddressModel::isUsed, true);
ui->addresses->header()->setSectionResizeMode(SubaddressModel::Address, QHeaderView::Stretch);
ui->addresses->header()->setSectionResizeMode(SubaddressModel::Label, QHeaderView::ResizeToContents);
ui->addresses->header()->setMinimumSectionSize(200);
ui->addresses->header()->setSectionResizeMode(SubaddressModel::Index, QHeaderView::ResizeToContents);
ui->addresses->header()->setSectionResizeMode(SubaddressModel::Address, QHeaderView::ResizeToContents);
ui->addresses->header()->setSectionResizeMode(SubaddressModel::Label, QHeaderView::Stretch);
connect(ui->addresses->selectionModel(), &QItemSelectionModel::currentChanged, [=](QModelIndex current, QModelIndex prev){
this->updateQrCode();

View file

@ -96,6 +96,10 @@ QVariant SubaddressModel::data(const QModelIndex &index, int role) const
QVariant SubaddressModel::parseSubaddressRow(const Monero::SubaddressRow &subaddress, const QModelIndex &index, int role) const
{
switch (index.column()) {
case Index:
{
return "#" + QString::number(subaddress.getRowId());
}
case Address:
{
QString address = QString::fromStdString(subaddress.getAddress());
@ -123,6 +127,8 @@ QVariant SubaddressModel::headerData(int section, Qt::Orientation orientation, i
if (orientation == Qt::Horizontal)
{
switch(section) {
case Index:
return QString("#");
case Address:
return QString("Address");
case Label:

View file

@ -19,7 +19,8 @@ class SubaddressModel : public QAbstractTableModel
public:
enum ModelColumn
{
Address = 0,
Index = 0,
Address,
Label,
isUsed,
COUNT