Hi,

see attached python program and ui-file for a minimal example that
blockSignals don't work with QCheckBox. When the checkbox' setChecked is
called it's stateChanged() signal is emitted and the slot is executed.
This is as of now the only widget where I discovered that behaviour
(checked lineedit, spinbox, combobox, datetimeedit, table, tree and
list view push and radiobuttons)

Andreas

-- 
Your lover will never wish to leave you.
<ui version="4.0" >
 <author></author>
 <comment></comment>
 <exportmacro></exportmacro>
 <class>Form</class>
 <widget class="QWidget" name="Form" >
  <property name="geometry" >
   <rect>
    <x>0</x>
    <y>0</y>
    <width>312</width>
    <height>246</height>
   </rect>
  </property>
  <property name="windowTitle" >
   <string>Form</string>
  </property>
  <layout class="QHBoxLayout" >
   <property name="margin" >
    <number>9</number>
   </property>
   <property name="spacing" >
    <number>6</number>
   </property>
   <item>
    <widget class="QCheckBox" name="check" >
     <property name="text" >
      <string>CheckBox</string>
     </property>
    </widget>
   </item>
  </layout>
 </widget>
 <pixmapfunction></pixmapfunction>
 <resources/>
 <connections/>
</ui>
import sys
import cStringIO
import os
from PyQt4 import QtCore, QtGui
# this time, we use the code generator
from PyQt4.uic.Compiler import compileUiToType

class parentWidget(QtGui.QWidget, compileUiToType("test.ui")):
        def __init__(self):
                QtGui.QWidget.__init__(self)
                self.setupUi(self)
        def setChk(self, check):
                self.blockSignals(True)
                self.check.setChecked(check)
                self.blockSignals(False)
        
        @QtCore.pyqtSignature("on_check_stateChanged(int)")
        def on_check_stateChanged(self, state):
                print "tst"

if __name__ == "__main__":
        app =  QtGui.QApplication(sys.argv)
        w = parentWidget()
        w.show()
        w.setChk(True)
        sys.exit(app.exec_())
_______________________________________________
PyKDE mailing list    [email protected]
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

Reply via email to