NodeGraphQt icon indicating copy to clipboard operation
NodeGraphQt copied to clipboard

Rebase #327 and continue migration to PySide6/PyQt6 using qtpy compat layer

Open jack-mil opened this issue 1 year ago • 4 comments

I am beginning to work on a Qt6 project that will use this library, so I needed to see how feasible porting to Qt6 would be. Work so far is simply rebasing @jowr's work from PR #327 onto main branch, and cleaning up some code added after that PR.

I have done preliminary testing using the example demo with Python 3.12 and QtPy 2.4.1 with both PySide6 v6.7.2 and PyQt6 v6.7.0. ~~(Pyside v6.7.0 has some open bugs with inheritance that prevent the modules from importing properly)~~ Update: These issues are resolved as of v6.7.2 of PySide6, meaning this branch works on all current versions of Qt bindings for Python

Relates to #231

jack-mil avatar May 15 '24 21:05 jack-mil

Very interested on getting an update on this :)

laurapons avatar Jun 06 '24 09:06 laurapons

I have been using the changes from this fork succesfully for a project with PySide 6.6.3.1 with no issues

jack-mil avatar Jun 06 '24 15:06 jack-mil

@jack-mil trying to get your code working on my end - running into the following error using PySide 6.6.3.1 running the example:

Traceback (most recent call last):
  File "NodeGraphQt\examples\basic_example.py", line 28, in <module>
    graph = NodeGraph()
            ^^^^^^^^^^^
  File "NodeGraphQt\examples\NodeGraphQt\base\graph.py", line 158, in __init__
    kwargs.get('viewer') or NodeViewer(undo_stack=self._undo_stack)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "NodeGraphQt\examples\NodeGraphQt\widgets\viewer.py", line 105, in __init__
    self._cursor_text.setFlag(self._cursor_text.ItemIsSelectable, False)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'PySide6.QtWidgets.QGraphicsTextItem' object has no attribute 'ItemIsSelectable'

I get further attribute errors when commenting out the ItemIsSelectable lines. Were you able to run your modifications with the provided example?

mfieschko avatar Jun 24 '24 03:06 mfieschko

@fieschkon It's possibly an issue with the QtPy or python version you are running? This is working for me with

  • Python 3.12.3
  • PySide6 6.6.3.1 and 6.7.2
  • QtPy 2.4.1

I can also confirm that upgrading to PySide6 6.7.2 seems to have resolved the issue that was preventing 6.7.0 from working. So, the changes on this branch do work for the most recent versions of PySide6 and QtPy as of 6/25/24.

jack-mil avatar Jun 25 '24 13:06 jack-mil

With the recent commits and use of v1.4.1 of qt.py which adds compatibility support for Pyside6 and Pyqt6, along with basic initial testing on my end, it seems that PySide6 (Qt 6) is mostly working for Python versions up to 3.11.

I'll go ahead and close this to reduce clutter as other development work is going on.

jack-mil avatar Jun 18 '25 20:06 jack-mil