Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-2252

QAbstractTextDocumentLayout::PaintContext selections field is not accessible to python

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4: Low
    • 6.5.0
    • 5.15.2, 6.4.2
    • PySide
    • None
    • Linux, Python 3, PySide 2 or 6
    • Linux/X11
    • 2cb0a1742 (dev), 901a5e638 (dev), e4bcfaccc (dev)

    Description

      QAbstractTextDocumentLayout::PaintContext.selections is missing from the python bindings, in both PySide2 and PySide6. This leaves python code unable to highlight text when drawing a QTextDocument.

      To reproduce, run this program:

      #!/usr/bin/env python3
      from PySide6.QtGui import QAbstractTextDocumentLayout
      context = QAbstractTextDocumentLayout.PaintContext()
      print(context.selections)

      Expected result:

      []

      Actual result:

      Traceback (most recent call last):
        File "test_paintcontext_selections", line 4, in <module>
          print(context.selections)
      AttributeError: 'PySide2.QtGui.QAbstractTextDocumentLayout.PaintCon' object has no attribute 'selections'

      Workaround: Use PyQt instead of the official bindings. PyQt correctly exposes the selections attribute.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            kleint Friedemann Kleint
            hforest H Forest
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes