From 2917c33206d4ee5de3c41f1917441c704b5b7518 Mon Sep 17 00:00:00 2001 From: Konstantin Akimov Date: Tue, 23 Jul 2024 13:11:29 +0700 Subject: [PATCH] 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); --- src/qt/transactionview.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp index 573d91d64f..b51361a646 100644 --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -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(&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);