partial Merge bitcoin-core/gui#205: Save/restore TransactionView and recentRequestsView tables column sizes

We use Stretched column width, it's not compatible with gui#205
Though, this type of columns have better UI, but it is very slow performance,
see https://github.com/dashpay/dash/pull/6111#pullrequestreview-2178370404

    -tableView->horizontalHeader()->setSectionResizeMode(RecentRequestsTableModel::Date, QHeaderView::Interactive);
    -tableView->horizontalHeader()->setSectionResizeMode(RecentRequestsTableModel::Label, QHeaderView::Stretch);
    +tableView->horizontalHeader()->setSectionResizeMode(RecentRequestsTableModel::Date, QHeaderView::ResizeToContents);
    +tableView->horizontalHeader()->setSectionResizeMode(RecentRequestsTableModel::Label, QHeaderView::Interactive);
     tableView->horizontalHeader()->setSectionResizeMode(RecentRequestsTableModel::Message, QHeaderView::Stretch);
    -tableView->horizontalHeader()->setSectionResizeMode(RecentRequestsTableModel::Amount, QHeaderView::Fixed);
    +tableView->horizontalHeader()->setSectionResizeMode(RecentRequestsTableModel::Amount, QHeaderView::ResizeToContents);
This commit is contained in:
Konstantin Akimov 2024-07-23 13:11:29 +07:00
parent e5c2c03984
commit 2917c33206
No known key found for this signature in database
GPG Key ID: 2176C4A5D01EA524

View File

@ -126,24 +126,23 @@ TransactionView::TransactionView(QWidget* parent) :
vlayout->setContentsMargins(0,0,0,0);
vlayout->setSpacing(0);
QTableView *view = new QTableView(this);
transactionView = new QTableView(this);
vlayout->addLayout(hlayout);
vlayout->addWidget(createDateRangeWidget());
vlayout->addWidget(view);
vlayout->addWidget(transactionView);
vlayout->setSpacing(0);
#ifndef Q_OS_MAC
int width = view->verticalScrollBar()->sizeHint().width();
int width = transactionView->verticalScrollBar()->sizeHint().width();
// Cover scroll bar width with spacing
hlayout->addSpacing(width);
// Always show scroll bar
view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
transactionView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
#endif
view->setTabKeyNavigation(false);
view->setContextMenuPolicy(Qt::CustomContextMenu);
transactionView->setTabKeyNavigation(false);
transactionView->setContextMenuPolicy(Qt::CustomContextMenu);
view->installEventFilter(this);
transactionView->installEventFilter(this);
transactionView = view;
transactionView->setObjectName("transactionView");
// Actions
@ -185,9 +184,9 @@ TransactionView::TransactionView(QWidget* parent) :
connect(search_widget, &QLineEdit::textChanged, prefix_typing_delay, static_cast<void (QTimer::*)()>(&QTimer::start));
connect(prefix_typing_delay, &QTimer::timeout, this, &TransactionView::changedSearch);
connect(view, &QTableView::doubleClicked, this, &TransactionView::doubleClicked);
connect(view, &QTableView::clicked, this, &TransactionView::computeSum);
connect(view, &QTableView::customContextMenuRequested, this, &TransactionView::contextualMenu);
connect(transactionView, &QTableView::doubleClicked, this, &TransactionView::doubleClicked);
connect(transactionView, &QTableView::clicked, this, &TransactionView::computeSum);
connect(transactionView, &QTableView::customContextMenuRequested, this, &TransactionView::contextualMenu);
connect(abandonAction, &QAction::triggered, this, &TransactionView::abandonTx);
connect(resendAction, &QAction::triggered, this, &TransactionView::resendTx);