Skip to content

Commit 2a388bd

Browse files
committed
qt: Remove QFont warnings with QPA=minimal
1 parent e258ce7 commit 2a388bd

File tree

4 files changed

+23
-7
lines changed

4 files changed

+23
-7
lines changed

src/qt/guiutil.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@
4444
#include <QFont>
4545
#include <QFontDatabase>
4646
#include <QFontMetrics>
47-
#include <QGuiApplication>
4847
#include <QKeyEvent>
4948
#include <QLineEdit>
5049
#include <QList>
50+
#include <QMenu>
5151
#include <QMouseEvent>
5252
#include <QProgressDialog>
5353
#include <QScreen>
@@ -904,4 +904,11 @@ void LogQtInfo()
904904
}
905905
}
906906

907+
void PopupMenu(QMenu* menu, const QPoint& point, QAction* at_action)
908+
{
909+
// The qminimal plugin does not provide window system integration.
910+
if (QApplication::platformName() == "minimal") return;
911+
menu->popup(point, at_action);
912+
}
913+
907914
} // 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;
@@ -270,6 +273,11 @@ namespace GUIUtil
270273
* Writes to debug.log short info about the used Qt and the host system.
271274
*/
272275
void LogQtInfo();
276+
277+
/**
278+
* Call QMenu::popup() only on supported QT_QPA_PLATFORM.
279+
*/
280+
void PopupMenu(QMenu* menu, const QPoint& point, QAction* at_action = nullptr);
273281
} // namespace GUIUtil
274282

275283
#endif // BITCOIN_QT_GUIUTIL_H

src/qt/rpcconsole.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,16 @@
2828
#include <wallet/wallet.h>
2929
#endif
3030

31+
#include <QFont>
3132
#include <QKeyEvent>
3233
#include <QMenu>
3334
#include <QMessageBox>
34-
#include <QScrollBar>
3535
#include <QScreen>
36+
#include <QScrollBar>
3637
#include <QSettings>
38+
#include <QStringList>
3739
#include <QTime>
3840
#include <QTimer>
39-
#include <QStringList>
4041

4142
// TODO: add a scrollback limit, as there is currently none
4243
// TODO: make it possible to filter out categories (esp debug messages when implemented)
@@ -496,7 +497,7 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty
496497
ui->detailWidget->hide();
497498
ui->peerHeading->setText(tr("Select a peer to view detailed information."));
498499

499-
consoleFontSize = settings.value(fontSizeSettingsKey, QFontInfo(QFont()).pointSize()).toInt();
500+
consoleFontSize = settings.value(fontSizeSettingsKey, QFont().pointSize()).toInt();
500501
clear();
501502
}
502503

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)