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

QTreeView overlays persistent editors above animation renderings when expanding/collapsing with doubleclick or keyboard

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 5.15, 6.8, 6.9, 6.10
    • Widgets: Itemviews
    • None
    • All

      When using persistent editors (or setIndexWidget) in a tree view and animations are enabled, expanding/collapsing using the keyboard (with MoveLeft and MoveRight cursor actions) or through double click will cause the editor to be still shown above the rendered pixmap of the animation until the animation has ended.

      This does not happen when clicking on the decoration arrow.

      The following example is written in Python (but the issue is not caused by Python bindings) and will reproduce the issue shown in the attached images: the first image shows the initial collapsed view, the second is right after pressing the right arrow key and while the animation is in progress. The same also happens when collapsing.

      This occurs for any editor, no matter the level within the tree structure, as long as a persistent editor/index widget is used.

       

      from PySide6.QtCore import *
      from PySide6.QtGui import *
      from PySide6.QtWidgets import *
      
      class TreeViewBug(QTreeWidget):
          def __init__(self):
              super().__init__()
              self.setAnimated(True)
              self.resize(160, 480)
      
              pixmap = QPixmap(32, 32)
              pixmap.fill(Qt.GlobalColor.transparent)
              qp = QPainter(pixmap)
              qp.drawLine(0, 0, 32, 32)
              qp.drawLine(0, 32, 32, 0)
              qp.drawEllipse(0, 0, 31, 31)
              qp.end()
      
              for i in range(10):
                  parent = QTreeWidgetItem(self)
                  QTreeWidgetItem(parent)
                  editor = QLabel()
                  editor.setPixmap(pixmap)
                  self.setItemWidget(parent, 0, editor)
      
              self.setCurrentItem(self.topLevelItem(0))
      
      
      app = QApplication([])
      test = TreeViewBug()
      test.show()
      app.exec() 

       

      In both cases the problem probably comes from immediately calling updateGeometries() after expand() or collapse(), which happens within moveCursor() and mouseDoubleClickEvent() and nullifies the behavior of the animation.

        1. treebug1.png
          treebug1.png
          4 kB
        2. treebug0.png
          treebug0.png
          3 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            musicamante Maurizio Berti
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes