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. Delay in executing widget program

Delay in executing widget program

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 387 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.
  • V Offline
    V Offline
    viniltc
    wrote on last edited by
    #1

    HI All,

    I have a Main window with push buttons to open other windows, as shown below:
    window1.JPG

    Here both in Program window and Logs window , I have a back to main button which can take to the Main window.

    In the Logs window at present I'm having a real-time display of sensor.

    Everything seems fine if I start Logs from Main in the first time

    But, if I goto Programs -> back to Main -> Logs the Logs window is getting too much delayed.

    This is how I go back to Main from Program

    void stageProgram::on_pushButton_shoulderControl_clicked()
    {
    
        this-> close();
        StageOneMain *newPatient = new StageOneMain(pLabel);
        newPatient-> show();
    }
    

    Logs from Main

    void StageOneMain::on_pushButton_logs_clicked()
    {
        this->close();
        window = new ShoulderControl(pLabel);
        window -> show();
    }
    

    Anybody see some issue here?

    JonBJ jsulmJ 3 Replies Last reply
    0
    • V viniltc

      HI All,

      I have a Main window with push buttons to open other windows, as shown below:
      window1.JPG

      Here both in Program window and Logs window , I have a back to main button which can take to the Main window.

      In the Logs window at present I'm having a real-time display of sensor.

      Everything seems fine if I start Logs from Main in the first time

      But, if I goto Programs -> back to Main -> Logs the Logs window is getting too much delayed.

      This is how I go back to Main from Program

      void stageProgram::on_pushButton_shoulderControl_clicked()
      {
      
          this-> close();
          StageOneMain *newPatient = new StageOneMain(pLabel);
          newPatient-> show();
      }
      

      Logs from Main

      void StageOneMain::on_pushButton_logs_clicked()
      {
          this->close();
          window = new ShoulderControl(pLabel);
          window -> show();
      }
      

      Anybody see some issue here?

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

      @viniltc
      Do you have Qt::WA_DeleteOnClose on each of these classes? Else you're leaking a window every time.

      1 Reply Last reply
      3
      • V viniltc

        HI All,

        I have a Main window with push buttons to open other windows, as shown below:
        window1.JPG

        Here both in Program window and Logs window , I have a back to main button which can take to the Main window.

        In the Logs window at present I'm having a real-time display of sensor.

        Everything seems fine if I start Logs from Main in the first time

        But, if I goto Programs -> back to Main -> Logs the Logs window is getting too much delayed.

        This is how I go back to Main from Program

        void stageProgram::on_pushButton_shoulderControl_clicked()
        {
        
            this-> close();
            StageOneMain *newPatient = new StageOneMain(pLabel);
            newPatient-> show();
        }
        

        Logs from Main

        void StageOneMain::on_pushButton_logs_clicked()
        {
            this->close();
            window = new ShoulderControl(pLabel);
            window -> show();
        }
        

        Anybody see some issue here?

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

        @viniltc Do you really need to close current window and create a new instance of the new one? You could simply call hide() instead of close() and next time if this window needs to be shown call show() again.
        Another solution would be to use one window with QStackedWidget and simply change the shown widget when one of the buttons is clicked.

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

        1 Reply Last reply
        4
        • V viniltc

          HI All,

          I have a Main window with push buttons to open other windows, as shown below:
          window1.JPG

          Here both in Program window and Logs window , I have a back to main button which can take to the Main window.

          In the Logs window at present I'm having a real-time display of sensor.

          Everything seems fine if I start Logs from Main in the first time

          But, if I goto Programs -> back to Main -> Logs the Logs window is getting too much delayed.

          This is how I go back to Main from Program

          void stageProgram::on_pushButton_shoulderControl_clicked()
          {
          
              this-> close();
              StageOneMain *newPatient = new StageOneMain(pLabel);
              newPatient-> show();
          }
          

          Logs from Main

          void StageOneMain::on_pushButton_logs_clicked()
          {
              this->close();
              window = new ShoulderControl(pLabel);
              window -> show();
          }
          

          Anybody see some issue here?

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

          @viniltc
          Apart from the leaks I mentioned in your existing code, either of @jsulm's suggestions are preferable to your approach.

          1 Reply Last reply
          1
          • V Offline
            V Offline
            viniltc
            wrote on last edited by
            #5

            @JonB @jsulm Thanks for your suggestions. How do I detect for any memory leaks?

            jsulmJ 1 Reply Last reply
            0
            • V viniltc

              @JonB @jsulm Thanks for your suggestions. How do I detect for any memory leaks?

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

              @viniltc said in Delay in executing widget program:

              How do I detect for any memory leaks?

              On Linux you can use Valgrind (QtCreator integrates it).

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

              1 Reply Last reply
              3

              • Login

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