diff --git a/src/qt/createpcodedialog.cpp b/src/qt/createpcodedialog.cpp index 06fc438864..852fe864a5 100644 --- a/src/qt/createpcodedialog.cpp +++ b/src/qt/createpcodedialog.cpp @@ -26,7 +26,6 @@ CreatePcodeDialog::CreatePcodeDialog(const PlatformStyle *_platformStyle, QWidget *parent) : QDialog(parent), ui(new Ui::CreatePcodeDialog), - columnResizingFixer(0), model(0), platformStyle(_platformStyle) { @@ -81,12 +80,8 @@ void CreatePcodeDialog::setModel(WalletModel *_model) tableView->setColumnWidth(static_cast(PcodeModel::ColumnIndex::Number), static_cast(ColumnWidths::Number)); tableView->setColumnWidth(static_cast(PcodeModel::ColumnIndex::Pcode), static_cast(ColumnWidths::Pcode)); tableView->setItemDelegateForColumn(int(PcodeModel::ColumnIndex::Pcode), new GUIUtil::TextElideStyledItemDelegate(tableView)); - connect(tableView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &CreatePcodeDialog::pcodesView_selectionChanged); - // Last 2 columns are set by the columnResizingFixer, when the table geometry is ready. - columnResizingFixer = new GUIUtil::TableViewLastColumnResizingFixer(tableView, 70, 70, this, int(PcodeModel::ColumnIndex::Pcode)); - columnResizingFixer->stretchColumnWidth(int(PcodeModel::ColumnIndex::Pcode)); ui->createPcodeButton->setEnabled(false); ui->statusLabel->setText(tr("The label should not be empty.")); @@ -162,14 +157,6 @@ void CreatePcodeDialog::pcodesView_selectionChanged(QItemSelection const & selec ui->showPcodeButton->setEnabled(enable); } -// We override the virtual resizeEvent of the QWidget to adjust tables column -// sizes as the tables width is proportional to the dialogs width. -void CreatePcodeDialog::resizeEvent(QResizeEvent *event) -{ - QWidget::resizeEvent(event); - columnResizingFixer->stretchColumnWidth(int(PcodeModel::ColumnIndex::Pcode)); -} - void CreatePcodeDialog::keyPressEvent(QKeyEvent *event) { if (event->key() == Qt::Key_Return) diff --git a/src/qt/createpcodedialog.h b/src/qt/createpcodedialog.h index a4ca84cd2f..b41feec761 100644 --- a/src/qt/createpcodedialog.h +++ b/src/qt/createpcodedialog.h @@ -57,7 +57,6 @@ public Q_SLOTS: private: Ui::CreatePcodeDialog *ui; - GUIUtil::TableViewLastColumnResizingFixer *columnResizingFixer; WalletModel *model; QMenu *contextMenu; const PlatformStyle *platformStyle; @@ -65,7 +64,6 @@ public Q_SLOTS: QModelIndex selectedRow(); void copyColumnToClipboard(int column); - virtual void resizeEvent(QResizeEvent *event); private Q_SLOTS: void on_createPcodeButton_clicked(); diff --git a/src/qt/elyassetsdialog.cpp b/src/qt/elyassetsdialog.cpp index 173dfbc92b..6928c106f0 100644 --- a/src/qt/elyassetsdialog.cpp +++ b/src/qt/elyassetsdialog.cpp @@ -50,7 +50,7 @@ ElyAssetsDialog::ElyAssetsDialog(QWidget *parent) : ui->balancesTable->setHorizontalHeaderItem(1, new QTableWidgetItem("Property Name")); ui->balancesTable->setHorizontalHeaderItem(2, new QTableWidgetItem("Reserved")); ui->balancesTable->setHorizontalHeaderItem(3, new QTableWidgetItem("Available")); - borrowedColumnResizingFixer = new GUIUtil::TableViewLastColumnResizingFixer(ui->balancesTable, 100, 100, this); + // note neither resizetocontents or stretch allow user to adjust - go interactive then manually set widths #if QT_VERSION < 0x050000 ui->balancesTable->horizontalHeader()->setResizeMode(0, QHeaderView::Interactive); @@ -73,7 +73,6 @@ ElyAssetsDialog::ElyAssetsDialog(QWidget *parent) : ui->balancesTable->resizeColumnToContents(0); ui->balancesTable->resizeColumnToContents(2); ui->balancesTable->resizeColumnToContents(3); - borrowedColumnResizingFixer->stretchColumnWidth(1); ui->balancesTable->verticalHeader()->setVisible(false); ui->balancesTable->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); ui->balancesTable->setSelectionBehavior(QAbstractItemView::SelectRows); @@ -302,11 +301,3 @@ void ElyAssetsDialog::balancesUpdated() UpdatePropSelector(); propSelectorChanged(); // refresh the table with the currently selected property ID } - -// We override the virtual resizeEvent of the QWidget to adjust tables column -// sizes as the tables width is proportional to the dialogs width. -void ElyAssetsDialog::resizeEvent(QResizeEvent* event) -{ - QWidget::resizeEvent(event); - borrowedColumnResizingFixer->stretchColumnWidth(1); -} diff --git a/src/qt/elyassetsdialog.h b/src/qt/elyassetsdialog.h index 90c71a90c6..4e5fffaed9 100644 --- a/src/qt/elyassetsdialog.h +++ b/src/qt/elyassetsdialog.h @@ -45,9 +45,6 @@ class ElyAssetsDialog : public QDialog QMenu *contextMenu; QMenu *contextMenuSummary; - GUIUtil::TableViewLastColumnResizingFixer *borrowedColumnResizingFixer; - virtual void resizeEvent(QResizeEvent *event); - public Q_SLOTS: void propSelectorChanged(); void balancesUpdated(); diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index 00179c7aef..fdcbb75884 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -488,130 +488,6 @@ bool ToolTipToRichTextFilter::eventFilter(QObject *obj, QEvent *evt) return QObject::eventFilter(obj, evt); } -void TableViewLastColumnResizingFixer::connectViewHeadersSignals() -{ - connect(tableView->horizontalHeader(), &QHeaderView::sectionResized, this, &TableViewLastColumnResizingFixer::on_sectionResized); - connect(tableView->horizontalHeader(), &QHeaderView::geometriesChanged, this, &TableViewLastColumnResizingFixer::on_geometriesChanged); -} - -// We need to disconnect these while handling the resize events, otherwise we can enter infinite loops. -void TableViewLastColumnResizingFixer::disconnectViewHeadersSignals() -{ - disconnect(tableView->horizontalHeader(), &QHeaderView::sectionResized, this, &TableViewLastColumnResizingFixer::on_sectionResized); - disconnect(tableView->horizontalHeader(), &QHeaderView::geometriesChanged, this, &TableViewLastColumnResizingFixer::on_geometriesChanged); -} - -// Setup the resize mode, handles compatibility for Qt5 and below as the method signatures changed. -// Refactored here for readability. -void TableViewLastColumnResizingFixer::setViewHeaderResizeMode(int logicalIndex, QHeaderView::ResizeMode resizeMode) -{ -#if QT_VERSION < 0x050000 - tableView->horizontalHeader()->setResizeMode(logicalIndex, resizeMode); -#else - tableView->horizontalHeader()->setSectionResizeMode(logicalIndex, resizeMode); -#endif -} - -void TableViewLastColumnResizingFixer::resizeColumn(int nColumnIndex, int width) -{ - tableView->setColumnWidth(nColumnIndex, width); - tableView->horizontalHeader()->resizeSection(nColumnIndex, width); -} - -int TableViewLastColumnResizingFixer::getColumnsWidth() -{ - int nColumnsWidthSum = 0; - for (int i = 0; i < columnCount; i++) - { - nColumnsWidthSum += tableView->horizontalHeader()->sectionSize(i); - } - return nColumnsWidthSum; -} - -int TableViewLastColumnResizingFixer::getAvailableWidthForColumn(int column) -{ - int nResult = lastColumnMinimumWidth; - int nTableWidth = tableView->horizontalHeader()->width(); - - if (nTableWidth > 0) - { - int nOtherColsWidth = getColumnsWidth() - tableView->horizontalHeader()->sectionSize(column); - nResult = std::max(nResult, nTableWidth - nOtherColsWidth); - } - - return nResult; -} - -// Make sure we don't make the columns wider than the table's viewport width. -void TableViewLastColumnResizingFixer::adjustTableColumnsWidth() -{ - disconnectViewHeadersSignals(); - resizeColumn(lastColumnIndex, getAvailableWidthForColumn(lastColumnIndex)); - connectViewHeadersSignals(); - - int nTableWidth = tableView->horizontalHeader()->width(); - int nColsWidth = getColumnsWidth(); - if (nColsWidth > nTableWidth) - { - resizeColumn(secondToLastColumnIndex,getAvailableWidthForColumn(secondToLastColumnIndex)); - } -} - -// Make column use all the space available, useful during window resizing. -void TableViewLastColumnResizingFixer::stretchColumnWidth(int column) -{ - disconnectViewHeadersSignals(); - resizeColumn(column, getAvailableWidthForColumn(column)); - connectViewHeadersSignals(); -} - -// When a section is resized this is a slot-proxy for ajustAmountColumnWidth(). -void TableViewLastColumnResizingFixer::on_sectionResized(int logicalIndex, int oldSize, int newSize) -{ - adjustTableColumnsWidth(); - int remainingWidth = getAvailableWidthForColumn(logicalIndex); - if (newSize > remainingWidth) - { - resizeColumn(logicalIndex, remainingWidth); - } -} - -// When the table's geometry is ready, we manually perform the stretch of the "Message" column, -// as the "Stretch" resize mode does not allow for interactive resizing. -void TableViewLastColumnResizingFixer::on_geometriesChanged() -{ - if ((getColumnsWidth() - this->tableView->horizontalHeader()->width()) != 0) - { - disconnectViewHeadersSignals(); - resizeColumn(secondToLastColumnIndex, getAvailableWidthForColumn(secondToLastColumnIndex)); - connectViewHeadersSignals(); - } -} - -/** - * Initializes all internal variables and prepares the - * the resize modes of the last 2 columns of the table and - */ -TableViewLastColumnResizingFixer::TableViewLastColumnResizingFixer(QTableView* table, int lastColMinimumWidth, int allColsMinimumWidth, QObject *parent) : - QObject(parent), - tableView(table), - lastColumnMinimumWidth(lastColMinimumWidth), - allColumnsMinimumWidth(allColsMinimumWidth) -{ - columnCount = tableView->horizontalHeader()->count(); - lastColumnIndex = columnCount - 1; - secondToLastColumnIndex = columnCount - 2; - tableView->horizontalHeader()->setMinimumSectionSize(allColumnsMinimumWidth); - setViewHeaderResizeMode(secondToLastColumnIndex, QHeaderView::Interactive); - setViewHeaderResizeMode(lastColumnIndex, QHeaderView::Interactive); -} - -TableViewLastColumnResizingFixer::TableViewLastColumnResizingFixer(QTableView* table, int lastColMinimumWidth, int allColsMinimumWidth, QObject *parent, int resizeColumnIndex): - TableViewLastColumnResizingFixer(table, lastColMinimumWidth, allColsMinimumWidth, parent) -{ - secondToLastColumnIndex = resizeColumnIndex; -} - #ifdef WIN32 boost::filesystem::path static StartupShortcutPath() { diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h index f27ca2497f..34ee530a4b 100644 --- a/src/qt/guiutil.h +++ b/src/qt/guiutil.h @@ -136,46 +136,6 @@ namespace GUIUtil int size_threshold; }; - /** - * Makes a QTableView last column feel as if it was being resized from its left border. - * Also makes sure the column widths are never larger than the table's viewport. - * In Qt, all columns are resizable from the right, but it's not intuitive resizing the last column from the right. - * Usually our second to last columns behave as if stretched, and when on strech mode, columns aren't resizable - * interactively or programmatically. - * - * This helper object takes care of this issue. - * - */ - class TableViewLastColumnResizingFixer: public QObject - { - Q_OBJECT - - public: - TableViewLastColumnResizingFixer(QTableView* table, int lastColMinimumWidth, int allColsMinimumWidth, QObject *parent); - TableViewLastColumnResizingFixer(QTableView* table, int lastColMinimumWidth, int allColsMinimumWidth, QObject *parent, int resizeColumnIndex); - void stretchColumnWidth(int column); - - private: - QTableView* tableView; - int lastColumnMinimumWidth; - int allColumnsMinimumWidth; - int lastColumnIndex; - int columnCount; - int secondToLastColumnIndex; - - void adjustTableColumnsWidth(); - int getAvailableWidthForColumn(int column); - int getColumnsWidth(); - void connectViewHeadersSignals(); - void disconnectViewHeadersSignals(); - void setViewHeaderResizeMode(int logicalIndex, QHeaderView::ResizeMode resizeMode); - void resizeColumn(int nColumnIndex, int width); - - private Q_SLOTS: - void on_sectionResized(int logicalIndex, int oldSize, int newSize); - void on_geometriesChanged(); - }; - bool GetStartOnSystemStartup(); bool SetStartOnSystemStartup(bool fAutoStart); diff --git a/src/qt/receivecoinsdialog.cpp b/src/qt/receivecoinsdialog.cpp index 2ca8ae1342..7fa3179205 100644 --- a/src/qt/receivecoinsdialog.cpp +++ b/src/qt/receivecoinsdialog.cpp @@ -25,7 +25,6 @@ ReceiveCoinsDialog::ReceiveCoinsDialog(const PlatformStyle *_platformStyle, QWidget *parent) : QDialog(parent), ui(new Ui::ReceiveCoinsDialog), - columnResizingFixer(0), model(0), platformStyle(_platformStyle) { @@ -87,11 +86,11 @@ 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(23); + 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); } } @@ -207,14 +206,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); -} - void ReceiveCoinsDialog::keyPressEvent(QKeyEvent *event) { if (event->key() == Qt::Key_Return) diff --git a/src/qt/receivecoinsdialog.h b/src/qt/receivecoinsdialog.h index 1d0491c0d5..68c5e0adf5 100644 --- a/src/qt/receivecoinsdialog.h +++ b/src/qt/receivecoinsdialog.h @@ -55,14 +55,12 @@ public Q_SLOTS: private: Ui::ReceiveCoinsDialog *ui; - GUIUtil::TableViewLastColumnResizingFixer *columnResizingFixer; WalletModel *model; QMenu *contextMenu; const PlatformStyle *platformStyle; QModelIndex selectedRow(); void copyColumnToClipboard(int column); - virtual void resizeEvent(QResizeEvent *event); private Q_SLOTS: void on_receiveButton_clicked(); diff --git a/src/qt/tradehistorydialog.cpp b/src/qt/tradehistorydialog.cpp index f8f3dbd9e4..b4b36da867 100755 --- a/src/qt/tradehistorydialog.cpp +++ b/src/qt/tradehistorydialog.cpp @@ -80,7 +80,6 @@ TradeHistoryDialog::TradeHistoryDialog(QWidget *parent) : ui->tradeHistoryTable->setHorizontalHeaderItem(5, new QTableWidgetItem("Trade Details")); ui->tradeHistoryTable->setHorizontalHeaderItem(6, new QTableWidgetItem("Sold")); ui->tradeHistoryTable->setHorizontalHeaderItem(7, new QTableWidgetItem("Received")); - borrowedColumnResizingFixer = new GUIUtil::TableViewLastColumnResizingFixer(ui->tradeHistoryTable, 100, 100, this); #if QT_VERSION < 0x050000 ui->tradeHistoryTable->horizontalHeader()->setResizeMode(2, QHeaderView::Fixed); ui->tradeHistoryTable->horizontalHeader()->setResizeMode(3, QHeaderView::Interactive); @@ -112,9 +111,9 @@ TradeHistoryDialog::TradeHistoryDialog(QWidget *parent) : ui->tradeHistoryTable->resizeColumnToContents(4); ui->tradeHistoryTable->resizeColumnToContents(6); ui->tradeHistoryTable->resizeColumnToContents(7); - borrowedColumnResizingFixer->stretchColumnWidth(5); ui->tradeHistoryTable->setSortingEnabled(true); ui->tradeHistoryTable->horizontalHeader()->setSortIndicator(3, Qt::DescendingOrder); + QAction *copyTxIDAction = new QAction(tr("Copy transaction ID"), this); QAction *showDetailsAction = new QAction(tr("Show trade details"), this); contextMenu = new QMenu(); @@ -570,9 +569,3 @@ void TradeHistoryDialog::showDetails() PopulateSimpleDialog(strTXText, "Trade Information", "Trade Information"); } } - -void TradeHistoryDialog::resizeEvent(QResizeEvent* event) -{ - QWidget::resizeEvent(event); - borrowedColumnResizingFixer->stretchColumnWidth(5); -} diff --git a/src/qt/tradehistorydialog.h b/src/qt/tradehistorydialog.h index 4fe6749f7c..9b3871c74d 100755 --- a/src/qt/tradehistorydialog.h +++ b/src/qt/tradehistorydialog.h @@ -53,8 +53,6 @@ class TradeHistoryDialog : public QDialog ~TradeHistoryDialog(); void setWalletModel(WalletModel *model); void setClientModel(ClientModel *model); - GUIUtil::TableViewLastColumnResizingFixer *borrowedColumnResizingFixer; - virtual void resizeEvent(QResizeEvent* event); private: Ui::tradeHistoryDialog *ui; diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp index 3d86797da2..86ed7cfeae 100644 --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -43,7 +43,7 @@ char const * CopyRapText{"Copy RAP address/label"}; TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *parent) : QWidget(parent), model(0), transactionProxyModel(0), - transactionView(0), abandonAction(0), columnResizingFixer(0) + transactionView(0), abandonAction(0) { // Build filter row setContentsMargins(0,0,0,0); @@ -67,7 +67,7 @@ TransactionView::TransactionView(const PlatformStyle *platformStyle, QWidget *pa headerLayout->addWidget(watchOnlyWidget); instantsendWidget = new QComboBox(this); - instantsendWidget->setFixedWidth(24); + instantsendWidget->setFixedWidth(150); instantsendWidget->addItem(tr("All"), TransactionFilterProxy::InstantSendFilter_All); instantsendWidget->addItem(tr("Locked by InstantSend"), TransactionFilterProxy::InstantSendFilter_Yes); instantsendWidget->addItem(tr("Not locked by InstantSend"), TransactionFilterProxy::InstantSendFilter_No); @@ -224,7 +224,6 @@ void TransactionView::setModel(WalletModel *_model) transactionProxyModel->setSortRole(Qt::EditRole); - transactionView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); transactionView->setModel(transactionProxyModel); transactionView->setAlternatingRowColors(true); transactionView->setSelectionBehavior(QAbstractItemView::SelectRows); @@ -238,9 +237,10 @@ void TransactionView::setModel(WalletModel *_model) transactionView->setColumnWidth(TransactionTableModel::InstantSend, INSTANTSEND_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, this); + transactionView->horizontalHeader()->setSectionResizeMode(TransactionTableModel::Amount, QHeaderView::Fixed); + transactionView->horizontalHeader()->setMinimumSectionSize(23); + transactionView->horizontalHeader()->setStretchLastSection(true); + transactionView->horizontalHeader()->setMaximumSectionSize(260); if (_model->getOptionsModel()) { @@ -432,7 +432,7 @@ void TransactionView::updateHeaderSizes(int logicalIndex, int oldSize, int newSi {TransactionTableModel::Amount, amountWidget} }; - if(logicalIndex <= TransactionTableModel::ToAddress) + if(logicalIndex <= TransactionTableModel::Amount) return; for(std::pair const & p : headerWidgets) { @@ -678,19 +678,6 @@ void TransactionView::focusTransaction(const QModelIndex &idx) 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) -{ - if(!transactionView || !transactionView->selectionModel()) - return; - - QWidget::resizeEvent(event); - disconnect(transactionView->horizontalHeader(), &QHeaderView::sectionResized, this, &TransactionView::updateHeaderSizes); - columnResizingFixer->stretchColumnWidth(TransactionTableModel::ToAddress); - connect(transactionView->horizontalHeader(), &QHeaderView::sectionResized, this, &TransactionView::updateHeaderSizes); -} - // Need to override default Ctrl+C action for amount as default behaviour is just to copy DisplayRole text bool TransactionView::eventFilter(QObject *obj, QEvent *event) { diff --git a/src/qt/transactionview.h b/src/qt/transactionview.h index 6a0a806a2d..792bbb5277 100644 --- a/src/qt/transactionview.h +++ b/src/qt/transactionview.h @@ -51,7 +51,7 @@ class TransactionView : public QWidget }; enum ColumnWidths { - STATUS_COLUMN_WIDTH = 30, + STATUS_COLUMN_WIDTH = 170, WATCHONLY_COLUMN_WIDTH = 23, INSTANTSEND_COLUMN_WIDTH = 23, DATE_COLUMN_WIDTH = 120, @@ -87,10 +87,6 @@ class TransactionView : public QWidget QWidget *createDateRangeWidget(); void updateCalendarWidgets(); - GUIUtil::TableViewLastColumnResizingFixer *columnResizingFixer; - - virtual void resizeEvent(QResizeEvent* event); - bool eventFilter(QObject *obj, QEvent *event); private Q_SLOTS: @@ -110,7 +106,6 @@ private Q_SLOTS: void abandonTx(); void rebroadcastTx(); void reconsiderBip47Tx(); - Q_SIGNALS: void doubleClicked(const QModelIndex&); diff --git a/src/qt/txhistorydialog.cpp b/src/qt/txhistorydialog.cpp index 7decc1c85c..b0d945e357 100644 --- a/src/qt/txhistorydialog.cpp +++ b/src/qt/txhistorydialog.cpp @@ -72,9 +72,7 @@ TXHistoryDialog::TXHistoryDialog(QWidget *parent) : ui->txHistoryTable->setHorizontalHeaderItem(4, new QTableWidgetItem("Type")); ui->txHistoryTable->setHorizontalHeaderItem(5, new QTableWidgetItem("Address")); ui->txHistoryTable->setHorizontalHeaderItem(6, new QTableWidgetItem("Amount")); - // borrow ColumnResizingFixer again - borrowedColumnResizingFixer = new GUIUtil::TableViewLastColumnResizingFixer(ui->txHistoryTable, 100, 100, this); - // allow user to adjust - go interactive then manually set widths + #if QT_VERSION < 0x050000 ui->txHistoryTable->horizontalHeader()->setResizeMode(2, QHeaderView::Fixed); ui->txHistoryTable->horizontalHeader()->setResizeMode(3, QHeaderView::Interactive); @@ -127,7 +125,6 @@ TXHistoryDialog::TXHistoryDialog(QWidget *parent) : ui->txHistoryTable->resizeColumnToContents(6); ui->txHistoryTable->setColumnHidden(0, true); // hidden txid for displaying transaction details ui->txHistoryTable->setColumnHidden(1, true); // hideen sort key - borrowedColumnResizingFixer->stretchColumnWidth(5); ui->txHistoryTable->setSortingEnabled(true); ui->txHistoryTable->horizontalHeader()->setSortIndicator(1, Qt::DescendingOrder); // sort by hidden sort key } @@ -521,12 +518,6 @@ void TXHistoryDialog::showDetails() } } -void TXHistoryDialog::resizeEvent(QResizeEvent* event) -{ - QWidget::resizeEvent(event); - borrowedColumnResizingFixer->stretchColumnWidth(5); -} - std::string TXHistoryDialog::shrinkTxType(int txType, bool *fundsMoved) { string displayType = "Unknown"; diff --git a/src/qt/txhistorydialog.h b/src/qt/txhistorydialog.h index 01e8ca06c8..a0e6b70de1 100644 --- a/src/qt/txhistorydialog.h +++ b/src/qt/txhistorydialog.h @@ -56,14 +56,12 @@ class TXHistoryDialog : public QDialog void setClientModel(ClientModel *model); void setWalletModel(WalletModel *model); - virtual void resizeEvent(QResizeEvent* event); std::string shrinkTxType(int txType, bool *fundsMoved); private: Ui::txHistoryDialog *ui; ClientModel *clientModel; WalletModel *walletModel; - GUIUtil::TableViewLastColumnResizingFixer *borrowedColumnResizingFixer; QMenu *contextMenu; HistoryMap txHistoryMap;