[PyKDE] Segfault with PyQt 2.3 and Qt 2.2.4

Boudewijn Rempt bsarempt at xs4all.nl
Sat Feb 17 09:47:53 GMT 2001


If you run the following script with PyQt 2.3 and Qt 2.2.4, you will
get a segfault - probably a Qt 2.2.4 bug, since it doesn't happen with
Qt 2.2.3. 

If you comment out the setStyle() after initToolBar(), and uncomment
the setStyle() before, the segfault doesn't occur. Also, it only occurs
when there's a separator in the toolbar...

# Python libs
FALSE=0
TRUE=1

from os import *
from qt import *
import sys

class KuraWindow(QMainWindow):

  def __init__(self, *args):

    apply(QMainWindow.__init__,(self,) + args)
    #self.setStyle()   
    self.initToolBar()
    self.setStyle()   
     
  def initToolBar(self):
    self.toolBar=QToolBar(self,'Main')
    self.buttons=[]
    self.toolBar.addSeparator()

  def setStyle(self):
    newstyle=QPlatinumStyle()
    qApp.setStyle(newstyle)

def main():
  app=QApplication(sys.argv)
  mainwin=KuraWindow()
  mainwin.show()
  mainwin.connect(app, SIGNAL('lastWindowClosed()'), app, SLOT('quit()'))
  app.exec_loop()
 
if __name__=="__main__":
  main()







More information about the PyQt mailing list