我想在QMainWindow
和之间有不同的线程QAxWidget
。据我所知,QMainWindow
应该有MainThread。所以我写下代码如下。
from PyQt5 import QtCore, QtGui, QtWidgets
import sys
class Main_Thread(QtWidgets.QMainWindow):
def __init__(self):
# setting QMainWindow with widgets... + super().__init__()
sub_instance = Sub_Thread()
sub_thread = QtCore.QThread()
sub_instance.moveToThread(sub_thread)
sub_thread.started.connect(sub_instance.run)
sub_thread.start()
class Sub_Thread(QObject):
def __init__(self):
super().__init__()
def run(self):
ocx = QAxContainer.QAxWidget('connection path')
ocx.signal.connect(slot) # line★
ocx(AcitveX)
有很多信号...
ocx
当我写'line★'时出现没有那种信号的错误
发生了什么样的问题?
ocx
应该在MainThread中进行吗?