diff options
Diffstat (limited to 'src/qt/transactionview.cpp')
-rw-r--r-- | src/qt/transactionview.cpp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp index a0c3ce62aa..a363150919 100644 --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -168,6 +168,7 @@ void TransactionView::setModel(WalletModel *model) transactionProxyModel->setSortRole(Qt::EditRole); + transactionView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); transactionView->setModel(transactionProxyModel); transactionView->setAlternatingRowColors(true); transactionView->setSelectionBehavior(QAbstractItemView::SelectRows); @@ -176,15 +177,12 @@ void TransactionView::setModel(WalletModel *model) transactionView->sortByColumn(TransactionTableModel::Status, Qt::DescendingOrder); transactionView->verticalHeader()->hide(); - transactionView->horizontalHeader()->resizeSection(TransactionTableModel::Status, 23); - transactionView->horizontalHeader()->resizeSection(TransactionTableModel::Date, 120); - transactionView->horizontalHeader()->resizeSection(TransactionTableModel::Type, 120); -#if QT_VERSION < 0x050000 - transactionView->horizontalHeader()->setResizeMode(TransactionTableModel::ToAddress, QHeaderView::Stretch); -#else - transactionView->horizontalHeader()->setSectionResizeMode(TransactionTableModel::ToAddress, QHeaderView::Stretch); -#endif - transactionView->horizontalHeader()->resizeSection(TransactionTableModel::Amount, 100); + transactionView->setColumnWidth(TransactionTableModel::Status, STATUS_COLUMN_WIDTH); + transactionView->setColumnWidth(TransactionTableModel::Date, DATE_COLUMN_WIDTH); + transactionView->setColumnWidth(TransactionTableModel::Type, TYPE_COLUMN_WIDTH); + transactionView->setColumnWidth(TransactionTableModel::Amount, AMOUNT_MINIMUM_COLUMN_WIDTH); + + columnResizingFixer = new GUIUtil::TableViewLastColumnResizingFixer(transactionView, AMOUNT_MINIMUM_COLUMN_WIDTH, MINIMUM_COLUMN_WIDTH); } } @@ -439,3 +437,11 @@ void TransactionView::focusTransaction(const QModelIndex &idx) transactionView->setCurrentIndex(targetIdx); transactionView->setFocus(); } + +// We override the virtual resizeEvent of the QWidget to adjust tables column +// sizes as the tables width is proportional to the dialogs width. +void TransactionView::resizeEvent(QResizeEvent* event) +{ + QWidget::resizeEvent(event); + columnResizingFixer->stretchColumnWidth(TransactionTableModel::ToAddress); +} |