diff options
author | Jonas Schnelli <dev@jonasschnelli.ch> | 2020-05-29 10:17:35 +0200 |
---|---|---|
committer | Jonas Schnelli <dev@jonasschnelli.ch> | 2020-05-29 10:19:44 +0200 |
commit | c2c15ea54eb1c8f99b96cd90a4a383fbdc0d625a (patch) | |
tree | f0a5b1e34d5859b2c9d0d366a8d73d77d8944d9e /src/qt | |
parent | 343169998193bac57581493dcbdf6d1e10617ef1 (diff) | |
parent | 1122817c194ed49abf896e68604e725c3b5c8569 (diff) | |
download | bitcoin-c2c15ea54eb1c8f99b96cd90a4a383fbdc0d625a.tar.xz |
Merge #17908: qt: Remove QFont warnings with QT_QPA_PLATFORM=minimal
1122817c194ed49abf896e68604e725c3b5c8569 qt: Remove QFont warnings with QPA=minimal (Hennadii Stepanov)
Pull request description:
This PR removes massive warnings like:
```
QWARN : ... QFont::setPointSizeF: Point size <= 0 (...), must be greater than 0
```
from `test_bitcoin-qt` output.
On master (e258ce792a4849927a6db51786732d71cbbb65fc):
```
$ ./src/qt/test/test_bitcoin-qt | grep QFont | wc -l
~BitcoinApplication : Stopping thread
~BitcoinApplication : Stopped thread
57
```
With this PR:
```
$ ./src/qt/test/test_bitcoin-qt | grep QFont | wc -l
~BitcoinApplication : Stopping thread
~BitcoinApplication : Stopped thread
0
```
ACKs for top commit:
promag:
Code review ACK 1122817c194ed49abf896e68604e725c3b5c8569.
jonasschnelli:
utACK 1122817c194ed49abf896e68604e725c3b5c8569
Tree-SHA512: 32fa72a5d3db1d4c73a2a324aa9cad807ee46f23fc5319f7d71202987dc73ea7c90082904489b323a432e1afaebd9976b7dd0374236a16153162aa75fe368723
Diffstat (limited to 'src/qt')
-rw-r--r-- | src/qt/guiutil.cpp | 10 | ||||
-rw-r--r-- | src/qt/guiutil.h | 8 | ||||
-rw-r--r-- | src/qt/rpcconsole.cpp | 3 | ||||
-rw-r--r-- | src/qt/transactionview.cpp | 6 |
4 files changed, 22 insertions, 5 deletions
diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index af86fe5d27..dce186884b 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -48,13 +48,14 @@ #include <QKeyEvent> #include <QLineEdit> #include <QList> +#include <QMenu> #include <QMouseEvent> #include <QProgressDialog> #include <QScreen> #include <QSettings> +#include <QShortcut> #include <QSize> #include <QString> -#include <QShortcut> #include <QTextDocument> // for Qt::mightBeRichText #include <QThread> #include <QUrlQuery> @@ -910,4 +911,11 @@ void LogQtInfo() } } +void PopupMenu(QMenu* menu, const QPoint& point, QAction* at_action) +{ + // The qminimal plugin does not provide window system integration. + if (QApplication::platformName() == "minimal") return; + menu->popup(point, at_action); +} + } // namespace GUIUtil diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h index 8b9fca4fb1..a26e7ff873 100644 --- a/src/qt/guiutil.h +++ b/src/qt/guiutil.h @@ -28,9 +28,12 @@ namespace interfaces QT_BEGIN_NAMESPACE class QAbstractItemView; +class QAction; class QDateTime; class QFont; class QLineEdit; +class QMenu; +class QPoint; class QProgressDialog; class QUrl; class QWidget; @@ -273,6 +276,11 @@ namespace GUIUtil * Writes to debug.log short info about the used Qt and the host system. */ void LogQtInfo(); + + /** + * Call QMenu::popup() only on supported QT_QPA_PLATFORM. + */ + void PopupMenu(QMenu* menu, const QPoint& point, QAction* at_action = nullptr); } // namespace GUIUtil #endif // BITCOIN_QT_GUIUTIL_H diff --git a/src/qt/rpcconsole.cpp b/src/qt/rpcconsole.cpp index 66f1c8fd9c..0f89d4e6fe 100644 --- a/src/qt/rpcconsole.cpp +++ b/src/qt/rpcconsole.cpp @@ -28,6 +28,7 @@ #include <wallet/wallet.h> #endif +#include <QFont> #include <QKeyEvent> #include <QMenu> #include <QMessageBox> @@ -494,7 +495,7 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty ui->detailWidget->hide(); ui->peerHeading->setText(tr("Select a peer to view detailed information.")); - consoleFontSize = settings.value(fontSizeSettingsKey, QFontInfo(QFont()).pointSize()).toInt(); + consoleFontSize = settings.value(fontSizeSettingsKey, QFont().pointSize()).toInt(); clear(); GUIUtil::handleCloseWindowShortcut(this); diff --git a/src/qt/transactionview.cpp b/src/qt/transactionview.cpp index 3c638fb358..fca0ab0691 100644 --- a/src/qt/transactionview.cpp +++ b/src/qt/transactionview.cpp @@ -8,6 +8,7 @@ #include <qt/bitcoinunits.h> #include <qt/csvmodelwriter.h> #include <qt/editaddressdialog.h> +#include <qt/guiutil.h> #include <qt/optionsmodel.h> #include <qt/platformstyle.h> #include <qt/transactiondescdialog.h> @@ -396,9 +397,8 @@ void TransactionView::contextualMenu(const QPoint &point) abandonAction->setEnabled(model->wallet().transactionCanBeAbandoned(hash)); bumpFeeAction->setEnabled(model->wallet().transactionCanBeBumped(hash)); - if(index.isValid()) - { - contextMenu->popup(transactionView->viewport()->mapToGlobal(point)); + if (index.isValid()) { + GUIUtil::PopupMenu(contextMenu, transactionView->viewport()->mapToGlobal(point)); } } |