Skip to content

Commit

Permalink
qt: Move recentRequestsView properties settings to constructor
Browse files Browse the repository at this point in the history
This is move-only change.
  • Loading branch information
hebasto committed Jan 31, 2021
1 parent 9c5f4f2 commit f5c8093
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/qt/receivecoinsdialog.cpp
Expand Up @@ -62,6 +62,17 @@ ReceiveCoinsDialog::ReceiveCoinsDialog(const PlatformStyle *_platformStyle, QWid
connect(copyAmountAction, &QAction::triggered, this, &ReceiveCoinsDialog::copyAmount);

connect(ui->clearButton, &QPushButton::clicked, this, &ReceiveCoinsDialog::clear);

QTableView* tableView = ui->recentRequestsView;
tableView->verticalHeader()->hide();
tableView->setAlternatingRowColors(true);
tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
tableView->setSelectionMode(QAbstractItemView::ContiguousSelection);
tableView->setColumnWidth(RecentRequestsTableModel::Date, DATE_COLUMN_WIDTH);
tableView->setColumnWidth(RecentRequestsTableModel::Label, LABEL_COLUMN_WIDTH);
tableView->setColumnWidth(RecentRequestsTableModel::Amount, AMOUNT_MINIMUM_COLUMN_WIDTH);
tableView->horizontalHeader()->setMinimumSectionSize(MINIMUM_COLUMN_WIDTH);
tableView->horizontalHeader()->setStretchLastSection(true);
}

void ReceiveCoinsDialog::setModel(WalletModel *_model)
Expand All @@ -75,18 +86,7 @@ void ReceiveCoinsDialog::setModel(WalletModel *_model)
updateDisplayUnit();

QTableView* tableView = ui->recentRequestsView;

tableView->verticalHeader()->hide();
tableView->setModel(_model->getRecentRequestsTableModel());
tableView->setAlternatingRowColors(true);
tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
tableView->setSelectionMode(QAbstractItemView::ContiguousSelection);
tableView->setColumnWidth(RecentRequestsTableModel::Date, DATE_COLUMN_WIDTH);
tableView->setColumnWidth(RecentRequestsTableModel::Label, LABEL_COLUMN_WIDTH);
tableView->setColumnWidth(RecentRequestsTableModel::Amount, AMOUNT_MINIMUM_COLUMN_WIDTH);
tableView->horizontalHeader()->setMinimumSectionSize(MINIMUM_COLUMN_WIDTH);
tableView->horizontalHeader()->setStretchLastSection(true);

connect(tableView->selectionModel(),
&QItemSelectionModel::selectionChanged, this,
&ReceiveCoinsDialog::recentRequestsView_selectionChanged);
Expand Down

0 comments on commit f5c8093

Please sign in to comment.