Version 2024.1 of Dragonfly introduces a new version of Qt (and PyQt): 6.4. This means that PyQt code of user written plugins and additions must be migrated to this version of Qt, from Qt5 to Qt6.


Qt have their own migration instructions: https://doc.qt.io/qt-6/portingguide.html, they should be read and understood before tackling the Dragonfly changes.



Here are the broad lines of what needs to be done, in the Dragonfly context.



Imports


All import statements must be changed, from PyQt5 to PyQt6, for example:


from PyQt5.QtCore import QObject


to


from PyQt6.QtCore import QObject



These changes are easily handled with a single search and replace command.



Enums


PyQt made a significant change in their enum/constant handling.


Code like this:


if self.ui.checkShowScalebar.checkState() == Qt.Checked:


needs to be changed so:


if self.ui.checkShowScalebar.checkState() == Qt.CheckState.Checked:



 Code like this:


chooser.setWindowFlags(Qt.Window | Qt.WindowTitleHint | Qt.WindowCloseButtonHint)
if chooser.exec() != QDialog.Rejected:


needs to be changed so:


chooser.setWindowFlags(Qt.WindowType.Window | Qt.WindowType.WindowTitleHint | Qt.WindowType.WindowCloseButtonHint)
if chooser.exec() != QDialog.DialogCode.Rejected:



Most of the Enums can be found here: https://doc.qt.io/qt-6/qt.html. Unfortunately, it's impossible to handle these changes with a single search and replace command.


Other changes


All other changes are already outlined in the Qt documentation, but normally the above covers most situations. 


This exercise is usually very empirical: you run the code, and inspect the console/logs looking for errors.