def mousePressEvent(self, event):
        """Intercept mouse events to properly handle clicks on the expand/collapse indicator."""

        index = self.indexAt(event.pos())  # Get the clicked index
        if not index.isValid():
            super().mousePressEvent(event)
            return

        indicator_rect = QRect(self.visualRect(index))
        indicator_rect.setLeft(self.viewport().rect().x())
        indicator_rect.setWidth(indicator_rect.height())

        # If click is within the indicator area, manually trigger expand/collapse
        if indicator_rect.contains(event.pos()):
            self.setExpanded(index, not self.isExpanded(index))
            return  # Prevent further event propagation

        # Otherwise, proceed with the normal event handling
        super().mousePressEvent(event)
Intercept mouse events to properly handle clicks on the expand/collapse indicator.
angrmanagement/ui/widgets/qproperty_editor.py