I am developing a project for one customer, where the design has a radio button with exclusive options.
Here is a piece of the code that runs and show two nice radio buttons:
self.performGroupBox = QtGui.QGroupBox(self.centralwidget)
self.performGroupBox.setGeometry(QtCore.QRect(50, 20, 181, 121))
self.performGroupBox.setObjectName("performGroupBox")
self.consultRadioButton = QtGui.QRadioButton(self.performGroupBox)
self.consultRadioButton.setGeometry(QtCore.QRect(40, 30, 84, 18))
self.consultRadioButton.setObjectName("consultRadioButton")
self.insertRadioButton = QtGui.QRadioButton(self.performGroupBox)
self.insertRadioButton.setGeometry(QtCore.QRect(40, 60, 84, 18))
self.insertRadioButton.setObjectName("insertRadioButton")
it just looks like:
perform:
() Consult
() Insert
The point here is, how to know what choice was marked: "consultRadioButton" or "insertRadioButton"?
Here is a sample on trying to get this information:
if self.consultRadioButton.isChecked():
self.call_Consult()
if self.insertRadioButton.isChecked():
self.call_Insert()
But it didn t do anything when the radiobutton is chosen.
Otherwise, using connect should be another option:
QtCore.QObject.connect(self.consultRadioButton, QtCore.SIGNAL("currentIndexChanged(QString)"), self.call_Consult)
QtCore.QObject.connect(self.insertRadioButton, QtCore.SIGNAL("currentIndexChanged(QString)"), self.call_Insert)
But it didn t work either.
What is missing here... Any suggestion?
All comments are highly welcome and appreciated.