PDA

View Full Version : QComboBox problem (donno wat to do!)



bishop
15th July 2011, 08:28
i am using python2.7 and pyqt4. i built a gui using designer . it has a qcombobox and i am able to populate the list but donno how to catch the signal when it is activated(when an item is selected from the list in qcombobox)



QtCore.QObject.connect(self.ui.qcombobox, QtCore.SIGNAL("activated()"),????????)

mvuori
15th July 2011, 11:03
Check out http://techbase.kde.org/Development/Tutorials/Python_introduction_to_signals_and_slots

Now, from the combobox documentation you'll see that the activated signal send an int parameter. You need to connect the signal to a method that can handle a number as parameter:


def rowselected(rownumber)
print "Row " + rownumber + " selected"

QObject.connect(qcombobox, SIGNAL("activated(int)"), rowselected)

bishop
19th July 2011, 06:10
hey thanks for the help was able to get it working . i am facing with one more problem please help me out. details posted in this thread. http://www.qtcentre.org/threads/43202-serial-port-terminal-using-PyQT-and-PySerial