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 Application Slowing Down
Forum Updated to NodeBB v4.3 + New Features

Qt Application Slowing Down

Scheduled Pinned Locked Moved Solved General and Desktop
47 Posts 7 Posters 6.8k 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.
  • Christian EhrlicherC Offline
    Christian EhrlicherC Offline
    Christian Ehrlicher
    Lifetime Qt Champion
    wrote on last edited by
    #26

    @swansorter said in Qt Application Slowing Down:

    please share the link of any Qt example program

    https://doc.qt.io/qt-5/examples-widgets.html

    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
    Visit the Qt Academy at https://academy.qt.io/catalog

    S 1 Reply Last reply
    2
    • Christian EhrlicherC Christian Ehrlicher

      @swansorter said in Qt Application Slowing Down:

      please share the link of any Qt example program

      https://doc.qt.io/qt-5/examples-widgets.html

      S Offline
      S Offline
      swansorter
      wrote on last edited by
      #27

      @Christian-Ehrlicher i need example like QMainWindow with two or more dialogs.

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

        Having two dialogs or one doesn't change things much.

        What do you search exactly with an example with two dialogs ?

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

        S 1 Reply Last reply
        1
        • SGaistS SGaist

          Having two dialogs or one doesn't change things much.

          What do you search exactly with an example with two dialogs ?

          S Offline
          S Offline
          swansorter
          wrote on last edited by
          #29

          @SGaist yea...qt dialog with more than two dialog

          jsulmJ 1 Reply Last reply
          0
          • S swansorter

            @SGaist yea...qt dialog with more than two dialog

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

            @swansorter If you can create one dialog you can create 2 or 3 or 4 or ...
            So, what exactly is the problem?

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

            S 1 Reply Last reply
            0
            • jsulmJ jsulm

              @swansorter If you can create one dialog you can create 2 or 3 or 4 or ...
              So, what exactly is the problem?

              S Offline
              S Offline
              swansorter
              wrote on last edited by
              #31

              @jsulm 1. we have different screens like home screen ,setting screen ,main sort screen , resort1 ,resort2 and resort 3 screens
              2.On "home screen" we have setting button.
              3.we move to the "setting screen" with code like the following:-

              settingDialog *sd=new settingDialog(this);
              sd->setModal(true);
              close(); //closes the home window
              sd->setAttribute( Qt::WA_DeleteOnClose);
              sd->exec();//shows the setting screen
              

              4.On "Setting screen" we have main sort screen Button ,resort1 ,2 ,3 screen buttons to move respective screens.

              5.we move to the "main sort screen" with code like the following:-

              mainSortDialog *ms=new mainSortDialog();
              ms->setModal(true);
              ms->setAttribute ( Qt::WA_DeleteOnClose, true );
              this->close();//closes the setting screen
              ms->exec();//shows the main sort window

              6.on "main sort screen" we have Back button to go back to "setting screen".

              1. we move to the "main sort screen" with code like the following:-

                sd=new settingDialog();
                sd->setAttribute ( Qt::WA_DeleteOnClose, true );
                sd->setModal(true);
                this->close();//closes the main sort screen
                sd->exec();//shows the setting screen

              8.if i do the step 5 and 7 continuously the application gets slower .

              jsulmJ 1 Reply Last reply
              0
              • S swansorter

                @jsulm 1. we have different screens like home screen ,setting screen ,main sort screen , resort1 ,resort2 and resort 3 screens
                2.On "home screen" we have setting button.
                3.we move to the "setting screen" with code like the following:-

                settingDialog *sd=new settingDialog(this);
                sd->setModal(true);
                close(); //closes the home window
                sd->setAttribute( Qt::WA_DeleteOnClose);
                sd->exec();//shows the setting screen
                

                4.On "Setting screen" we have main sort screen Button ,resort1 ,2 ,3 screen buttons to move respective screens.

                5.we move to the "main sort screen" with code like the following:-

                mainSortDialog *ms=new mainSortDialog();
                ms->setModal(true);
                ms->setAttribute ( Qt::WA_DeleteOnClose, true );
                this->close();//closes the setting screen
                ms->exec();//shows the main sort window

                6.on "main sort screen" we have Back button to go back to "setting screen".

                1. we move to the "main sort screen" with code like the following:-

                  sd=new settingDialog();
                  sd->setAttribute ( Qt::WA_DeleteOnClose, true );
                  sd->setModal(true);
                  this->close();//closes the main sort screen
                  sd->exec();//shows the setting screen

                8.if i do the step 5 and 7 continuously the application gets slower .

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

                @swansorter said in Qt Application Slowing Down:

                if i do the step 5 and 7 continuously the application gets slower

                Then you have to investigate.
                Did you check CPU usage of your app?
                Did you check RAM usage of your app?

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

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

                  Hi
                  Also did you CHECK that your dialogs are in fact - deleted?
                  By breakpoints in their destructors.
                  WA_DeleteOnClose should take care of that but its good to check.

                  S 1 Reply Last reply
                  0
                  • mrjjM mrjj

                    Hi
                    Also did you CHECK that your dialogs are in fact - deleted?
                    By breakpoints in their destructors.
                    WA_DeleteOnClose should take care of that but its good to check.

                    S Offline
                    S Offline
                    swansorter
                    wrote on last edited by swansorter
                    #34

                    @mrjj yea checked.....execution of destructors are happening only when i moved to main window

                    mrjjM 1 Reply Last reply
                    0
                    • S swansorter

                      @mrjj yea checked.....execution of destructors are happening only when i moved to main window

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #35

                      @swansorter

                      Well is that the issue then?
                      If you dont move to mainwin, they are not freed,
                      so if u never do that then it grows.
                      or ?

                      S 1 Reply Last reply
                      0
                      • mrjjM mrjj

                        @swansorter

                        Well is that the issue then?
                        If you dont move to mainwin, they are not freed,
                        so if u never do that then it grows.
                        or ?

                        S Offline
                        S Offline
                        swansorter
                        wrote on last edited by
                        #36

                        @mrjj yes that is the issu..
                        how to free the object when the perticular screen "dialog" close?

                        mrjjM 1 Reply Last reply
                        0
                        • S swansorter

                          @mrjj yes that is the issu..
                          how to free the object when the perticular screen "dialog" close?

                          mrjjM Offline
                          mrjjM Offline
                          mrjj
                          Lifetime Qt Champion
                          wrote on last edited by mrjj
                          #37

                          @swansorter
                          well first of all you can clean up the places where newing is not needed.
                          All places where you use exec() for dialogs could just be

                          void class::insomefunc() {
                          mainSortDialog ms;
                          this->close();//closes the setting screen
                          ms->exec();
                          }
                          

                          and it would be cleaned up as soon as dialog is closed.
                          So unless you are not using exec() there should be no reason to new it.
                          and hence that could auto clean lots for you.

                          S 1 Reply Last reply
                          2
                          • mrjjM mrjj

                            @swansorter
                            well first of all you can clean up the places where newing is not needed.
                            All places where you use exec() for dialogs could just be

                            void class::insomefunc() {
                            mainSortDialog ms;
                            this->close();//closes the setting screen
                            ms->exec();
                            }
                            

                            and it would be cleaned up as soon as dialog is closed.
                            So unless you are not using exec() there should be no reason to new it.
                            and hence that could auto clean lots for you.

                            S Offline
                            S Offline
                            swansorter
                            wrote on last edited by swansorter
                            #38

                            @mrjj i tried this one ... working for me
                            thank you

                            mrjjM 1 Reply Last reply
                            2
                            • S swansorter

                              @mrjj i tried this one ... working for me
                              thank you

                              mrjjM Offline
                              mrjjM Offline
                              mrjj
                              Lifetime Qt Champion
                              wrote on last edited by
                              #39

                              @swansorter
                              Good. hopefully it can also cure the leaking.

                              S 1 Reply Last reply
                              0
                              • mrjjM mrjj

                                @swansorter
                                Good. hopefully it can also cure the leaking.

                                S Offline
                                S Offline
                                swansorter
                                wrote on last edited by swansorter
                                #40

                                @mrjj i used breakpoints on distructor
                                if i use close()...they are not freed
                                only if remove close()....they get cleared

                                mrjjM 1 Reply Last reply
                                0
                                • S swansorter

                                  @mrjj i used breakpoints on distructor
                                  if i use close()...they are not freed
                                  only if remove close()....they get cleared

                                  mrjjM Offline
                                  mrjjM Offline
                                  mrjj
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #41

                                  @swansorter

                                  Im not sure in what context.

                                  if using something like

                                  void class::insomefunc() {
                                  mainSortDialog ms;
                                  this->close();//closes the setting screen
                                  ms->exec();
                                  }

                                  MS should always be deleted. the this->close() should have no effect.

                                  If you use new for other classes make sure it still has WA_DeleteOnClose.

                                  S 1 Reply Last reply
                                  1
                                  • mrjjM mrjj

                                    @swansorter

                                    Im not sure in what context.

                                    if using something like

                                    void class::insomefunc() {
                                    mainSortDialog ms;
                                    this->close();//closes the setting screen
                                    ms->exec();
                                    }

                                    MS should always be deleted. the this->close() should have no effect.

                                    If you use new for other classes make sure it still has WA_DeleteOnClose.

                                    S Offline
                                    S Offline
                                    swansorter
                                    wrote on last edited by
                                    #42

                                    @mrjj
                                    am using this one move to main sort
                                    void class::insomefunc() {
                                    mainSortDialog ms;
                                    ms->exec();
                                    }
                                    and back to main screen by using just "hide();" in back button
                                    this is work for me even the memory leakage.
                                    but if use close(); its not working
                                    void class::insomefunc() {
                                    mainSortDialog ms;
                                    this->close();//closes the setting screen
                                    ms->exec();
                                    }

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

                                      hi
                                      in what way "not working" ?

                                      S 1 Reply Last reply
                                      0
                                      • mrjjM mrjj

                                        hi
                                        in what way "not working" ?

                                        S Offline
                                        S Offline
                                        swansorter
                                        wrote on last edited by swansorter
                                        #44

                                        @mrjj
                                        1.i used breakpoints on distructor of each screen.
                                        2.am moving to main sort using
                                        void class::insomefunc() {
                                        mainSortDialog ms;
                                        this->close();//closes the setting screen
                                        ms->exec();
                                        }
                                        3.and moving back to the home page
                                        void class::insomefunc() {
                                        homeDialog h;
                                        this->close();//closes the setting screen
                                        h->exec();
                                        }
                                        at this point it is not moving to destructor
                                        only if i move to mainwindow it moving to destructor mainsort page

                                        mrjjM 1 Reply Last reply
                                        0
                                        • S swansorter

                                          @mrjj
                                          1.i used breakpoints on distructor of each screen.
                                          2.am moving to main sort using
                                          void class::insomefunc() {
                                          mainSortDialog ms;
                                          this->close();//closes the setting screen
                                          ms->exec();
                                          }
                                          3.and moving back to the home page
                                          void class::insomefunc() {
                                          homeDialog h;
                                          this->close();//closes the setting screen
                                          h->exec();
                                          }
                                          at this point it is not moving to destructor
                                          only if i move to mainwindow it moving to destructor mainsort page

                                          mrjjM Offline
                                          mrjjM Offline
                                          mrjj
                                          Lifetime Qt Champion
                                          wrote on last edited by
                                          #45

                                          @swansorter
                                          Hi
                                          Really?
                                          but they are local variables. they will be destroyed.
                                          I can't see anyway, they could avoid that.

                                          jsulmJ 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