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. passing values Working on Debug mode and doesn't on release mode!

passing values Working on Debug mode and doesn't on release mode!

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 3 Posters 535 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 ~~

    registeracc *registeraccount; // the problem is here sure! it works on debug but not on release mode  !~
      connect(ui->statuslineedit,SIGNAL(textChanged(QString)),registeraccount,SLOT(recieveacco(QString)));
    
    void registeracc::recieveacco(QString recieve){
    
        ch = recieve;
        qDebug()<<ch;
          if(recieve=="yes"){
    
              ui->statusregister->setText("  you accepted the rules   ");
              ui->licenceagrement->setChecked(true);
          }
          if(recieve=="no"){
    
              ui->licenceagrement->setChecked(false);
          }
          if(ui->licenceagrement->isChecked()){
              ui->registerdatabutton_2->setEnabled(true);
    
          }else{
        ui->statusregister->setText("  you didn't accept software rules");
        ui->registerdatabutton_2->setDisabled(true);
        QTimer timer2;
        timer2.singleShot(3000, this, SLOT(cleartext()));
        timer2.start();
        timer2.stop();
        }
    }
    

    is there any solution !~~?
    how can i initialize without = new ....
    and the important thing ,, everything work smoothly on debug mode!~
    the error on release mode is ~
    QObject::connect: Cannot connect QLineEdit::textChanged(QString) to (nullptr)::recieveacco(QString)

    J.HilkJ 1 Reply Last reply
    0
    • P Proton Phoenix

      hi ~~

      registeracc *registeraccount; // the problem is here sure! it works on debug but not on release mode  !~
        connect(ui->statuslineedit,SIGNAL(textChanged(QString)),registeraccount,SLOT(recieveacco(QString)));
      
      void registeracc::recieveacco(QString recieve){
      
          ch = recieve;
          qDebug()<<ch;
            if(recieve=="yes"){
      
                ui->statusregister->setText("  you accepted the rules   ");
                ui->licenceagrement->setChecked(true);
            }
            if(recieve=="no"){
      
                ui->licenceagrement->setChecked(false);
            }
            if(ui->licenceagrement->isChecked()){
                ui->registerdatabutton_2->setEnabled(true);
      
            }else{
          ui->statusregister->setText("  you didn't accept software rules");
          ui->registerdatabutton_2->setDisabled(true);
          QTimer timer2;
          timer2.singleShot(3000, this, SLOT(cleartext()));
          timer2.start();
          timer2.stop();
          }
      }
      

      is there any solution !~~?
      how can i initialize without = new ....
      and the important thing ,, everything work smoothly on debug mode!~
      the error on release mode is ~
      QObject::connect: Cannot connect QLineEdit::textChanged(QString) to (nullptr)::recieveacco(QString)

      J.HilkJ Online
      J.HilkJ Online
      J.Hilk
      Moderators
      wrote on last edited by J.Hilk
      #2

      @Proton-Phoenix said in passing values Working on Debug mode and doesn't on release mode!:

      registeracc *registeraccount;

      thats a floating pointer not a pointer to a vaild instance, of course the connect fails

      im surpised it worked in debug at all, luck I guess


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      P 1 Reply Last reply
      1
      • J.HilkJ J.Hilk

        @Proton-Phoenix said in passing values Working on Debug mode and doesn't on release mode!:

        registeracc *registeraccount;

        thats a floating pointer not a pointer to a vaild instance, of course the connect fails

        im surpised it worked in debug at all, luck I guess

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

        @J-Hilk
        yep it works on debug mode .. not only this , i have many floating pointers on my test software and all of it works on debug mode ... but doesn't on release mode~!
        iif i write it like this ... registeracc *registeraccount= new registeracc();
        it will work but i can't see the changes because it will show the changes on another object of registeracc ... ~~~ is there any solution to initialize registeracc ~?
        i want it to connect with the same already openned form not new one

        JonBJ 1 Reply Last reply
        0
        • P Proton Phoenix

          @J-Hilk
          yep it works on debug mode .. not only this , i have many floating pointers on my test software and all of it works on debug mode ... but doesn't on release mode~!
          iif i write it like this ... registeracc *registeraccount= new registeracc();
          it will work but i can't see the changes because it will show the changes on another object of registeracc ... ~~~ is there any solution to initialize registeracc ~?
          i want it to connect with the same already openned form not new one

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @Proton-Phoenix
          Forget about apparent differences between debug vs release builds. You need to understand the basics of C++ instances.

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

            okay bro Thank you so much i will try to understand more about c++ instances <3

            JonBJ 1 Reply Last reply
            0
            • P Proton Phoenix

              okay bro Thank you so much i will try to understand more about c++ instances <3

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #6

              @Proton-Phoenix
              Nicely, you really do, because without understanding instances you won't get far in Qt or OO programming. It's worth the time to understand.

              P 1 Reply Last reply
              1
              • JonBJ JonB

                @Proton-Phoenix
                Nicely, you really do, because without understanding instances you won't get far in Qt or OO programming. It's worth the time to understand.

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

                @JonB said in passing values Working on Debug mode and doesn't on release mode!:

                @Proton-Phoenix
                Nicely, you really do, because without understanding instances you won't get far in Qt or OO programming. It's worth the time to understand.

                Thank you bro <3 i am learning programming from creating softwares ... that's why a lot of basics i didn't understand yet .. but i need to to continue the road <3
                but really thank you guys ...
                you could give me the solution but you want me to learn <3
                As an old Chinese saying goes, it is better to teach one the skill of fishing than to offer him fish.
                really thank you guys many time <3

                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