I am developing a project for one client, where the design has a switch with exclusive options.
Here is a snippet of code that launches and shows two beautiful 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 looks simple:
perform:
() Consult
() Insert
The point is, how do you know which option was checked: "consultRadioButton" or "insertRadioButton"?
Here is an example of trying to get this information:
if self.consultRadioButton.isChecked():
self.call_Consult()
if self.insertRadioButton.isChecked():
self.call_Insert()
But nothing was done when choosing a beacon.
Otherwise, using a connection 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 that didn't work either.
What's missing here ... Any suggestion?
All comments are welcome and appreciated.