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. Qt QRadioButton (1) setChecked problem
Forum Updated to NodeBB v4.3 + New Features

Qt QRadioButton (1) setChecked problem

Scheduled Pinned Locked Moved Solved General and Desktop
19 Posts 3 Posters 1.5k Views 2 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.
  • mrjjM mrjj

    Hi
    Could you try

    ui->licenceagrement->hide()
    and
    ui->licenceagrement->show()

    jus to be sure you are looking at the correct one.

    setChecked should work so its something else.

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

    @mrjj said in Qt QRadioButton (1) setChecked problem:

    ui->licenceagrement->hide()

    void registeracc::recieveacc(QString recieve){
    
        ch = recieve;
        if(recieve=="yes"){
            ui->licenceagrement->show();
           qDebug()<<recieve;
    
        }if(recieve=="no"){
            ui->licenceagrement->hide();
            qDebug()<<recieve;
    }
    }
    

    still the same problem it doesn't hide

    alt text

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #4

      Hi
      Ok then something is up as hide() can't fail as such.

      and you are 100% sure it goes into the IFs so it will call the code?

      P 1 Reply Last reply
      1
      • mrjjM mrjj

        Hi
        Ok then something is up as hide() can't fail as such.

        and you are 100% sure it goes into the IFs so it will call the code?

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

        @mrjj said in Qt QRadioButton (1) setChecked problem:

        Hi
        Ok then something is up as hide() can't fail as such.

        and you are 100% sure it goes into the IFs so it will call the code?

        this is the the application output qDebug it's already in recieve slot
        so recieve slot get the value successfully
        every click from me (second window) it shows "yes" , then "no" .... from qDebug() in the first window
        alt text

        1 Reply Last reply
        0
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #6

          Hi

          I cant guess it. hide() cannot fail so im lost.

          How do you send signal back to the first window when no button is pressed (in dialog)?

          P 1 Reply Last reply
          1
          • mrjjM mrjj

            Hi

            I cant guess it. hide() cannot fail so im lost.

            How do you send signal back to the first window when no button is pressed (in dialog)?

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

            @mrjj said in Qt QRadioButton (1) setChecked problem:

            Hi

            I cant guess it. hide() cannot fail so im lost.

            How do you send signal back to the first window when no button is pressed (in dialog)?

            void licenceagrement::on_licenceag_clicked()
            {
                if(ui->licenceag->isChecked()){
                  ui->statuslineedit->setText("yes");
                }else{
                    ui->statuslineedit->setText("no");
                }
            }
            

            this is the code of the QRadioButton in Dialog window when i click QRadiobutton in Dialog it send QString to lineedit which is also send a signal to recieve slot in registeracc Widget qDebug() show's that the public slot received the QString successfully but the If's can't do the rest and apply that to the QRadioButton in the first window (registeracc)

            alt text

            1 Reply Last reply
            0
            • mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #8

              Hi
              Ok so it's via the text change signal back to form 1

              Could you try to place a button on form 1 and in its clicked
              try
              ui->licenceagrement->hide();

              just to see it can work. All look good so im a bit baffled.

              P 1 Reply Last reply
              1
              • mrjjM mrjj

                Hi
                Ok so it's via the text change signal back to form 1

                Could you try to place a button on form 1 and in its clicked
                try
                ui->licenceagrement->hide();

                just to see it can work. All look good so im a bit baffled.

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

                @mrjj said in Qt QRadioButton (1) setChecked problem:

                Hi
                Ok so it's via the text change signal back to form 1

                Could you try to place a button on form 1 and in its clicked
                try
                ui->licenceagrement->hide();

                just to see it can work. All look good so im a bit baffled.

                void registeracc::on_justtestbutton_clicked()
                {
                    ui->licenceagrement->hide();
                }
                

                alt text

                from the first form it works and it hides the QRadiobutton as the picture

                1 Reply Last reply
                0
                • mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #10

                  Hi
                  Ok so names etc are fine.

                  Then last test

                  void registeracc::recieveacc(QString recieve){
                      ch = recieve;
                      if(recieve=="yes"){
                          ui->licenceagrement->show();
                         qDebug()<<"i just called show";
                      }
                      if(recieve=="no"){
                          ui->licenceagrement->hide();
                           qDebug()<<"i just called hide";
                      }
                  }
                  

                  and tell me if the new texts show as it should ?

                  P 1 Reply Last reply
                  0
                  • mrjjM mrjj

                    Hi
                    Ok so names etc are fine.

                    Then last test

                    void registeracc::recieveacc(QString recieve){
                        ch = recieve;
                        if(recieve=="yes"){
                            ui->licenceagrement->show();
                           qDebug()<<"i just called show";
                        }
                        if(recieve=="no"){
                            ui->licenceagrement->hide();
                             qDebug()<<"i just called hide";
                        }
                    }
                    

                    and tell me if the new texts show as it should ?

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

                    @mrjj said in Qt QRadioButton (1) setChecked problem:

                    Hi
                    Ok so names etc are fine.

                    Then last test

                    void registeracc::recieveacc(QString recieve){
                        ch = recieve;
                        if(recieve=="yes"){
                            ui->licenceagrement->show();
                           qDebug()<<"i just called show";
                        }
                        if(recieve=="no"){
                            ui->licenceagrement->hide();
                             qDebug()<<"i just called hide";
                        }
                    }
                    

                    and tell me if the new texts show as it should ?

                    alt text

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #12

                      Hi,

                      In the upper part of that picture you have a lic variable that is a licenseagrement object. I suspect that this is the one you are seeing. You are likely not hiding what you think you are hiding.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      P 1 Reply Last reply
                      3
                      • SGaistS SGaist

                        Hi,

                        In the upper part of that picture you have a lic variable that is a licenseagrement object. I suspect that this is the one you are seeing. You are likely not hiding what you think you are hiding.

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

                        @SGaist said in Qt QRadioButton (1) setChecked problem:

                        Hi,

                        In the upper part of that picture you have a lic variable that is a licenseagrement object. I suspect that this is the one you are seeing. You are likely not hiding what you think you are hiding.

                        i think you are correct bro ! i used this object when i click the QRadiobutton in the first form it shows the second dialog!?

                        P 1 Reply Last reply
                        0
                        • P Proton Phoenix

                          @SGaist said in Qt QRadioButton (1) setChecked problem:

                          Hi,

                          In the upper part of that picture you have a lic variable that is a licenseagrement object. I suspect that this is the one you are seeing. You are likely not hiding what you think you are hiding.

                          i think you are correct bro ! i used this object when i click the QRadiobutton in the first form it shows the second dialog!?

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

                          @Proton-Phoenix said in Qt QRadioButton (1) setChecked problem:

                          @SGaist said in Qt QRadioButton (1) setChecked problem:

                          Hi,

                          In the upper part of that picture you have a lic variable that is a licenseagrement object. I suspect that this is the one you are seeing. You are likely not hiding what you think you are hiding.

                          i think you are correct bro ! i used this object when i click the QRadiobutton in the first form it shows the second dialog!?

                          i have change it now to this but the same problem
                          alt text

                          1 Reply Last reply
                          0
                          • mrjjM Offline
                            mrjjM Offline
                            mrjj
                            Lifetime Qt Champion
                            wrote on last edited by
                            #15

                            @Proton-Phoenix

                            Hi
                            So testWindow is the "Dialog " (in title) we see ?

                            if yes, dont it miss a connect there so its textChanged signal can come back to registeracc ?

                            Its a new object so its not connected.

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

                              @mrjj said in Qt QRadioButton (1) setChecked problem:

                              @Proton-Phoenix

                              Hi
                              So testWindow is the "Dialog " (in title) we see ?

                              if yes, dont it miss a connect there so its textChanged signal can come back to registeracc ?

                              Its a new object so its not connected.

                              Yes bro

                              every time i click the first QRadioButton it shows The Dialog window
                              then in Dialog cpp i connected it using this (i am just a beginner)

                              connect(ui->statuslineedit,SIGNAL(textChanged(QString)),reg,SLOT(recieveacc(QString)));
                              so the problem is the new object which is not connected??
                              but how it send the QString! every time i click The QRadioButton in the dialog which was opened from the new object?
                              is there any solution?
                              sorry for making you all that tired but anyway it's experience for you may someday you will help another beginner on it
                              Really Thank you all what you are doing guys <3

                              registeracc *reg=new registeracc(); // i think the problem here it's also a new object!
                                connect(ui->statuslineedit,SIGNAL(textChanged(QString)),reg,SLOT(recieveacc(QString)));
                              
                              mrjjM 1 Reply Last reply
                              0
                              • P Proton Phoenix

                                @mrjj said in Qt QRadioButton (1) setChecked problem:

                                @Proton-Phoenix

                                Hi
                                So testWindow is the "Dialog " (in title) we see ?

                                if yes, dont it miss a connect there so its textChanged signal can come back to registeracc ?

                                Its a new object so its not connected.

                                Yes bro

                                every time i click the first QRadioButton it shows The Dialog window
                                then in Dialog cpp i connected it using this (i am just a beginner)

                                connect(ui->statuslineedit,SIGNAL(textChanged(QString)),reg,SLOT(recieveacc(QString)));
                                so the problem is the new object which is not connected??
                                but how it send the QString! every time i click The QRadioButton in the dialog which was opened from the new object?
                                is there any solution?
                                sorry for making you all that tired but anyway it's experience for you may someday you will help another beginner on it
                                Really Thank you all what you are doing guys <3

                                registeracc *reg=new registeracc(); // i think the problem here it's also a new object!
                                  connect(ui->statuslineedit,SIGNAL(textChanged(QString)),reg,SLOT(recieveacc(QString)));
                                
                                mrjjM Offline
                                mrjjM Offline
                                mrjj
                                Lifetime Qt Champion
                                wrote on last edited by
                                #17

                                @Proton-Phoenix
                                Hi
                                yes that is the issue.
                                Its not the one we are looking at :)

                                P 1 Reply Last reply
                                1
                                • mrjjM mrjj

                                  @Proton-Phoenix
                                  Hi
                                  yes that is the issue.
                                  Its not the one we are looking at :)

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

                                  @mrjj said in Qt QRadioButton (1) setChecked problem:

                                  @Proton-Phoenix
                                  Hi
                                  yes that is the issue.
                                  Its not the one we are looking at :)

                                  :D Strange :D ^^ Really Thank you bro all of you guys You are making Great job here <3 i wish all the best happy great life for all of you <3
                                  may someday someone will have the same problem and it will be in the hippocampus sql ^^ :D
                                  so it's changing but it doesn't show changes because it's a new object not the original form
                                  ^^ is there any solution !? advice !
                                  registeracc *reg=new registeracc();
                                  it accept only new object pointers to connect

                                  connect(ui->statuslineedit,SIGNAL(textChanged(QString)),reg,SLOT(recieveacc(QString)));

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

                                    problem fixed ... Really Thank you guys <3
                                    mrjj and SGaist ...
                                    this is the warning which were deceiving me from the very beginning
                                    i thought it was a problem
                                    but it's the solution

                                    alt text

                                    1 Reply Last reply
                                    1

                                    • Login

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