-
Notifications
You must be signed in to change notification settings - Fork 37.7k
qt: Remove QFont warnings with QT_QPA_PLATFORM=minimal #17908
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
qt: Remove QFont warnings with QT_QPA_PLATFORM=minimal #17908
Conversation
ACK 8ab99dd -- tests should be silent in the absence of errors: thanks for fixing! :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about this change. What if this is eventually fixed on Qt? Are these warnings worth the change?
Alternatively you could filter the warning in DebugMessageHandler
or even call qInstallMessageHandler
with a specific test message handler.
Either way a comment explaining the condition would be nice.
8ab99dd
to
d318a14
Compare
Updated 8ab99dd -> d318a14 (pr17908.01 -> pr17908.02, compare).
Tests should not be noisy, IMO. 57 warnings messages look spammy ;)
A comment has been added. |
@@ -496,7 +497,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(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this change needed? And what is the observable change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If QT_QPA_PLATFORM=minimal
(i.e., without window system integration), QFontInfo(QFont()).pointSize()
returns -1
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, but when QT_QPA_PLATFORM is set to something else, we actually want the values that are used to draw the text, not the point size of QFont{}
, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems there is no harm when RPCConsole::setFontSize()
is called. With non-qminimal
plugin Qt always could draw a correct font.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not an expert in qt, and it might work for you. But in the general case it might depend on the fonts that are selected in the system settings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Qt Documentation -> Drawing and Filling:
Qt will use the font with the specified attributes, or if no matching font exists, Qt will use the closest matching installed font.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively you could filter the warning in
DebugMessageHandler
or even callqInstallMessageHandler
with a specific test message handler.
@hebasto have you considered this approach?
|
d318a14
to
50c2791
Compare
Updated d318a14 -> 50c2791 (pr17908.02 -> pr17908.03, diff):
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review ACK 50c2791.
src/qt/guiutil.cpp
Outdated
void QMenuPopup(QMenu* menu, const QPoint& point, QAction* atAction) | ||
{ | ||
// The qminimal plugin does not provide window system integration. | ||
if (QGuiApplication::platformName() == "minimal") return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit, QApplication
just to make it clear what's the required include.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, QApplication
inherits platformName()
from QGuiApplication
🐅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
50c2791
to
2a388bd
Compare
Updated 50c2791 -> 2a388bd (pr17908.03 -> pr17908.04, diff):
|
Code review ACK 2a388bd. |
2a388bd
to
1122817
Compare
Rebased 2a388bd -> 1122817 (pr17908.04 -> pr17908.05) due to the conflict with #16710. |
Code review ACK 1122817. Only Qt issue I found that could be related is https://bugreports.qt.io/browse/QTBUG-72335. |
utACK 1122817 |
…inimal 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
Summary: This is a backport of [[bitcoin/bitcoin#17908 | core#17908]] Test Plan: Before this patch: ``` $ ./src/qt/test/test_bitcoin-qt | grep QFont | wc -l ~BitcoinApplication : Stopping thread ~BitcoinApplication : Stopped thread 17 ``` After: ``` $ ./src/qt/test/test_bitcoin-qt | grep QFont | wc -l ~BitcoinApplication : Stopping thread ~BitcoinApplication : Stopped thread 0 ``` Reviewers: #bitcoin_abc, majcosta Reviewed By: #bitcoin_abc, majcosta Subscribers: majcosta Differential Revision: https://reviews.bitcoinabc.org/D9924
This PR removes massive warnings like:
from
test_bitcoin-qt
output.On master (e258ce7):
With this PR: