qt: Get rid of cursor in out-of-focus labels #19210

pull hebasto wants to merge 1 commits into bitcoin:master from hebasto:200608-cursor changing 3 files +39 −0
  1. hebasto commented at 1:58 pm on June 8, 2020: member

    After clicking on QLabel with selectable text the cursor remains forever:

    47532924-65e7b200-d8ba-11e8-9254-7bde658961cb

    This PR fixes this visual bug.

    Earlier attempts to fix this issue:

  2. fanquake added the label GUI on Jun 8, 2020
  3. laanwj commented at 12:31 pm on June 9, 2020: member

    Concept ACK, multiple cursors visible is wtf-level confusing.

    Should this be reported as an upstream issue too?

  4. in src/qt/guiutil.cpp:463 in 4b7c95324f outdated
    458+bool LabelOutOfFocusEventFilter::eventFilter(QObject* watched, QEvent* event)
    459+{
    460+    if (event->type() == QEvent::FocusOut) {
    461+        QLabel* label = qobject_cast<QLabel*>(watched);
    462+        if (label) {
    463+            const QString content = label->text();
    


    promag commented at 10:01 pm on June 10, 2020:

    This also works

    0          auto flags = label->textInteractionFlags();
    1          label->setTextInteractionFlags(Qt::NoTextInteraction);
    2          label->setTextInteractionFlags(flags);
    

    hebasto commented at 3:00 pm on July 3, 2020:

    It looks more effective. Thanks!

    Updated.

  5. promag commented at 10:02 pm on June 10, 2020: member
    Concept ACK. Tested this approach and the one I’m suggesting. Does it make sense to have a dedicated label subclass?
  6. luke-jr commented at 4:24 am on June 11, 2020: member
    This seems ugly. Ideally, if the focus returns to the label, the cursor position shouldn’t be lost.
  7. hebasto commented at 2:07 pm on July 3, 2020: member

    @laanwj

    Should this be reported as an upstream issue too?

    https://bugreports.qt.io/browse/QTBUG-59514

  8. hebasto force-pushed on Jul 3, 2020
  9. hebasto commented at 2:58 pm on July 3, 2020: member

    Updated 4b7c95324f40738185f52da161d144f6e9f0c484 -> 5dbe2d60a83c06d550f104d79e1b9c82e49c7008 (pr19210.01 -> pr19210.02, diff):

    This also works

    • fixed context menu event handling
  10. hebasto commented at 3:03 pm on July 3, 2020: member

    @promag

    Does it make sense to have a dedicated label subclass?

    I think, it does not required. @luke-jr

    This seems ugly. Ideally, if the focus returns to the label, the cursor position shouldn’t be lost.

    Unfortunately, the QLabel class has no property that holds the cursor position.

  11. in src/qt/bitcoin.cpp:560 in 5dbe2d60a8 outdated
    555@@ -556,6 +556,9 @@ int GuiMain(int argc, char* argv[])
    556     /// 9. Main GUI initialization
    557     // Install global event filter that makes sure that long tooltips can be word-wrapped
    558     app.installEventFilter(new GUIUtil::ToolTipToRichTextFilter(TOOLTIP_WRAP_THRESHOLD, &app));
    559+    // Install global event filter that makes sure that out-of-focus labels do not contain text cursor.
    560+    // This is a temporary fix of QTBUG-59514.
    


    promag commented at 3:22 pm on July 3, 2020:
    nit, move/copy this comment to class doc.

    hebasto commented at 3:32 pm on July 3, 2020:
  12. promag commented at 3:26 pm on July 3, 2020: member
    Code review ACK 5dbe2d60a83c06d550f104d79e1b9c82e49c7008.
  13. qt: Get rid of cursor in out-of-focus labels
    This change is a temporary fix of QTBUG-59514.
    bd315eb5e2
  14. hebasto force-pushed on Jul 3, 2020
  15. hebasto commented at 3:31 pm on July 3, 2020: member

    Updated 5dbe2d60a83c06d550f104d79e1b9c82e49c7008 -> bd315eb5e27d49d47759ae9417328427426cb269 (pr19210.02 -> pr19210.03, diff):

    nit, move/copy this comment to class doc

  16. promag commented at 8:37 am on July 6, 2020: member
    Code review ACK bd315eb5e27d49d47759ae9417328427426cb269.
  17. fanquake commented at 2:41 pm on July 9, 2020: member
    @laanwj can you take another look here? If you’re happy with this change as-is, we can probably merge is here rather than punting to the GUI repo. We’ve now also got an upstream issue to refer too.
  18. laanwj commented at 2:47 pm on July 15, 2020: member
    Tested ACK bd315eb5e27d49d47759ae9417328427426cb269
  19. laanwj merged this on Jul 15, 2020
  20. laanwj closed this on Jul 15, 2020

  21. hebasto deleted the branch on Jul 15, 2020
  22. sidhujag referenced this in commit 6db274eaa0 on Jul 16, 2020
  23. deadalnix referenced this in commit 1c0fc5229d on Sep 1, 2021
  24. PastaPastaPasta referenced this in commit 3b0144beeb on Sep 21, 2021
  25. kittywhiskers referenced this in commit f8470b479a on Oct 12, 2021
  26. 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-12-18 21:12 UTC

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