title: How to get which QradioButton invoke the SLOT
body: <p>I create several QradioButton and connect to the same SLOT. In the slot, I want to know which QradioButton invoke the slot and do the related action. I found there is a way by using qobject_cast and QObject::sender(), but it seems not work. Here is the code:</p>
  
  <p>header file:</p>
  
  <pre><code>class dialoginput : public QDialog
  {
      Q_OBJECT
  
  public:
      dialoginput(QWidget *parent = 0);
      QRadioButton *radio1;
      QRadioButton *radio2;
      QRadioButton *radio3;
  private slots:
      void setText_2();
  private:
      QLabel *label_0_0;
      QLabel *label_1;
  };
  </code></pre>
  
  <p>main file:</p>
  
  <pre><code>dialoginput::dialoginput(QWidget *parent): QDialog(parent){
  
      label_0_0 = new QLabel("label_1:");
      label_1 = new QLabel;  
  
      QWidget *window = new QWidget;
      QVBoxLayout *windowLayout = new QVBoxLayout;
  
      QGroupBox *box = new QGroupBox("Display Type");
      radio1 = new QRadioButton("3");
      radio2 = new QRadioButton("5");
      radio3 = new QRadioButton("9");
      QVBoxLayout *radioLayout = new QVBoxLayout;
  
      connect(radio1,SIGNAL(clicked()),this,SLOT(setText_2()));
      connect(radio2,SIGNAL(clicked()),this,SLOT(setText_2()));
      connect(radio3,SIGNAL(clicked()),this,SLOT(setText_2()));
  
      radioLayout-&gt;addWidget(radio1);
      radioLayout-&gt;addWidget(radio2);
      radioLayout-&gt;addWidget(radio3);
  
      box-&gt;setLayout(radioLayout);
  
      windowLayout-&gt;addWidget(box);
      windowLayout-&gt;addWidget(label_0_0);
      windowLayout-&gt;addWidget(label_1);
  
      window-&gt;setLayout(windowLayout);
      window-&gt;show();
  
  }
  void dialoginput::setText_2(){
  
      QObject *object = QObject::sender();
      QRadioButton* pbtn = qobject_cast&lt;QRadioButton*&gt;(object);
      QString name = pbtn-&gt;objectName();
  
      label_1-&gt;setText(name);
  
      if(!QString::compare(name, "3")){       
      }
      else if(!QString::compare(name, "5")){
      }
      else if(!QString::compare(name, "9")){
      }
  
  }
  int main(int argc, char *argv[])
  {
      QApplication a(argc, argv);
  
      dialoginput *input = new dialoginput();
  
      return a.exec();
  }
  </code></pre>