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. How to pass QRadioButton(Widget) value to another QRadioButton(MainWindow) realtime
Qt 6.11 is out! See what's new in the release blog

How to pass QRadioButton(Widget) value to another QRadioButton(MainWindow) realtime

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 2 Posters 742 Views
  • 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.
  • P Offline
    P Offline
    Proton Phoenix
    wrote on last edited by Proton Phoenix
    #1

    Hi ~~~ I Have a problem .... i want to pass How to pass QRadioButton(Widget) value to another QRadioButton(MainWindow)
    for license Agreement of my software ... so an widget show up after clicking Qradiobutton .. and then choosing to accept the rules .. and this value of acceptence .. (bool) came back to Mainwindow as the user accepted the rules!!!
    i tried connect ... but it didn't work it says no slot even if there's a slot (a public one)
    can you help guys <3?

    jsulmJ 1 Reply Last reply
    0
    • P Proton Phoenix

      Hi ~~~ I Have a problem .... i want to pass How to pass QRadioButton(Widget) value to another QRadioButton(MainWindow)
      for license Agreement of my software ... so an widget show up after clicking Qradiobutton .. and then choosing to accept the rules .. and this value of acceptence .. (bool) came back to Mainwindow as the user accepted the rules!!!
      i tried connect ... but it didn't work it says no slot even if there's a slot (a public one)
      can you help guys <3?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Proton-Phoenix said in How to pass QRadioButton(Widget) value to another QRadioButton(MainWindow) realtime:

      i tried connect ... but it didn't work it says no slot even if there's a slot (a public one)

      Please post the code and exact error message

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • P Offline
        P Offline
        Proton Phoenix
        wrote on last edited by Proton Phoenix
        #3

        Hi bro i still just a beginner

        this is the second QRadiobutton ...

        QString licenceagrement::on_licenceag_clicked()
        {
           
            if(ui->licenceag->isChecked()){
              ui->statuslineedit->setText("true");
            }else{
                ui->statuslineedit->setText("false");
            }
         ch = ui->statuslineedit->text();
            ch=photon;
            registeracc *regis=new registeracc();
           QObject::connect(ui->licenceag,SIGNAL(clicked()),regis,SLOT(regis->recipe()));
            return photon;
        }
        

        photon and ch are public QString variables
        and this is the first QRadioButton
        void registeracc::on_radioButton_clicked()

        {
            licenceagrement * lic = new licenceagrement;
            lic->show();
        
        }
        

        and this is the globalsltop

        void registeracc::recipe(){
            licenceagrement * lic = new licenceagrement;
        if(lic->on_licenceag_clicked()=="true"){
            ui->radioButton->setChecked(true);
        }else{
            ui->radioButton->setChecked(false); 
        }
        }
        
        
        

        **i knew the code is not completed yet ... i have changed the code so many times .. i tried to pass QString values instead of boolean

        The error message :
        QObject::connect: No such slot registeracc::regis->recipe() in ..\1stapptestdata\licenceagrement.cpp:36
        QObject::connect: (sender name: 'licenceag')
        QObject::connect: (receiver name: 'registeracc')**

        jsulmJ 1 Reply Last reply
        0
        • P Proton Phoenix

          Hi bro i still just a beginner

          this is the second QRadiobutton ...

          QString licenceagrement::on_licenceag_clicked()
          {
             
              if(ui->licenceag->isChecked()){
                ui->statuslineedit->setText("true");
              }else{
                  ui->statuslineedit->setText("false");
              }
           ch = ui->statuslineedit->text();
              ch=photon;
              registeracc *regis=new registeracc();
             QObject::connect(ui->licenceag,SIGNAL(clicked()),regis,SLOT(regis->recipe()));
              return photon;
          }
          

          photon and ch are public QString variables
          and this is the first QRadioButton
          void registeracc::on_radioButton_clicked()

          {
              licenceagrement * lic = new licenceagrement;
              lic->show();
          
          }
          

          and this is the globalsltop

          void registeracc::recipe(){
              licenceagrement * lic = new licenceagrement;
          if(lic->on_licenceag_clicked()=="true"){
              ui->radioButton->setChecked(true);
          }else{
              ui->radioButton->setChecked(false); 
          }
          }
          
          
          

          **i knew the code is not completed yet ... i have changed the code so many times .. i tried to pass QString values instead of boolean

          The error message :
          QObject::connect: No such slot registeracc::regis->recipe() in ..\1stapptestdata\licenceagrement.cpp:36
          QObject::connect: (sender name: 'licenceag')
          QObject::connect: (receiver name: 'registeracc')**

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by jsulm
          #4

          @Proton-Phoenix said in How to pass QRadioButton(Widget) value to another QRadioButton(MainWindow) realtime:

          QObject::connect(ui->licenceag,SIGNAL(clicked()),regis,SLOT(regis->recipe()));

          This is invalid connect call. Should be:

          QObject::connect(ui->licenceag,SIGNAL(clicked()),regis,SLOT(recipe()));
          

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • P Offline
            P Offline
            Proton Phoenix
            wrote on last edited by Proton Phoenix
            #5

            Thank you bro now QObject connect signal and slots very good but the value didn't pass to the other window!

            void registeracc::recipe(){
                licenceagrement * lic = new licenceagrement;
            if(lic->on_licenceag_clicked()=="true"){
                qDebug()<<lic->on_licenceag_clicked();
                ui->radioButton->setChecked(true);
            }else{
                ui->radioButton->setChecked(false);
                qDebug()<<lic->on_licenceag_clicked();
            }
            }
            

            qDebug()<<lic->on_licenceag_clicked(); // = ""
            i want it to get the QString value ... true or false!
            is there any problem here!

            jsulmJ 1 Reply Last reply
            0
            • P Proton Phoenix

              Thank you bro now QObject connect signal and slots very good but the value didn't pass to the other window!

              void registeracc::recipe(){
                  licenceagrement * lic = new licenceagrement;
              if(lic->on_licenceag_clicked()=="true"){
                  qDebug()<<lic->on_licenceag_clicked();
                  ui->radioButton->setChecked(true);
              }else{
                  ui->radioButton->setChecked(false);
                  qDebug()<<lic->on_licenceag_clicked();
              }
              }
              

              qDebug()<<lic->on_licenceag_clicked(); // = ""
              i want it to get the QString value ... true or false!
              is there any problem here!

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Proton-Phoenix You should pass this information to the slot registeracc::recipe() instead of tightly coupling your classes.

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              P 1 Reply Last reply
              0
              • P Offline
                P Offline
                Proton Phoenix
                wrote on last edited by
                #7
                This post is deleted!
                1 Reply Last reply
                0
                • jsulmJ jsulm

                  @Proton-Phoenix You should pass this information to the slot registeracc::recipe() instead of tightly coupling your classes.

                  P Offline
                  P Offline
                  Proton Phoenix
                  wrote on last edited by Proton Phoenix
                  #8

                  @jsulm said in How to pass QRadioButton(Widget) value to another QRadioButton(MainWindow) realtime:

                  @Proton-Phoenix You should pass this information to the slot registeracc::recipe() instead of tightly coupling your classes.

                  ok Thank you bro <3
                  really Thank you bro i will try that

                  problem fixed by jsulm

                  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