qt: Remove QFont warnings with QT_QPA_PLATFORM=minimal #17908

pull hebasto wants to merge 1 commits into bitcoin:master from hebasto:20200111-qttest-minimal-warn changing 4 files +23 −6
  1. hebasto commented at 12:47 pm on January 11, 2020: member

    This PR removes massive warnings like:

    0QWARN  : ... QFont::setPointSizeF: Point size <= 0 (...), must be greater than 0
    

    from test_bitcoin-qt output.

    On master (e258ce792a4849927a6db51786732d71cbbb65fc):

    0$ ./src/qt/test/test_bitcoin-qt | grep QFont | wc -l
    1~BitcoinApplication : Stopping thread
    2~BitcoinApplication : Stopped thread
    357
    

    With this PR:

    0$ ./src/qt/test/test_bitcoin-qt | grep QFont | wc -l
    1~BitcoinApplication : Stopping thread
    2~BitcoinApplication : Stopped thread
    30
    
  2. fanquake added the label GUI on Jan 11, 2020
  3. fanquake renamed this:
    qa, qt: Remove QFont warnings with QT_QPA_PLATFORM=minimal
    qt: Remove QFont warnings with QT_QPA_PLATFORM=minimal
    on Jan 11, 2020
  4. practicalswift commented at 9:44 am on January 12, 2020: contributor
    ACK 8ab99dd9544e6fa61da1cd77922c85e2970c0416 – tests should be silent in the absence of errors: thanks for fixing! :)
  5. promag commented at 6:33 pm on January 12, 2020: member

    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.

  6. hebasto force-pushed on Jan 14, 2020
  7. hebasto commented at 5:41 pm on January 14, 2020: member

    Updated 8ab99dd9544e6fa61da1cd77922c85e2970c0416 -> d318a14cc87f672198aea7490d76950919357f7d (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.

  8. in src/qt/rpcconsole.cpp:501 in d318a14cc8 outdated
    496@@ -496,7 +497,7 @@ RPCConsole::RPCConsole(interfaces::Node& node, const PlatformStyle *_platformSty
    497     ui->detailWidget->hide();
    498     ui->peerHeading->setText(tr("Select a peer to view detailed information."));
    499 
    500-    consoleFontSize = settings.value(fontSizeSettingsKey, QFontInfo(QFont()).pointSize()).toInt();
    501+    consoleFontSize = settings.value(fontSizeSettingsKey, QFont().pointSize()).toInt();
    


    MarcoFalke commented at 5:58 pm on January 14, 2020:

    Why is this change needed? And what is the observable change?

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


    hebasto commented at 6:03 pm on January 14, 2020:
    If QT_QPA_PLATFORM=minimal (i.e., without window system integration), QFontInfo(QFont()).pointSize() returns -1.

    MarcoFalke commented at 6:07 pm on January 14, 2020:
    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?

    hebasto commented at 6:25 pm on January 14, 2020:
    It seems there is no harm when RPCConsole::setFontSize() is called. With non-qminimal plugin Qt always could draw a correct font.

    MarcoFalke commented at 6:36 pm on January 14, 2020:
    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.

    hebasto commented at 9:00 am on January 19, 2020:

    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.

  9. DrahtBot commented at 11:30 pm on March 2, 2020: member

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

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #18897 (qt: Handle exceptions instead of crash by hebasto)

    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.

  10. in src/qt/transactionview.cpp:403 in d318a14cc8 outdated
    396@@ -396,8 +397,9 @@ void TransactionView::contextualMenu(const QPoint &point)
    397     abandonAction->setEnabled(model->wallet().transactionCanBeAbandoned(hash));
    398     bumpFeeAction->setEnabled(model->wallet().transactionCanBeBumped(hash));
    399 
    400-    if(index.isValid())
    401-    {
    402+    if (index.isValid() && QGuiApplication::platformName() != "minimal") {
    403+        // The qminimal plugin does not provide window system integration.
    404+        // Skip this call to suppress warnings during the tests with QT_QPA_PLATFORM=minimal.
    405         contextMenu->popup(transactionView->viewport()->mapToGlobal(point));
    


    promag commented at 1:28 am on March 15, 2020:
    If you keep this approach maybe refactor this to something like GUIUtil::popup(contextMenu, ...) and remove the new include which is already in guiutil.cpp.

    hebasto commented at 8:32 pm on March 15, 2020:
    Done.
  11. promag commented at 1:28 am on March 15, 2020: member

    Alternatively you could filter the warning in DebugMessageHandler or even call qInstallMessageHandler with a specific test message handler. @hebasto have you considered this approach?

  12. hebasto commented at 7:40 pm on March 15, 2020: member

    @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

  13. hebasto force-pushed on Mar 15, 2020
  14. hebasto commented at 8:32 pm on March 15, 2020: member

    Updated d318a14cc87f672198aea7490d76950919357f7d -> 50c2791e35929c53c351e82a6188e2b58f5151e8 (pr17908.02 -> pr17908.03, diff):

  15. in src/qt/guiutil.cpp:907 in 50c2791e35 outdated
    903@@ -904,4 +904,11 @@ void LogQtInfo()
    904     }
    905 }
    906 
    907+void QMenuPopup(QMenu* menu, const QPoint& point, QAction* atAction)
    


    promag commented at 10:56 pm on April 26, 2020:
    nit, I’d name popupMenu, not sure why the Q prefix.

    hebasto commented at 3:05 am on April 27, 2020:
  16. in src/qt/guiutil.cpp:910 in 50c2791e35 outdated
    903@@ -904,4 +904,11 @@ void LogQtInfo()
    904     }
    905 }
    906 
    907+void QMenuPopup(QMenu* menu, const QPoint& point, QAction* atAction)
    908+{
    909+    // The qminimal plugin does not provide window system integration.
    910+    if (QGuiApplication::platformName() == "minimal") return;
    


    promag commented at 10:58 pm on April 26, 2020:
    nit, QApplication just to make it clear what’s the required include.

    hebasto commented at 2:43 am on April 27, 2020:
    Actually, QApplication inherits platformName() from QGuiApplication :tiger2:

    hebasto commented at 3:05 am on April 27, 2020:
  17. promag commented at 11:09 pm on April 26, 2020: member
    Code review ACK 50c2791e35929c53c351e82a6188e2b58f5151e8.
  18. hebasto force-pushed on Apr 27, 2020
  19. hebasto commented at 3:05 am on April 27, 2020: member

    Updated 50c2791e35929c53c351e82a6188e2b58f5151e8 -> 2a388bdf8f6685d639713c903443458afc2458e2 (pr17908.03 -> pr17908.04, diff):

  20. promag commented at 8:08 am on April 27, 2020: member
    Code review ACK 2a388bdf8f6685d639713c903443458afc2458e2.
  21. DrahtBot added the label Needs rebase on May 13, 2020
  22. qt: Remove QFont warnings with QPA=minimal 1122817c19
  23. hebasto force-pushed on May 13, 2020
  24. hebasto commented at 1:06 pm on May 13, 2020: member
    Rebased 2a388bdf8f6685d639713c903443458afc2458e2 -> 1122817c194ed49abf896e68604e725c3b5c8569 (pr17908.04 -> pr17908.05) due to the conflict with #16710.
  25. DrahtBot removed the label Needs rebase on May 13, 2020
  26. promag commented at 10:49 pm on May 18, 2020: member

    Code review ACK 1122817c194ed49abf896e68604e725c3b5c8569.

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

  27. jonasschnelli commented at 8:17 am on May 29, 2020: contributor
    utACK 1122817c194ed49abf896e68604e725c3b5c8569
  28. jonasschnelli merged this on May 29, 2020
  29. jonasschnelli closed this on May 29, 2020

  30. hebasto deleted the branch on May 29, 2020
  31. MarkLTZ referenced this in commit bf9f5027c9 on May 29, 2020
  32. sidhujag referenced this in commit 99bd83768b on May 31, 2020
  33. Fabcien referenced this in commit 7569951bd3 on Aug 25, 2021
  34. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-07-05 22:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me