Hello,

I am testing the current beta of (k)ubuntu 10.10 maverick meerkat and 
recognized that my pyqt application stopped to work properly.

After some time of research I could tie the problem down to the following 
situation:

I have a qcheckbox in a subclassed qobject and connected the sigal 
statechanged which works perfectly in the previous versions. E.g. ubuntu 
lucid.
I also checked if the signal works without a subclass - it does on both pyqt 
versions.

There might be a problem in my code as well which was not causing malfunction 
before, so please see the code below. It could also be a bug in the nerw 
version?

Can you take a look into this and help me?

Thank you

Peter

------------------------------------

#!/usr/bin/python
# -*- coding: utf-8 -*-

# test
#


#signal stateChanged of subclass is called correctly in python-qt4 
4.7.3-1ubuntu2~lucid1~ppa3 on lucid lynx
#
#does not work on maverick meerkat beta: Version: 4.7.4-0ubuntu1

import sys, os
import locale
from os.path import dirname, join
import time

try:
  from PyQt4.QtGui import *
  from PyQt4 import QtCore
  from PyQt4.QtCore import *
  import urllib
except:
  print "Loading of python libraries failed, please install python-qt4"
  exit(1)


class vidgrabMainWindow(QMainWindow):
    """ Main window of jase """
    def __init__(self, parent=None):
        QMainWindow.__init__(self, parent)
        self.setMinimumSize(800,200)
        self.setupWindow()
        
    def setupWindow(self):
        """ Initialize main widget """
        
        self.mainWidget = QWidget(self)
        self.setCentralWidget(self.mainWidget)
        
        self.buttonLayout = QGridLayout()
        self.buttonLayout.setSpacing(3)
        self.mainWidget.setLayout(self.buttonLayout)
        self.checkSub = workLoadItem(self)

class workLoadItem(QObject):

    def __init__(self, parent=None):
        self.parent = parent
        self.name = QLabel()
        self.name.setText("...")
        self.checkBox = QCheckBox()
        self.checkBox.setText("Test")
        self.connect(self.checkBox, SIGNAL("stateChanged(int)"), 
self.checkCalled)
        self.parent.buttonLayout.addWidget(self.checkBox, 0, 1)
        
    def checkCalled(self, i = None):
        if i == 2:
          self.checkBox.setText("Checked")
        elif i == 0:
          self.checkBox.setText("UnChecked")
        else:
          self.checkBox.setText("None")
        

def main():
    app = QApplication(sys.argv)
    app.setOrganizationName("jackcy")
    app.setOrganizationDomain("...")
    app.setApplicationName("test")
    app.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()"))
    
    form = vidgrabMainWindow()
    form.show()

    app.exec_()
    
    def quit(self):
        QApplication.quit(self)


if __name__ == '__main__':
  """ Main function """
  main()
  

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to