-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.15, 6.8, 6.9, 6.10
-
None
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.