私はpyQt4を使用しています。私はpyQt5を変換したいと思います。 しかし、pyQt5はnew-style signal and slotしかサポートしていないので、old-style signal and slotをpyQt5に使用できませんでした。 したがって、ActiveXからイベントを受信できませんでした。pyQt5でActiveXイベントを受け取る方法は?
私に解決策を教えてください。
このコードはpyQt4バージョンです。
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")
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")
? – ekhumoro