From 620444bd591355b7aeeed9d023d19cc665367b35 Mon Sep 17 00:00:00 2001 From: Russell Yanofsky Date: Thu, 25 May 2017 07:58:52 -0400 Subject: [PATCH] Fix broken q4 test build Error reported by Patrick Strateman https://github.com/bitcoin/bitcoin/pull/10420#issuecomment-303908782 --- src/qt/test/wallettests.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/qt/test/wallettests.cpp b/src/qt/test/wallettests.cpp index 32362ccdf..0e12a9d53 100644 --- a/src/qt/test/wallettests.cpp +++ b/src/qt/test/wallettests.cpp @@ -90,6 +90,17 @@ QModelIndex FindTx(const QAbstractItemModel& model, const uint256& txid) return {}; } +//! Request context menu (call method that is public in qt5, but protected in qt4). +void RequestContextMenu(QWidget* widget) +{ + class Qt4Hack : public QWidget + { + public: + using QWidget::customContextMenuRequested; + }; + static_cast(widget)->customContextMenuRequested({}); +} + //! Invoke bumpfee on txid and check results. void BumpFee(TransactionView& view, const uint256& txid, bool expectDisabled, std::string expectError, bool cancel) { @@ -102,7 +113,7 @@ void BumpFee(TransactionView& view, const uint256& txid, bool expectDisabled, st QAction* action = view.findChild("bumpFeeAction"); table->selectionModel()->select(index, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows); action->setEnabled(expectDisabled); - table->customContextMenuRequested({}); + RequestContextMenu(table); QCOMPARE(action->isEnabled(), !expectDisabled); action->setEnabled(true);