PySide Bugzilla Closed for New Bugs

PySide is now a Qt Add-on and uses the Qt Project's JIRA Bug Tracker instead of this Bugzilla instance. This Bugzilla is left for reference purposes.

Bug 423 - QThread default run is broken
: QThread default run is broken
Status: CLOSED FIXED
Product: PySide
Classification: Unclassified
Component: QtCore
: 0.4.2
: All All
: P3 major
Assigned To: renato filho
:
:
:
  Show dependency treegraph
 
Reported: 2010-10-20 17:24 EEST by kbrownlees
Modified: 2010-11-25 17:48 EET (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kbrownlees 2010-10-20 17:24:01 EEST
Still not able to test on HEAD so apologies if this is fixed.

According to the documentation you should be able to create and instance of
QThread, call thread.start() and have it run. It doesn't work in PySide how
ever (the difference between exec() and exec_()?)

Here are acouple of scratches, the first one never launches the GUI window.

import sys
from PySide import QtCore, QtGui

def main():
    app = QtGui.QApplication(sys.argv)
    mainWindow = QtGui.QMainWindow()
    mainWindow.show()
    thread = QtCore.QThread()
    thread.start()
    app.exec_()

if __name__ == '__main__':
    main()

Can fix the problem by implementing run and calling exec_:

import sys
from PySide import QtCore, QtGui

class MyThread(QtCore.QThread):
    def run(self):
        self.exec_()

def main():
    app = QtGui.QApplication(sys.argv)
    mainWindow = QtGui.QMainWindow()
    mainWindow.show()
    thread = MyThread()
    thread.start()
    app.exec_()

if __name__ == '__main__':
    main()
Comment 1 renato filho 2010-10-26 16:38:56 EEST
fixed on shiboken commit:

commit 65e55dba0ff70976e67d8c46699a6ca629ef4bf0
Author: renatofilho <renato.filho@openbossa.org>
Date:   Tue Oct 26 15:38:21 2010 -0300
Comment 2 renato filho 2010-11-25 17:48:15 EET
released on 1.0.0~beta1