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. gui not showing, or closing to fast to see
Forum Updated to NodeBB v4.3 + New Features

gui not showing, or closing to fast to see

Scheduled Pinned Locked Moved Solved General and Desktop
40 Posts 6 Posters 6.1k Views 3 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.
  • Pl45m4P Pl45m4

    @micha_eleric

    What exit code do you get?Set breakpoints and debug to see what happens. Does it crash or exit properly?!

    M Offline
    M Offline
    micha_eleric
    wrote on last edited by
    #6

    @Pl45m4
    can not find where this is printed. eclipse, i did. i am a wee bit new to qt creator

    std::cout << "__name__";
    
    QApplication app (argc, argv);
    

    results in

    The inferior stopped because it received a signal from the operating system.
    
    Signal name : 
    SIGSTOP
    Signal meaning : 
    Stopped (signal)
    
    1 Reply Last reply
    0
    • M Offline
      M Offline
      micha_eleric
      wrote on last edited by
      #7

      i dont get it. it is erroring even like this

      int main(int argc, char **argv)
      {
          std::cout << "__name__";
          QApplication app (argc, argv);
          //CNC::CGUI myapp;
          //myapp.show();
          //return app.exec();
          return 1;
      }
      
      M 1 Reply Last reply
      0
      • M micha_eleric

        i dont get it. it is erroring even like this

        int main(int argc, char **argv)
        {
            std::cout << "__name__";
            QApplication app (argc, argv);
            //CNC::CGUI myapp;
            //myapp.show();
            //return app.exec();
            return 1;
        }
        
        M Offline
        M Offline
        micha_eleric
        wrote on last edited by
        #8

        @micha_eleric said in gui not showing, or closing to fast to see:

        i dont get it. it is erroring even like this

        int main(int argc, char **argv)
        {
            std::cout << "__name__";
            QApplication app (argc, argv);
            //CNC::CGUI myapp;
            //myapp.show();
            //return app.exec();
            return 1;
        }
        

        this does not crash when run, but crashes with debug

        jsulmJ CP71C 2 Replies Last reply
        0
        • M micha_eleric

          @micha_eleric said in gui not showing, or closing to fast to see:

          i dont get it. it is erroring even like this

          int main(int argc, char **argv)
          {
              std::cout << "__name__";
              QApplication app (argc, argv);
              //CNC::CGUI myapp;
              //myapp.show();
              //return app.exec();
              return 1;
          }
          

          this does not crash when run, but crashes with debug

          jsulmJ Online
          jsulmJ Online
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #9

          @micha_eleric On which OS.
          What Qt version?
          How did you install Qt?
          Post the stack trace after crash.

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

          M 1 Reply Last reply
          1
          • M micha_eleric

            @micha_eleric said in gui not showing, or closing to fast to see:

            i dont get it. it is erroring even like this

            int main(int argc, char **argv)
            {
                std::cout << "__name__";
                QApplication app (argc, argv);
                //CNC::CGUI myapp;
                //myapp.show();
                //return app.exec();
                return 1;
            }
            

            this does not crash when run, but crashes with debug

            CP71C Offline
            CP71C Offline
            CP71
            wrote on last edited by CP71
            #10

            @micha_eleric
            Hi,
            Try to delete all build folders from the explorer resource (release and debug), not clear from Qt Creator, and try this code (obviously, you see nothing because myapp.show is commented, but you can check if removing builder folder fixes the crash).
            Only for curiosity. What is CNC? Maybe a namespace.

            Pl45m4P M 2 Replies Last reply
            0
            • CP71C CP71

              @micha_eleric
              Hi,
              Try to delete all build folders from the explorer resource (release and debug), not clear from Qt Creator, and try this code (obviously, you see nothing because myapp.show is commented, but you can check if removing builder folder fixes the crash).
              Only for curiosity. What is CNC? Maybe a namespace.

              Pl45m4P Offline
              Pl45m4P Offline
              Pl45m4
              wrote on last edited by Pl45m4
              #11

              @CP71 said in gui not showing, or closing to fast to see:

              What is CNC? Maybe a namespace.

              Probably...

              @micha_eleric
              To check, if nothing appears or if it's just gone too fast to recognize, you could reimplement the showEvent in your QMainWindow subclass and print some qDebug() from there (If debugging doesn't work for you, in this case)


              If debugging is the process of removing software bugs, then programming must be the process of putting them in.

              ~E. W. Dijkstra

              M 1 Reply Last reply
              1
              • CP71C CP71

                @micha_eleric
                Hi,
                Try to delete all build folders from the explorer resource (release and debug), not clear from Qt Creator, and try this code (obviously, you see nothing because myapp.show is commented, but you can check if removing builder folder fixes the crash).
                Only for curiosity. What is CNC? Maybe a namespace.

                M Offline
                M Offline
                micha_eleric
                wrote on last edited by
                #12

                @CP71 said in gui not showing, or closing to fast to see:

                @micha_eleric
                Hi,
                Try to delete all build folders from the explorer resource (release and debug), not clear from Qt Creator, and try this code (obviously, you see nothing because myapp.show is commented, but you can check if removing builder folder fixes the crash).
                Only for curiosity. What is CNC? Maybe a namespace.

                obviously, show was not commented out in the first code i posted.
                CNC is the namespace.

                1 Reply Last reply
                0
                • jsulmJ jsulm

                  @micha_eleric On which OS.
                  What Qt version?
                  How did you install Qt?
                  Post the stack trace after crash.

                  M Offline
                  M Offline
                  micha_eleric
                  wrote on last edited by
                  #13

                  @jsulm said in gui not showing, or closing to fast to see:

                  @micha_eleric On which OS.
                  What Qt version?
                  How did you install Qt?
                  Post the stack trace after crash.

                  Qt Creator 4.11.0
                  Based on Qt 5.12.8 (GCC 9.3.0, 64 bit)
                  installed from Discover
                  no stack trace. if there is, i have not found it.

                  1 Reply Last reply
                  0
                  • Pl45m4P Pl45m4

                    @CP71 said in gui not showing, or closing to fast to see:

                    What is CNC? Maybe a namespace.

                    Probably...

                    @micha_eleric
                    To check, if nothing appears or if it's just gone too fast to recognize, you could reimplement the showEvent in your QMainWindow subclass and print some qDebug() from there (If debugging doesn't work for you, in this case)

                    M Offline
                    M Offline
                    micha_eleric
                    wrote on last edited by
                    #14

                    @Pl45m4 said in gui not showing, or closing to fast to see:

                    @CP71 said in gui not showing, or closing to fast to see:

                    What is CNC? Maybe a namespace.

                    Probably...

                    @micha_eleric
                    To check, if nothing appears or if it's just gone too fast to recognize, you could reimplement the showEvent in your QMainWindow subclass and print some qDebug() from there (If debugging doesn't work for you, in this case)

                    void CGUI::showEvent(QShowEvent * /* event */)
                        {
                            qDebug() << "Date:" << QDate::currentDate();
                            qDebug() << "Types:" << QString("String") << QChar('x') << QRect(0, 10, 50, 40);
                            qDebug() << "Custom coordinate type:";
                        }
                    

                    had no output, and std::cout << "name";, not doing anything.
                    however, i did find the line that was crashing the program.

                    JonBJ 1 Reply Last reply
                    0
                    • M micha_eleric

                      @Pl45m4 said in gui not showing, or closing to fast to see:

                      @CP71 said in gui not showing, or closing to fast to see:

                      What is CNC? Maybe a namespace.

                      Probably...

                      @micha_eleric
                      To check, if nothing appears or if it's just gone too fast to recognize, you could reimplement the showEvent in your QMainWindow subclass and print some qDebug() from there (If debugging doesn't work for you, in this case)

                      void CGUI::showEvent(QShowEvent * /* event */)
                          {
                              qDebug() << "Date:" << QDate::currentDate();
                              qDebug() << "Types:" << QString("String") << QChar('x') << QRect(0, 10, 50, 40);
                              qDebug() << "Custom coordinate type:";
                          }
                      

                      had no output, and std::cout << "name";, not doing anything.
                      however, i did find the line that was crashing the program.

                      JonBJ Online
                      JonBJ Online
                      JonB
                      wrote on last edited by
                      #15

                      @micha_eleric said in gui not showing, or closing to fast to see:

                      had no output, and std::cout << "name";, not doing anything.

                      Perhaps std::flush() or std::endl to flush, else you won't get it if you crash later on?

                      however, i did find the line that was crashing the program.

                      And what was that then?

                      M 1 Reply Last reply
                      0
                      • JonBJ JonB

                        @micha_eleric said in gui not showing, or closing to fast to see:

                        had no output, and std::cout << "name";, not doing anything.

                        Perhaps std::flush() or std::endl to flush, else you won't get it if you crash later on?

                        however, i did find the line that was crashing the program.

                        And what was that then?

                        M Offline
                        M Offline
                        micha_eleric
                        wrote on last edited by
                        #16

                        @JonB said in gui not showing, or closing to fast to see:

                        @micha_eleric said in gui not showing, or closing to fast to see:

                        however, i did find the line that was crashing the program.

                        And what was that then?

                        //ui->pushButton_22->connect(ui->pushButton_22, SIGNAL(clicked()),this, SLOT(CGUI::Btn_test_clicked()) );  //?? old qt4
                        ui->pushButton_22->connect(ui->pushButton_22, &QPushButton::clicked, this, &CGUI::Btn_test_clicked);    //?? new qt5
                        

                        CGUI::Btn_test_clicked exist
                        i tried inclosing in a try catch block, but still crashes

                        Pl45m4P 1 Reply Last reply
                        0
                        • M micha_eleric

                          @JonB said in gui not showing, or closing to fast to see:

                          @micha_eleric said in gui not showing, or closing to fast to see:

                          however, i did find the line that was crashing the program.

                          And what was that then?

                          //ui->pushButton_22->connect(ui->pushButton_22, SIGNAL(clicked()),this, SLOT(CGUI::Btn_test_clicked()) );  //?? old qt4
                          ui->pushButton_22->connect(ui->pushButton_22, &QPushButton::clicked, this, &CGUI::Btn_test_clicked);    //?? new qt5
                          

                          CGUI::Btn_test_clicked exist
                          i tried inclosing in a try catch block, but still crashes

                          Pl45m4P Offline
                          Pl45m4P Offline
                          Pl45m4
                          wrote on last edited by Pl45m4
                          #17

                          @micha_eleric

                          Remove everything on the left before connect


                          If debugging is the process of removing software bugs, then programming must be the process of putting them in.

                          ~E. W. Dijkstra

                          M 1 Reply Last reply
                          0
                          • Pl45m4P Pl45m4

                            @micha_eleric

                            Remove everything on the left before connect

                            M Offline
                            M Offline
                            micha_eleric
                            wrote on last edited by
                            #18

                            @Pl45m4 said in gui not showing, or closing to fast to see:

                            @micha_eleric

                            Remove everything on the left before connect

                            well, now that i added a few \n at end of some std::cout, that line is not crashing, but something else is. it was running in regular run, with that commented out.

                            that format was working on other buttons.
                            why remove "ui->pushButton_22->"?

                            1 Reply Last reply
                            0
                            • M Offline
                              M Offline
                              micha_eleric
                              wrote on last edited by micha_eleric
                              #19

                              ok. this makes no sense
                              in the constructor

                              InitTestBoard();
                              std::cout << "constructor InitTestBoard finished \n" << std::flush;
                              
                                  void CGUI::InitTestBoard()
                                  {
                                      std::cout << "InitTestBoard \n" << std::flush;
                                      try
                                      {
                                          std::cout << "InitTestBoard try begin \n" << std::flush;
                                          //?? test arduino board leds
                                          //ui->pushButton_22->connect(ui->pushButton_22, SIGNAL(clicked()),this, SLOT(CGUI::Btn_test_clicked()) );  //?? old qt4
                                          ui->pushButton_22->connect(ui->pushButton_22, &QPushButton::clicked, this, &CGUI::Btn_test_clicked);    //?? new qt5
                              
                                          std::cout << "InitTestBoard try 2 \n" << std::flush;
                                          //?? Test Board/Motor wiring
                                          ui->textEdit_34->setFixedSize(30,  30);
                                          ui->textEdit_35->setFixedSize(30,  30);
                                          ui->textEdit_35->setFixedSize(30,  30);
                                          ui->textEdit_36->setFixedSize(30,  30);
                                          ui->textEdit_37->setFixedSize(30,  30);
                                          ui->textEdit_38->setFixedSize(30,  30);
                              
                                          std::cout << "InitTestBoard try 3 \n" << std::flush;
                                          ui->textEdit_40->setFixedSize(30,  30);
                                          ui->textEdit_41->setFixedSize(30,  30);
                                          ui->textEdit_42->setFixedSize(30,  30);
                                          ui->textEdit_43->setFixedSize(30,  30);
                                          ui->textEdit_44->setFixedSize(30,  30);
                                          ui->textEdit_45->setFixedSize(30,  30);
                                          std::cout << "InitTestBoard try end \n" << std::flush;
                                      }
                                      catch(std::exception& e)
                                      {
                                          std::cout << "InitTestBoard catch begin \n" << std::flush;
                                          std::cout << e.what() << std::flush;
                                          MessageBoxError("InitTestBoard");
                                          std::cout << e.what()<< std::flush;
                                      }
                                  }
                              

                              console output

                              __name__
                              InitTestBoard 
                              InitTestBoard try begin 
                              InitTestBoard try 2 
                              InitTestBoard try 3 
                              Press <RETURN> to close this window...
                              

                              it is crashing at end of try{}?
                              crashing in a try{}, but not getting caught?


                              well, now, if i comment out

                              ui->textEdit_40->setFixedSize(30,  30);
                              ui->textEdit_41->setFixedSize(30,  30);
                              

                              it does not crash on start

                              JonBJ 1 Reply Last reply
                              0
                              • M micha_eleric

                                ok. this makes no sense
                                in the constructor

                                InitTestBoard();
                                std::cout << "constructor InitTestBoard finished \n" << std::flush;
                                
                                    void CGUI::InitTestBoard()
                                    {
                                        std::cout << "InitTestBoard \n" << std::flush;
                                        try
                                        {
                                            std::cout << "InitTestBoard try begin \n" << std::flush;
                                            //?? test arduino board leds
                                            //ui->pushButton_22->connect(ui->pushButton_22, SIGNAL(clicked()),this, SLOT(CGUI::Btn_test_clicked()) );  //?? old qt4
                                            ui->pushButton_22->connect(ui->pushButton_22, &QPushButton::clicked, this, &CGUI::Btn_test_clicked);    //?? new qt5
                                
                                            std::cout << "InitTestBoard try 2 \n" << std::flush;
                                            //?? Test Board/Motor wiring
                                            ui->textEdit_34->setFixedSize(30,  30);
                                            ui->textEdit_35->setFixedSize(30,  30);
                                            ui->textEdit_35->setFixedSize(30,  30);
                                            ui->textEdit_36->setFixedSize(30,  30);
                                            ui->textEdit_37->setFixedSize(30,  30);
                                            ui->textEdit_38->setFixedSize(30,  30);
                                
                                            std::cout << "InitTestBoard try 3 \n" << std::flush;
                                            ui->textEdit_40->setFixedSize(30,  30);
                                            ui->textEdit_41->setFixedSize(30,  30);
                                            ui->textEdit_42->setFixedSize(30,  30);
                                            ui->textEdit_43->setFixedSize(30,  30);
                                            ui->textEdit_44->setFixedSize(30,  30);
                                            ui->textEdit_45->setFixedSize(30,  30);
                                            std::cout << "InitTestBoard try end \n" << std::flush;
                                        }
                                        catch(std::exception& e)
                                        {
                                            std::cout << "InitTestBoard catch begin \n" << std::flush;
                                            std::cout << e.what() << std::flush;
                                            MessageBoxError("InitTestBoard");
                                            std::cout << e.what()<< std::flush;
                                        }
                                    }
                                

                                console output

                                __name__
                                InitTestBoard 
                                InitTestBoard try begin 
                                InitTestBoard try 2 
                                InitTestBoard try 3 
                                Press <RETURN> to close this window...
                                

                                it is crashing at end of try{}?
                                crashing in a try{}, but not getting caught?


                                well, now, if i comment out

                                ui->textEdit_40->setFixedSize(30,  30);
                                ui->textEdit_41->setFixedSize(30,  30);
                                

                                it does not crash on start

                                JonBJ Online
                                JonBJ Online
                                JonB
                                wrote on last edited by JonB
                                #20

                                @micha_eleric
                                You have several things wrong. Whether they cause the crash I don't know, but let's start by sorting them out....

                                Remove your try ... catch. Qt does not throw C++ exceptions, and if you have a coding error/"crash" it won't catch it anyway.

                                ui->pushButton_22->connect(ui->pushButton_22, &QPushButton::clicked, this, &CGUI::Btn_test_clicked); //?? new qt5

                                @Pl45m4 already said this is wrong. You want:

                                connect(ui->pushButton_22, &QPushButton::clicked, this, &CGUI::Btn_test_clicked);    //?? new qt5
                                

                                Before

                                ui->textEdit_40->setFixedSize(30,  30);
                                ui->textEdit_41->setFixedSize(30,  30);
                                

                                let's put in something like:

                                qDebug() << ui->textEdit_40 << ui->textEdit_41;
                                // if previous line not acceptable to compiler remove it
                                qDebug() << ui->textEdit_40->objectName() << ui->textEdit_41->objectName();
                                

                                If either of these "crash"/"go wrong", narrow down to textEdit_40 vs textEdit_41 one at a time. Is it because of just one of them, not the other? Or, does accessing either of them cause the problem?

                                At one point you said a SIGSTOP was reported. Now you talk about "crashing", or just exiting. In any case, are you compiling for debug and running inside the debugger? Does the debugger catch anything/stop/report anything when your code goes wrong or exits?

                                M 2 Replies Last reply
                                4
                                • JonBJ JonB

                                  @micha_eleric
                                  You have several things wrong. Whether they cause the crash I don't know, but let's start by sorting them out....

                                  Remove your try ... catch. Qt does not throw C++ exceptions, and if you have a coding error/"crash" it won't catch it anyway.

                                  ui->pushButton_22->connect(ui->pushButton_22, &QPushButton::clicked, this, &CGUI::Btn_test_clicked); //?? new qt5

                                  @Pl45m4 already said this is wrong. You want:

                                  connect(ui->pushButton_22, &QPushButton::clicked, this, &CGUI::Btn_test_clicked);    //?? new qt5
                                  

                                  Before

                                  ui->textEdit_40->setFixedSize(30,  30);
                                  ui->textEdit_41->setFixedSize(30,  30);
                                  

                                  let's put in something like:

                                  qDebug() << ui->textEdit_40 << ui->textEdit_41;
                                  // if previous line not acceptable to compiler remove it
                                  qDebug() << ui->textEdit_40->objectName() << ui->textEdit_41->objectName();
                                  

                                  If either of these "crash"/"go wrong", narrow down to textEdit_40 vs textEdit_41 one at a time. Is it because of just one of them, not the other? Or, does accessing either of them cause the problem?

                                  At one point you said a SIGSTOP was reported. Now you talk about "crashing", or just exiting. In any case, are you compiling for debug and running inside the debugger? Does the debugger catch anything/stop/report anything when your code goes wrong or exits?

                                  M Offline
                                  M Offline
                                  micha_eleric
                                  wrote on last edited by
                                  #21

                                  @JonB both

                                  ui->textEdit_40->setFixedSize(30,  30);
                                  ui->textEdit_41->setFixedSize(30,  30);
                                  

                                  cause problems. comment out the first, second one crashes. comment out both, it runs.

                                  JonBJ 1 Reply Last reply
                                  0
                                  • M micha_eleric

                                    @JonB both

                                    ui->textEdit_40->setFixedSize(30,  30);
                                    ui->textEdit_41->setFixedSize(30,  30);
                                    

                                    cause problems. comment out the first, second one crashes. comment out both, it runs.

                                    JonBJ Online
                                    JonBJ Online
                                    JonB
                                    wrote on last edited by
                                    #22

                                    @micha_eleric And the rest of the things I suggested you try?

                                    M 1 Reply Last reply
                                    0
                                    • JonBJ JonB

                                      @micha_eleric And the rest of the things I suggested you try?

                                      M Offline
                                      M Offline
                                      micha_eleric
                                      wrote on last edited by
                                      #23

                                      @JonB

                                      qDebug() << ui->textEdit_40->objectName() << ui->textEdit_41->objectName();
                                      qDebug() << ui->textEdit_40->objectName();
                                      qDebug() << ui->textEdit_41->objectName();
                                      

                                      all caused crash, no messages, that i found

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

                                        Hi,

                                        Is ui initialized properly ?

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

                                        1 Reply Last reply
                                        0
                                        • M micha_eleric

                                          @JonB

                                          qDebug() << ui->textEdit_40->objectName() << ui->textEdit_41->objectName();
                                          qDebug() << ui->textEdit_40->objectName();
                                          qDebug() << ui->textEdit_41->objectName();
                                          

                                          all caused crash, no messages, that i found

                                          JonBJ Online
                                          JonBJ Online
                                          JonB
                                          wrote on last edited by
                                          #25

                                          @micha_eleric
                                          So it looks like you have a problem with those two textEdit pointers? Btw you have done a clean rebuild, so the uic has been run on the latest .ui file? You have initialised the ui prior to this code?

                                          M JonBJ 2 Replies 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