Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-91774

QTextEdit::cursorForPosition() doesn't work with invisible blocks

    XMLWordPrintable

Details

    • Linux/X11
    • 8aae49019d (qt/qtbase/dev) 8aae49019d (qt/tqtc-qtbase/dev) b3bb20b8bc (qt/qtbase/6.4) b3bb20b8bc (qt/tqtc-qtbase/6.4) 5b5ffd4a2c (qt/tqtc-qtbase/6.2)

    Description

      When a QTextEdit has some invisible blocks, QTextEdit::cursorForPosition() sometimes returns a QTextCursor inside an invisible block (when you click in between blocks where the invisible block would be). If you get the QRectF for this cursor, it will often not be where it is supposed to since the invisible block doesn't have valid coordinates. So if you have a QTextEdit with some invisible blocks, even just clicking around, the cursor will sometimes jump to random other blocks. I created a minimal example to show this bug. The example populates a QTextEdit with 500 blocks and makes roughly half of them invisible. If you click in between two blocks (in the margin space) where an invisible block would be, the cursor will often jump/go to random places it shouldn't be. Feel free to contact me for more information.

      Attachments

        1. main.cpp
          1.0 kB
        2. textedit.pro
          0.1 kB
        For Gerrit Dashboard: QTBUG-91774
        # Subject Branch Project Status CR V

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            jgrauman Joshua Grauman
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There is 1 open Gerrit change