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. QTimer doesn't work the expected way
Forum Updated to NodeBB v4.3 + New Features

QTimer doesn't work the expected way

Scheduled Pinned Locked Moved Solved General and Desktop
29 Posts 4 Posters 1.8k Views 1 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.
  • M MasterBlade

    @jsulm said in QTimer doesn't work the expected way:

    @MasterBlade said in QTimer doesn't work the expected way:

    May I ask how to stop the debugger?

    Simply press the same button you used to start debugging...

    I paused the debugger, but didn't find many differences. Application output only has a single line. Where else should I check?

    15:16:35: Debugging starts
    
    jsulmJ Offline
    jsulmJ Offline
    jsulm
    Lifetime Qt Champion
    wrote on last edited by
    #12

    @MasterBlade said in QTimer doesn't work the expected way:

    Where else should I check?

    In the debugger. In debugger view there is "Debugger" section with the stack trace (select thread #1). You should really get familiar with the debugger.

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

    M 1 Reply Last reply
    1
    • jsulmJ jsulm

      @MasterBlade said in QTimer doesn't work the expected way:

      Where else should I check?

      In the debugger. In debugger view there is "Debugger" section with the stack trace (select thread #1). You should really get familiar with the debugger.

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

      @jsulm said in QTimer doesn't work the expected way:

      @MasterBlade said in QTimer doesn't work the expected way:

      Where else should I check?

      In the debugger. In debugger view there is "Debugger" section with the stack trace (select thread #1). You should really get familiar with the debugger.

      1.png

      jsulmJ 1 Reply Last reply
      0
      • M MasterBlade

        @jsulm said in QTimer doesn't work the expected way:

        @MasterBlade said in QTimer doesn't work the expected way:

        Where else should I check?

        In the debugger. In debugger view there is "Debugger" section with the stack trace (select thread #1). You should really get familiar with the debugger.

        1.png

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

        @MasterBlade When exactly did you take this screen-shot? When your app was blocked? You also can check other threads.

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

        M 1 Reply Last reply
        0
        • jsulmJ jsulm

          @MasterBlade When exactly did you take this screen-shot? When your app was blocked? You also can check other threads.

          M Offline
          M Offline
          MasterBlade
          wrote on last edited by
          #15

          @jsulm said in QTimer doesn't work the expected way:

          @MasterBlade When exactly did you take this screen-shot? When your app was blocked? You also can check other threads.

          Yeah it was taken when the program was blocked.
          Thread #1-5 looks the same to me.

          Thread #6 and #7
          2.png
          3.png

          #8 and #9 are same as #1-5

          #10-13
          357baa19-b6cd-45c4-815b-6d2fba72be71-image.png

          #14
          b4c07d35-4b68-45ef-80d9-11635f78c4e1-image.png

          #15
          1ac91703-d49f-4777-ba3f-11b4c1ca9c7a-image.png

          jsulmJ 1 Reply Last reply
          0
          • M MasterBlade

            @jsulm said in QTimer doesn't work the expected way:

            @MasterBlade When exactly did you take this screen-shot? When your app was blocked? You also can check other threads.

            Yeah it was taken when the program was blocked.
            Thread #1-5 looks the same to me.

            Thread #6 and #7
            2.png
            3.png

            #8 and #9 are same as #1-5

            #10-13
            357baa19-b6cd-45c4-815b-6d2fba72be71-image.png

            #14
            b4c07d35-4b68-45ef-80d9-11635f78c4e1-image.png

            #15
            1ac91703-d49f-4777-ba3f-11b4c1ca9c7a-image.png

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

            @MasterBlade Do you actually use threads in your app?

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

            M 1 Reply Last reply
            0
            • jsulmJ jsulm

              @MasterBlade Do you actually use threads in your app?

              M Offline
              M Offline
              MasterBlade
              wrote on last edited by
              #17

              @jsulm said in QTimer doesn't work the expected way:

              @MasterBlade Do you actually use threads in your app?

              I don't think I did. I don't know why there are so many threads.

              jsulmJ 1 Reply Last reply
              0
              • M MasterBlade

                @jsulm said in QTimer doesn't work the expected way:

                @MasterBlade Do you actually use threads in your app?

                I don't think I did. I don't know why there are so many threads.

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

                @MasterBlade That's normal. I just wanted to know whether you create threads also by yourself. From the stack trace I can't see anything helpful.

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

                M 1 Reply Last reply
                0
                • jsulmJ jsulm

                  @MasterBlade That's normal. I just wanted to know whether you create threads also by yourself. From the stack trace I can't see anything helpful.

                  M Offline
                  M Offline
                  MasterBlade
                  wrote on last edited by
                  #19

                  @jsulm said in QTimer doesn't work the expected way:

                  @MasterBlade That's normal. I just wanted to know whether you create threads also by yourself. From the stack trace I can't see anything helpful.

                  There is one problem I found curious. I am also using QSettings to write INI files, and I found it quite slow. Usually takes like 2 secs to write. I didn't use QTimer in that code. So I guess if it's QSettings that caused the block.

                  jsulmJ 1 Reply Last reply
                  0
                  • M MasterBlade

                    @jsulm said in QTimer doesn't work the expected way:

                    @MasterBlade That's normal. I just wanted to know whether you create threads also by yourself. From the stack trace I can't see anything helpful.

                    There is one problem I found curious. I am also using QSettings to write INI files, and I found it quite slow. Usually takes like 2 secs to write. I didn't use QTimer in that code. So I guess if it's QSettings that caused the block.

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

                    @MasterBlade Where are the settings stored? Is it network drive, local drive, Windows registry?

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

                    M 1 Reply Last reply
                    0
                    • jsulmJ jsulm

                      @MasterBlade Where are the settings stored? Is it network drive, local drive, Windows registry?

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

                      @jsulm said in QTimer doesn't work the expected way:

                      @MasterBlade Where are the settings stored? Is it network drive, local drive, Windows registry?

                      local hard disk in INI format

                      jsulmJ J.HilkJ 2 Replies Last reply
                      0
                      • M MasterBlade

                        @jsulm said in QTimer doesn't work the expected way:

                        @MasterBlade Where are the settings stored? Is it network drive, local drive, Windows registry?

                        local hard disk in INI format

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

                        @MasterBlade It is really strange if it takes so long.

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

                        M 1 Reply Last reply
                        0
                        • M MasterBlade

                          @jsulm said in QTimer doesn't work the expected way:

                          @MasterBlade Where are the settings stored? Is it network drive, local drive, Windows registry?

                          local hard disk in INI format

                          J.HilkJ Offline
                          J.HilkJ Offline
                          J.Hilk
                          Moderators
                          wrote on last edited by
                          #23

                          @MasterBlade QSettings is usually super quick,

                          how big is the resulting ini file ending up ?
                          Mb's ?


                          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.

                          M 2 Replies Last reply
                          0
                          • jsulmJ jsulm

                            @MasterBlade It is really strange if it takes so long.

                            M Offline
                            M Offline
                            MasterBlade
                            wrote on last edited by
                            #24

                            @jsulm said in QTimer doesn't work the expected way:

                            @MasterBlade It is really strange if it takes so long.

                            Well actually I was storing it in OneDrive folder. Will that take longer?

                            jsulmJ 1 Reply Last reply
                            0
                            • J.HilkJ J.Hilk

                              @MasterBlade QSettings is usually super quick,

                              how big is the resulting ini file ending up ?
                              Mb's ?

                              M Offline
                              M Offline
                              MasterBlade
                              wrote on last edited by
                              #25

                              @J-Hilk said in QTimer doesn't work the expected way:

                              @MasterBlade QSettings is usually super quick,

                              how big is the resulting ini file ending up ?
                              Mb's ?

                              Only 94 KiB

                              1 Reply Last reply
                              0
                              • M MasterBlade

                                @jsulm said in QTimer doesn't work the expected way:

                                @MasterBlade It is really strange if it takes so long.

                                Well actually I was storing it in OneDrive folder. Will that take longer?

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

                                @MasterBlade said in QTimer doesn't work the expected way:

                                Well actually I was storing it in OneDrive folder. Will that take longer?

                                It can. Try to store it locally and see whether this makes a difference...

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

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

                                  @MasterBlade QSettings is usually super quick,

                                  how big is the resulting ini file ending up ?
                                  Mb's ?

                                  M Offline
                                  M Offline
                                  MasterBlade
                                  wrote on last edited by MasterBlade
                                  #27

                                  @jsulm said in QTimer doesn't work the expected way:

                                  @MasterBlade said in QTimer doesn't work the expected way:

                                  Well actually I was storing it in OneDrive folder. Will that take longer?

                                  It can. Try to store it locally and see whether this makes a difference...

                                  I tried to store ini file to a different folder other than OneDrive. It is now much faster. Around 250 ms. Not super fast but somewhat acceptable.
                                  Edit: Saving in Onedrive folder takes about 850 ms

                                  jsulmJ 1 Reply Last reply
                                  1
                                  • M MasterBlade

                                    @jsulm said in QTimer doesn't work the expected way:

                                    @MasterBlade said in QTimer doesn't work the expected way:

                                    Well actually I was storing it in OneDrive folder. Will that take longer?

                                    It can. Try to store it locally and see whether this makes a difference...

                                    I tried to store ini file to a different folder other than OneDrive. It is now much faster. Around 250 ms. Not super fast but somewhat acceptable.
                                    Edit: Saving in Onedrive folder takes about 850 ms

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

                                    @MasterBlade You could do the INI file writing in a thread QtConcurrent::run should be enough.

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

                                    M 1 Reply Last reply
                                    2
                                    • jsulmJ jsulm

                                      @MasterBlade You could do the INI file writing in a thread QtConcurrent::run should be enough.

                                      M Offline
                                      M Offline
                                      MasterBlade
                                      wrote on last edited by
                                      #29

                                      @jsulm said in QTimer doesn't work the expected way:

                                      @MasterBlade You could do the INI file writing in a thread QtConcurrent::run should be enough.

                                      It's now working super fast! Thank you so much!

                                      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