Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved]why several rationbutton cannot be connect to same slot?
Forum Updated to NodeBB v4.3 + New Features

[Solved]why several rationbutton cannot be connect to same slot?

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    shalongbasi
    wrote on last edited by
    #1

    I used QtDesigner created a interface which includes FD, TD50, TD33 , TD25 four radio buttons in a group. the code generated by UI is
    @
    layoutWidget_3 = new QWidget(WaveFormGroupBox);
    layoutWidget_3->setObjectName(QString::fromUtf8("layoutWidget_3"));
    layoutWidget_3->setGeometry(QRect(10, 31, 181, 62));
    WaveFormLayout = new QGridLayout(layoutWidget_3);
    WaveFormLayout->setSpacing(6);
    WaveFormLayout->setContentsMargins(11, 11, 11, 11);
    WaveFormLayout->setObjectName(QString::fromUtf8("WaveFormLayout"));
    WaveFormLayout->setContentsMargins(0, 0, 0, 0);
    FDradioButton = new QRadioButton(layoutWidget_3);
    FDradioButton->setObjectName(QString::fromUtf8("FDradioButton"));
    FDradioButton->setChecked(true);

        WaveFormLayout->addWidget(FDradioButton, 0, 0, 1, 1);
    
        TD25radioButton = new QRadioButton(layoutWidget_3);
        TD25radioButton->setObjectName(QString::fromUtf8("TD25radioButton"));
    
        WaveFormLayout->addWidget(TD25radioButton, 1, 0, 1, 1);
    
        TD33radioButton = new QRadioButton(layoutWidget_3);
        TD33radioButton->setObjectName(QString::fromUtf8("TD33radioButton"));
    
        WaveFormLayout->addWidget(TD33radioButton, 1, 1, 1, 1);
    
        TD50radioButton = new QRadioButton(layoutWidget_3);
        TD50radioButton->setObjectName(QString::fromUtf8("TD50radioButton"));
    
        WaveFormLayout->addWidget(TD50radioButton, 0, 1, 1, 1);
    

    @

    then in the constructor of my class, I tried to connect these radio button to the same slot
    @
    connect(ui->FDradioButton, SIGNAL(toggled()), this, SLOT(waveformToggled()));
    connect(ui->TD50radioButton, SIGNAL(clicked())), this, SLOT(waveformToggled());
    @
    only connection for FDradionButton works, all the others give me compiling error:
    no matching function for call to remote::connect(QRadioButtons *&, const char *)'
    and the lists four candiates for the matching function.

    **found the problem, the "()" does not match correctly,
    @ connect(ui->TD50radioButton, SIGNAL(clicked())), this, SLOT(waveformToggled());@
    should be
    @ connect(ui->TD50radioButton, SIGNAL(clicked()), this, SLOT(waveformToggled()));@
    Qt editor does not highlight this kind of error. :(

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

      As it looks you have solved your problem.
      If this is the case, thanks for posting your. However, please mark also the title with [Solved].

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved