mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 10:38:42 +01:00
qt: Save/restore TransactionView table column sizes
Sorting order is not saved/restored intentionally.
This commit is contained in:
parent
788205c3f7
commit
9c5f4f2169
@ -31,6 +31,7 @@
|
|||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
|
#include <QSettings>
|
||||||
#include <QTableView>
|
#include <QTableView>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
@ -146,17 +147,20 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa
|
|||||||
transactionView->setAlternatingRowColors(true);
|
transactionView->setAlternatingRowColors(true);
|
||||||
transactionView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
transactionView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||||
transactionView->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
transactionView->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||||
transactionView->horizontalHeader()->setSortIndicator(TransactionTableModel::Date, Qt::DescendingOrder);
|
|
||||||
transactionView->setSortingEnabled(true);
|
transactionView->setSortingEnabled(true);
|
||||||
transactionView->verticalHeader()->hide();
|
transactionView->verticalHeader()->hide();
|
||||||
|
|
||||||
transactionView->setColumnWidth(TransactionTableModel::Status, STATUS_COLUMN_WIDTH);
|
QSettings settings;
|
||||||
transactionView->setColumnWidth(TransactionTableModel::Watchonly, WATCHONLY_COLUMN_WIDTH);
|
if (!transactionView->horizontalHeader()->restoreState(settings.value("TransactionViewHeaderState").toByteArray())) {
|
||||||
transactionView->setColumnWidth(TransactionTableModel::Date, DATE_COLUMN_WIDTH);
|
transactionView->setColumnWidth(TransactionTableModel::Status, STATUS_COLUMN_WIDTH);
|
||||||
transactionView->setColumnWidth(TransactionTableModel::Type, TYPE_COLUMN_WIDTH);
|
transactionView->setColumnWidth(TransactionTableModel::Watchonly, WATCHONLY_COLUMN_WIDTH);
|
||||||
transactionView->setColumnWidth(TransactionTableModel::Amount, AMOUNT_MINIMUM_COLUMN_WIDTH);
|
transactionView->setColumnWidth(TransactionTableModel::Date, DATE_COLUMN_WIDTH);
|
||||||
transactionView->horizontalHeader()->setMinimumSectionSize(MINIMUM_COLUMN_WIDTH);
|
transactionView->setColumnWidth(TransactionTableModel::Type, TYPE_COLUMN_WIDTH);
|
||||||
transactionView->horizontalHeader()->setStretchLastSection(true);
|
transactionView->setColumnWidth(TransactionTableModel::Amount, AMOUNT_MINIMUM_COLUMN_WIDTH);
|
||||||
|
transactionView->horizontalHeader()->setMinimumSectionSize(MINIMUM_COLUMN_WIDTH);
|
||||||
|
transactionView->horizontalHeader()->setStretchLastSection(true);
|
||||||
|
}
|
||||||
|
transactionView->horizontalHeader()->setSortIndicator(TransactionTableModel::Date, Qt::DescendingOrder);
|
||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
abandonAction = new QAction(tr("Abandon transaction"), this);
|
abandonAction = new QAction(tr("Abandon transaction"), this);
|
||||||
@ -214,6 +218,12 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TransactionView::~TransactionView()
|
||||||
|
{
|
||||||
|
QSettings settings;
|
||||||
|
settings.setValue("TransactionViewHeaderState", transactionView->horizontalHeader()->saveState());
|
||||||
|
}
|
||||||
|
|
||||||
void TransactionView::setModel(WalletModel *_model)
|
void TransactionView::setModel(WalletModel *_model)
|
||||||
{
|
{
|
||||||
this->model = _model;
|
this->model = _model;
|
||||||
|
@ -35,6 +35,7 @@ class TransactionView : public QWidget
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit TransactionView(const PlatformStyle *platformStyle, QWidget *parent = nullptr);
|
explicit TransactionView(const PlatformStyle *platformStyle, QWidget *parent = nullptr);
|
||||||
|
~TransactionView();
|
||||||
|
|
||||||
void setModel(WalletModel *model);
|
void setModel(WalletModel *model);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user