PyQt5 QMainWindow/QAxWidget thread problem

164 Views Asked by At

I want to have different thread between QMainWindow and QAxWidget. As I know, QMainWindow should have MainThread. So I write down code as below.

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) have a lot of signal...

I have error that ocx has no that kind of signal when I write 'line★'

What that kind of problem is occurring? ocx should be made in MainThread?

0

There are 0 best solutions below