Skip to content

Commit c2c15ea

Browse files
committed
Merge #17908: qt: Remove QFont warnings with QT_QPA_PLATFORM=minimal
1122817 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 (e258ce7): ``` $ ./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 1122817. jonasschnelli: utACK 1122817 Tree-SHA512: 32fa72a5d3db1d4c73a2a324aa9cad807ee46f23fc5319f7d71202987dc73ea7c90082904489b323a432e1afaebd9976b7dd0374236a16153162aa75fe368723
2 parents 3431699 + 1122817 commit c2c15ea

File tree

4 files changed

+22
-5
lines changed

4 files changed

+22
-5
lines changed

src/qt/guiutil.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,14 @@
4848
#include <QKeyEvent>
4949
#include <QLineEdit>
5050
#include <QList>
51+
#include <QMenu>
5152
#include <QMouseEvent>
5253
#include <QProgressDialog>
5354
#include <QScreen>
5455
#include <QSettings>
56+
#include <QShortcut>
5557
#include <QSize>
5658
#include <QString>
57-
#include <QShortcut>
5859
#include <QTextDocument> // for Qt::mightBeRichText
5960
#include <QThread>
6061
#include <QUrlQuery>
@@ -910,4 +911,11 @@ void LogQtInfo()
910911
}
911912
}
912913

914+
void PopupMenu(QMenu* menu, const QPoint& point, QAction* at_action)
915+
{
916+
// The qminimal plugin does not provide window system integration.
917+
if (QApplication::platformName() == "minimal") return;
918+
menu->popup(point, at_action);
919+
}
920+
913921
} // namespace GUIUtil

src/qt/guiutil.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,12 @@ namespace interfaces
2828

2929
QT_BEGIN_NAMESPACE
3030
class QAbstractItemView;
31+
class QAction;
3132
class QDateTime;
3233
class QFont;
3334
class QLineEdit;
35+
class QMenu;
36+
class QPoint;
3437
class QProgressDialog;
3538
class QUrl;
3639
class QWidget;
@@ -273,6 +276,11 @@ namespace GUIUtil
273276
* Writes to debug.log short info about the used Qt and the host system.
274277
*/
275278
void LogQtInfo();
279+
280+
/**
281+
* Call QMenu::popup() only on supported QT_QPA_PLATFORM.
282+
*/
283+
void PopupMenu(QMenu* menu, const QPoint& point, QAction* at_action = nullptr);
276284
} // namespace GUIUtil
277285

278286
#endif // BITCOIN_QT_GUIUTIL_H

src/qt/rpcconsole.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <wallet/wallet.h>
2929
#endif
3030

31+
#include <QFont>
3132
#include <QKeyEvent>
3233
#include <QMenu>
3334
#include <QMessageBox>
@@ -494,7 +495,7 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty
494495
ui->detailWidget->hide();
495496
ui->peerHeading->setText(tr("Select a peer to view detailed information."));
496497

497-
consoleFontSize = settings.value(fontSizeSettingsKey, QFontInfo(QFont()).pointSize()).toInt();
498+
consoleFontSize = settings.value(fontSizeSettingsKey, QFont().pointSize()).toInt();
498499
clear();
499500

500501
GUIUtil::handleCloseWindowShortcut(this);

src/qt/transactionview.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <qt/bitcoinunits.h>
99
#include <qt/csvmodelwriter.h>
1010
#include <qt/editaddressdialog.h>
11+
#include <qt/guiutil.h>
1112
#include <qt/optionsmodel.h>
1213
#include <qt/platformstyle.h>
1314
#include <qt/transactiondescdialog.h>
@@ -396,9 +397,8 @@ void TransactionView::contextualMenu(const QPoint &point)
396397
abandonAction->setEnabled(model->wallet().transactionCanBeAbandoned(hash));
397398
bumpFeeAction->setEnabled(model->wallet().transactionCanBeBumped(hash));
398399

399-
if(index.isValid())
400-
{
401-
contextMenu->popup(transactionView->viewport()->mapToGlobal(point));
400+
if (index.isValid()) {
401+
GUIUtil::PopupMenu(contextMenu, transactionView->viewport()->mapToGlobal(point));
402402
}
403403
}
404404

0 commit comments

Comments
 (0)