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

text alignment lost from QAbstractItemModel.data overrides

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P3: Somewhat important
    • None
    • 1.1.0, 5.12.3
    • PySide
    • None
    • Ubuntu linux with the 1.1.1 build built from the source as pulled on march 8.

    Description

      Consider the following code snip in which we right align the data in column 1
      of a model:

      class Model(QtCore.QAbstractItemModel):
      ...
      def data(self, index, role):
      ...
      if role == QtCore.Qt.TextAlignmentRole and index.column()==1:
      return QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter
      ...

      The text is instead of being right aligned is rendered in the upper left hand
      corner of the view cell.

      For context, there is a full example attached including the snip above.

      Note that the second column (column 1) is rendered correctly in version 1.0.9,
      but not in 1.1.0.

      Attachments

        1. pyside_model_bug.py
          2 kB
          Joel B. Mohler
        2. pyside2_model_bug.py
          2 kB
          Jono Hill
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            crmaurei Cristian Maureira-Fredes
            jbmohler Joel B. Mohler
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes