mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 15:09:59 +01:00
qt: Drop buggy TableViewLastColumnResizingFixer class
In Qt 5 the last column resizing with dragging its left edge works out-of-the-box. The current TableViewLastColumnResizingFixer implementation could put the last column content out of the view port and confuse a user.
This commit is contained in:
@@ -24,7 +24,6 @@
|
||||
ReceiveCoinsDialog::ReceiveCoinsDialog(const PlatformStyle *_platformStyle, QWidget *parent) :
|
||||
QDialog(parent, GUIUtil::dialog_flags),
|
||||
ui(new Ui::ReceiveCoinsDialog),
|
||||
columnResizingFixer(nullptr),
|
||||
model(nullptr),
|
||||
platformStyle(_platformStyle)
|
||||
{
|
||||
@@ -78,7 +77,6 @@ void ReceiveCoinsDialog::setModel(WalletModel *_model)
|
||||
QTableView* tableView = ui->recentRequestsView;
|
||||
|
||||
tableView->verticalHeader()->hide();
|
||||
tableView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
tableView->setModel(_model->getRecentRequestsTableModel());
|
||||
tableView->setAlternatingRowColors(true);
|
||||
tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
@@ -86,12 +84,12 @@ void ReceiveCoinsDialog::setModel(WalletModel *_model)
|
||||
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);
|
||||
// Last 2 columns are set by the columnResizingFixer, when the table geometry is ready.
|
||||
columnResizingFixer = new GUIUtil::TableViewLastColumnResizingFixer(tableView, AMOUNT_MINIMUM_COLUMN_WIDTH, DATE_COLUMN_WIDTH, this);
|
||||
|
||||
if (model->wallet().getDefaultAddressType() == OutputType::BECH32) {
|
||||
ui->useBech32->setCheckState(Qt::Checked);
|
||||
@@ -235,14 +233,6 @@ void ReceiveCoinsDialog::on_removeRequestButton_clicked()
|
||||
model->getRecentRequestsTableModel()->removeRows(firstIndex.row(), selection.length(), firstIndex.parent());
|
||||
}
|
||||
|
||||
// We override the virtual resizeEvent of the QWidget to adjust tables column
|
||||
// sizes as the tables width is proportional to the dialogs width.
|
||||
void ReceiveCoinsDialog::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
QWidget::resizeEvent(event);
|
||||
columnResizingFixer->stretchColumnWidth(RecentRequestsTableModel::Message);
|
||||
}
|
||||
|
||||
QModelIndex ReceiveCoinsDialog::selectedRow()
|
||||
{
|
||||
if(!model || !model->getRecentRequestsTableModel() || !ui->recentRequestsView->selectionModel())
|
||||
|
||||
Reference in New Issue
Block a user