Basically i want to make a qtabwidget and start every widget in it in a different thread. So far i tried to emit the widget which does not work cause slot does not support Qwidget. I can however start a widget class in the main thread in which i call a thread and that thread calls another class that draws a QWidget. That works, but as soon as i move my mouse to the window called in the thread i get
QApplication: Object event filter cannot be in a different thread.
So it's probably not the way it should be done
#!/usr/bin/env python
from PyQt4 import QtGui
from PyQt4 import QtCore
from PyQt4.QtCore import QThread, SIGNAL
import sys
class seconwidget(QtGui.QWidget):
def showit(self, toshow):
toshow.show()
def __init__(self):
QtGui.QDialog.__init__(self)
self.setGeometry(300,300,400,400)
self.setWindowTitle("tryit")
self.show()
class seconddialog(QThread):
def __init__(self):
QThread.__init__(self)
def run(self):
self.newwid=seconwidget()
class mainwindow(QtGui.QWidget):
def showit(self, toshow):
toshow.show()
def __init__(self):
QtGui.QDialog.__init__(self)
self.setGeometry(300,300,400,400)
self.setWindowTitle("try")
self.show()
self.show_thread=seconddialog()
self.show_thread.start()
if __name__=='__main__':
app=QtGui.QApplication(sys.argv)
wind=mainwindow()
app.exec_()
Can it be done and what's the proper way to do it?