I've been using pyQt4. I'd like to convert pyQt5. but, I couldn't use old-style signal and slot in pyQt5 because pyQt5 supports only new-style signal and slot. Therefore, I couldn't receive events from ActiveX.
Please, give me solution.
this code is pyQt4 version.
from PyQt4.QtCore import SIGNAL, QObject
from PyQt4.QAxContainer import QAxWidget
class ActiveXExtend(QObject):
def __init__(self, view):
super().__init__()
self.view = view
self.ocx = QAxWidget("KHOPENAPI.KHOpenAPICtrl.1")
# receive ActiveX event.
self.ocx.connect(self.ocx, SIGNAL("OnReceiveMsg(QString, QString, QString, QString)"), self._OnReceiveMsg)
# event handler
def _OnReceiveMsg(self, scrNo, rQName, trCode, msg):
print("receive event")
I try to convert pyQt5.
from PyQt5.QtCore import QObject
from PyQt5.QAxContainer import QAxWidget
class ActiveXExtend(QObject):
def __init__(self, view):
super().__init__()
self.view = view
self.ocx = QAxWidget("KHOPENAPI.KHOpenAPICtrl.1")
# receive ActiveX event.
# old-style is not supported.
# self.ocx.connect(self.ocx, SIGNAL("OnReceiveMsg(QString, QString, QString, QString)"), self._OnReceiveMsg)
# event handler
def _OnReceiveMsg(self, scrNo, rQName, trCode, msg):
print("receive event")