The setSelectionArea() API changed in PySide6 6.7 - it now requires
an ItemSelectionOperation parameter before ItemSelectionMode.
Files added:
- patches/nodegraphqt_pyside6_compat.patch: Git-style patch file
- patches/UPSTREAM_ISSUE.md: Issue report for upstream project
- scripts/patch_nodegraphqt.py: Script to auto-apply the patch
The patch fixes rubber band selection errors when dragging in the
node graph viewer. Run after pip install:
python scripts/patch_nodegraphqt.py
Co-Authored-By: Claude Opus 4.5 <[email protected]>
2.0 KiB
2.0 KiB
PySide6 6.7+ Compatibility Issue: setSelectionArea API Change
Issue
When using NodeGraphQt-QuiltiX-fork with PySide6 6.7+, dragging a rubber band selection in the node graph causes repeated TypeError exceptions:
TypeError: 'PySide6.QtWidgets.QGraphicsScene.setSelectionArea' called with wrong argument types:
PySide6.QtWidgets.QGraphicsScene.setSelectionArea(QPainterPath, ItemSelectionMode)
Supported signatures:
PySide6.QtWidgets.QGraphicsScene.setSelectionArea(PySide6.QtGui.QPainterPath, PySide6.QtGui.QTransform)
PySide6.QtWidgets.QGraphicsScene.setSelectionArea(PySide6.QtGui.QPainterPath, PySide6.QtCore.Qt.ItemSelectionOperation = Instance(Qt.ReplaceSelection), PySide6.QtCore.Qt.ItemSelectionMode = Instance(Qt.IntersectsItemShape), PySide6.QtGui.QTransform = Default(QTransform))
Root Cause
The QGraphicsScene.setSelectionArea() method signature changed in PySide6 6.7. The old signature allowed:
setSelectionArea(path, mode) # mode = Qt.ItemSelectionMode
The new signature requires:
setSelectionArea(path, operation, mode) # operation = Qt.ItemSelectionOperation
Affected File
NodeGraphQt/widgets/viewer.py line 524-526
Current Code
self.scene().setSelectionArea(
path, QtCore.Qt.IntersectsItemShape
)
Fix
self.scene().setSelectionArea(
path, QtCore.Qt.ReplaceSelection,
QtCore.Qt.IntersectsItemShape
)
Environment
- Python: 3.12
- PySide6: 6.6.3.1 (installed by NodeGraphQt-QuiltiX-fork, but issue affects 6.7+)
- NodeGraphQt-QuiltiX-fork: 0.7.0
Workaround
Apply this patch after installation:
# In viewer.py, change line 524-526 from:
self.scene().setSelectionArea(
path, QtCore.Qt.IntersectsItemShape
)
# To:
self.scene().setSelectionArea(
path, QtCore.Qt.ReplaceSelection,
QtCore.Qt.IntersectsItemShape
)
Related
This issue may also exist in:
- Original NodeGraphQt
- OdenGraphQt
- Other forks
The fix is backward compatible with older PySide6 versions that support the 3-argument signature.