diff --git a/libbs/decompilers/ida/hooks.py b/libbs/decompilers/ida/hooks.py index 37a29026..b0833022 100644 --- a/libbs/decompilers/ida/hooks.py +++ b/libbs/decompilers/ida/hooks.py @@ -565,8 +565,12 @@ def local_var_changed(self, vdui, lvar, reset_type=False, reset_name=False, var_ # if IDA_IS_INTERACTIVE: - from PyQt5 import QtCore - from PyQt5.QtGui import QKeyEvent + if idaapi.IDA_SDK_VERSION < 920: + from PyQt5 import QtCore + from PyQt5.QtGui import QKeyEvent + else: + from PySide6 import QtCore + from PySide6.QtGui import QKeyEvent class IDAHotkeyHook(ida_kernwin.UI_Hooks): def __init__(self, keys_to_pass, uiptr): diff --git a/libbs/decompilers/ida/ida_ui.py b/libbs/decompilers/ida/ida_ui.py index fff6331f..0aaadaf4 100644 --- a/libbs/decompilers/ida/ida_ui.py +++ b/libbs/decompilers/ida/ida_ui.py @@ -4,10 +4,16 @@ try: import sip except ImportError: - import PyQt5.sip as sip + if idaapi.IDA_SDK_VERSION < 920: + import PyQt5.sip as sip + else: + import PyQt6.sip as sip from libbs.ui.version import set_ui_version -set_ui_version("PyQt5") +if idaapi.IDA_SDK_VERSION < 920: + set_ui_version("PyQt5") +else: + set_ui_version("PySide6") from libbs.ui.qt_objects import QWidget, QVBoxLayout _l = logging.getLogger(__name__) @@ -39,7 +45,11 @@ def __init__(self, options): class IDAWidgetWrapper(object): def __init__(self, qt_cls, window_name: str, *args, **kwargs): self.twidget = idaapi.create_empty_widget(window_name) - self.widget = sip.wrapinstance(int(self.twidget), QWidget) + if idaapi.IDA_SDK_VERSION < 920: + self.widget = sip.wrapinstance(int(self.twidget), QWidget) + else: + from shiboken6 import wrapInstance + self.widget = wrapInstance(int(self.twidget), QWidget) self.name = window_name self.widget.name = window_name self.width_hint = 250 diff --git a/libbs/decompilers/ida/interface.py b/libbs/decompilers/ida/interface.py index f4ef3774..133c7cb7 100755 --- a/libbs/decompilers/ida/interface.py +++ b/libbs/decompilers/ida/interface.py @@ -40,8 +40,11 @@ def __init__(self, **kwargs): self._deleted_artifacts = defaultdict(set) self.cached_ord_to_type_names = {} + compatible_qt_version = "PySide6" + if idaapi.IDA_SDK_VERSION < 920: + compatible_qt_version = "PyQt5" super().__init__( - name="ida", qt_version="PyQt5", artifact_lifter=IDAArtifactLifter(self), + name="ida", qt_version=compatible_qt_version, artifact_lifter=IDAArtifactLifter(self), decompiler_available=compat.initialize_decompiler(), **kwargs )