Skip to content

Conversation

hebasto
Copy link
Member

@hebasto hebasto commented Jan 11, 2020

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

@fanquake fanquake added the GUI label Jan 11, 2020
@fanquake fanquake changed the title qa, qt: Remove QFont warnings with QT_QPA_PLATFORM=minimal qt: Remove QFont warnings with QT_QPA_PLATFORM=minimal Jan 11, 2020
@practicalswift
Copy link
Contributor

practicalswift commented Jan 12, 2020

ACK 8ab99dd -- tests should be silent in the absence of errors: thanks for fixing! :)

Copy link
Contributor

@promag promag left a 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.

@hebasto hebasto force-pushed the 20200111-qttest-minimal-warn branch from 8ab99dd to d318a14 Compare January 14, 2020 17:33
@hebasto
Copy link
Member Author

hebasto commented Jan 14, 2020

Updated 8ab99dd -> d318a14 (pr17908.01 -> pr17908.02, compare).

@promag

Not sure about this change. What if this is eventually fixed on Qt? Are these warnings worth the change?

Tests should not be noisy, IMO. 57 warnings messages look spammy ;)

Either way a comment explaining the condition would be nice.

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();
Copy link
Member

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?

https://doc.qt.io/qt-5/qfontinfo.html#details

Copy link
Member Author

@hebasto hebasto Jan 14, 2020

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.

Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member Author

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.

@DrahtBot
Copy link
Contributor

DrahtBot commented Mar 2, 2020

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, 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.

Copy link
Contributor

@promag promag left a 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 call qInstallMessageHandler with a specific test message handler.

@hebasto have you considered this approach?

@hebasto
Copy link
Member Author

hebasto commented Mar 15, 2020

@promag

Alternatively you could filter the warning in DebugMessageHandler or even call qInstallMessageHandler with a specific test message handler.

@hebasto have you considered this approach?

  • it seems DebugMessageHandler is not used in test_bitcoin-qt

  • qInstallMessageHandler with a specific test message handler could suppress warnings for possible new cases in the future

@hebasto hebasto force-pushed the 20200111-qttest-minimal-warn branch from d318a14 to 50c2791 Compare March 15, 2020 20:28
@hebasto
Copy link
Member Author

hebasto commented Mar 15, 2020

Updated d318a14 -> 50c2791 (pr17908.02 -> pr17908.03, diff):

Copy link
Contributor

@promag promag left a 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.

void QMenuPopup(QMenu* menu, const QPoint& point, QAction* atAction)
{
// The qminimal plugin does not provide window system integration.
if (QGuiApplication::platformName() == "minimal") return;
Copy link
Contributor

@promag promag Apr 26, 2020

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.

Copy link
Member Author

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 🐅

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hebasto hebasto force-pushed the 20200111-qttest-minimal-warn branch from 50c2791 to 2a388bd Compare April 27, 2020 03:04
@hebasto
Copy link
Member Author

hebasto commented Apr 27, 2020

Updated 50c2791 -> 2a388bd (pr17908.03 -> pr17908.04, diff):

@promag
Copy link
Contributor

promag commented Apr 27, 2020

Code review ACK 2a388bd.

@hebasto hebasto force-pushed the 20200111-qttest-minimal-warn branch from 2a388bd to 1122817 Compare May 13, 2020 13:04
@hebasto
Copy link
Member Author

hebasto commented May 13, 2020

Rebased 2a388bd -> 1122817 (pr17908.04 -> pr17908.05) due to the conflict with #16710.

@promag
Copy link
Contributor

promag commented May 18, 2020

Code review ACK 1122817.

Only Qt issue I found that could be related is https://bugreports.qt.io/browse/QTBUG-72335.

@jonasschnelli
Copy link
Contributor

utACK 1122817

@jonasschnelli jonasschnelli merged commit c2c15ea into bitcoin:master May 29, 2020
@hebasto hebasto deleted the 20200111-qttest-minimal-warn branch May 29, 2020 09:00
MarkLTZ added a commit to litecoinz-core/litecoinz that referenced this pull request May 29, 2020
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request May 31, 2020
…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
Fabcien pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Aug 25, 2021
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
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants