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 5.9.8 errors with timers and buttons
Forum Updated to NodeBB v4.3 + New Features

Qt 5.9.8 errors with timers and buttons

Scheduled Pinned Locked Moved Unsolved General and Desktop
20 Posts 4 Posters 1.6k Views 2 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.
  • L Offline
    L Offline
    Loc888
    wrote on 28 Apr 2019, 07:15 last edited by Loc888
    #1

    I did install Qt 5.9.8 minGw_530 with MinGW 4.8 and 4.9.2, my friend has windows 10, i did send him my software for testing, and he has problems with timers and buttons.

    The timers start but you need 2 or 3 buttons click just to start it and it's consistent.
    Messy thing is i did send him exactly the same code with qt 5.2.1, and there is not a single issue with it.... I am out of ideas how to fix it, basically i have qt 5.8, 5.9.8 and they all create the same or more errors related to timer start, when i am using qt 5.2.1 there is not a single issue.

    Help because i am out of ideas how to fix it, i already lost more time then i can afford.
    Because i am using custom timer, i will show the start function:

    
    void Timer::Start(int refire_time)
    {
        if(this->started == false)
        {
            this->timer.start(refire_time);
            this->time.start();
        }
        else
        {
            this->difference = this->elapsed_time.fromMSecsSinceStartOfDay(this->elapsed_time.elapsed()).elapsed();
        }
        this->time = QTime::fromMSecsSinceStartOfDay(this->elapsed_time.elapsed());
        this->started = true;
    }
    

    This is from the button:

    void Main_Window::on_start_stopwatch_button_pressed()
    {
        if(this->timer->Is_Started() == true)
        {
            this->timer->Stop();
            this->ui->start_stopwatch_button->setText("Start");
        }
        else
        {
            this->timer->Start(1);
            this->ui->start_stopwatch_button->setText("Stop");
        }
    }
    
    A 1 Reply Last reply 28 Apr 2019, 07:36
    0
    • C Online
      C Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 28 Apr 2019, 07:31 last edited by
      #2

      What is 'elapsed_time', what should QTime::fromMSecsSinceStartOfDay() do and why do you use 'this->' everywhere? C++ is not java and it just makes the code unreadable. Use a proper notation for the members (e.g. let them start with 'm_')

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

      L 1 Reply Last reply 28 Apr 2019, 07:44
      3
      • L Loc888
        28 Apr 2019, 07:15

        I did install Qt 5.9.8 minGw_530 with MinGW 4.8 and 4.9.2, my friend has windows 10, i did send him my software for testing, and he has problems with timers and buttons.

        The timers start but you need 2 or 3 buttons click just to start it and it's consistent.
        Messy thing is i did send him exactly the same code with qt 5.2.1, and there is not a single issue with it.... I am out of ideas how to fix it, basically i have qt 5.8, 5.9.8 and they all create the same or more errors related to timer start, when i am using qt 5.2.1 there is not a single issue.

        Help because i am out of ideas how to fix it, i already lost more time then i can afford.
        Because i am using custom timer, i will show the start function:

        
        void Timer::Start(int refire_time)
        {
            if(this->started == false)
            {
                this->timer.start(refire_time);
                this->time.start();
            }
            else
            {
                this->difference = this->elapsed_time.fromMSecsSinceStartOfDay(this->elapsed_time.elapsed()).elapsed();
            }
            this->time = QTime::fromMSecsSinceStartOfDay(this->elapsed_time.elapsed());
            this->started = true;
        }
        

        This is from the button:

        void Main_Window::on_start_stopwatch_button_pressed()
        {
            if(this->timer->Is_Started() == true)
            {
                this->timer->Stop();
                this->ui->start_stopwatch_button->setText("Start");
            }
            else
            {
                this->timer->Start(1);
                this->ui->start_stopwatch_button->setText("Stop");
            }
        }
        
        A Offline
        A Offline
        aha_1980
        Lifetime Qt Champion
        wrote on 28 Apr 2019, 07:36 last edited by
        #3

        @Loc888

        I did install Qt 5.9.8 minGw_530 with MinGW 4.8 and 4.9.2

        Qt is compiled with MinGW 5.3.0, so you should use exactly that version. You can install it with MaintenanceTool.

        Qt has to stay free or it will die.

        L 1 Reply Last reply 28 Apr 2019, 07:48
        1
        • C Christian Ehrlicher
          28 Apr 2019, 07:31

          What is 'elapsed_time', what should QTime::fromMSecsSinceStartOfDay() do and why do you use 'this->' everywhere? C++ is not java and it just makes the code unreadable. Use a proper notation for the members (e.g. let them start with 'm_')

          L Offline
          L Offline
          Loc888
          wrote on 28 Apr 2019, 07:44 last edited by
          #4

          @Christian-Ehrlicher If this code is unreadable, then it means just it's unreadable for you, i use this whenever i use any member, so what is the point to use m_? Also this change the color to green, and for me is much better to read it.

          The correct question should be, why is it working for me, why is it working with Qt 5.2.1, and why is NOT working with qt 5.9.8 on my friend's PC.

          M A C 3 Replies Last reply 28 Apr 2019, 07:49
          0
          • A aha_1980
            28 Apr 2019, 07:36

            @Loc888

            I did install Qt 5.9.8 minGw_530 with MinGW 4.8 and 4.9.2

            Qt is compiled with MinGW 5.3.0, so you should use exactly that version. You can install it with MaintenanceTool.

            L Offline
            L Offline
            Loc888
            wrote on 28 Apr 2019, 07:48 last edited by Loc888
            #5

            @aha_1980 Listen, this is what your QT team put to the package, i did download Qt 5.9.8 and there was MinGw 4.9.2, i am not sure if those names are also even correct. With this approach Qt 5.2 should not work too, because it's using MinGW 4.8.

            Qt maintance tool.... I am not even comment it, this is how helpfull it is https://forum.qt.io/topic/102119/qt-charts-installation/5

            A 1 Reply Last reply 28 Apr 2019, 08:00
            0
            • L Loc888
              28 Apr 2019, 07:44

              @Christian-Ehrlicher If this code is unreadable, then it means just it's unreadable for you, i use this whenever i use any member, so what is the point to use m_? Also this change the color to green, and for me is much better to read it.

              The correct question should be, why is it working for me, why is it working with Qt 5.2.1, and why is NOT working with qt 5.9.8 on my friend's PC.

              M Offline
              M Offline
              mrjj
              Lifetime Qt Champion
              wrote on 28 Apr 2019, 07:49 last edited by
              #6

              @Loc888
              Hi
              Just a quick question?
              You send your friend the source code ?
              and he compiles with qt 5.9.8 and it works differently ?
              Or do you send him a binary exe WITH the needed dlls ?

              L 1 Reply Last reply 28 Apr 2019, 07:51
              1
              • M mrjj
                28 Apr 2019, 07:49

                @Loc888
                Hi
                Just a quick question?
                You send your friend the source code ?
                and he compiles with qt 5.9.8 and it works differently ?
                Or do you send him a binary exe WITH the needed dlls ?

                L Offline
                L Offline
                Loc888
                wrote on 28 Apr 2019, 07:51 last edited by Loc888
                #7

                @mrjj Binary exe with DLL's, like i said the SAME code is working perfect with QT 5.2.1 and MinGW 4.8, but not with the latest version.

                So again, i did send him the QT 5.2.1 MinGW 4.8 dll's and exe, no issues.

                1 Reply Last reply
                0
                • L Loc888
                  28 Apr 2019, 07:48

                  @aha_1980 Listen, this is what your QT team put to the package, i did download Qt 5.9.8 and there was MinGw 4.9.2, i am not sure if those names are also even correct. With this approach Qt 5.2 should not work too, because it's using MinGW 4.8.

                  Qt maintance tool.... I am not even comment it, this is how helpfull it is https://forum.qt.io/topic/102119/qt-charts-installation/5

                  A Offline
                  A Offline
                  aha_1980
                  Lifetime Qt Champion
                  wrote on 28 Apr 2019, 08:00 last edited by
                  #8

                  @Loc888

                  @aha_1980 Listen, this is what your QT team this put it to the package

                  As I'm not working for the Qt company, I can't comment on that. But as you are having problems, this might be relevant.

                  Qt has to stay free or it will die.

                  1 Reply Last reply
                  0
                  • L Loc888
                    28 Apr 2019, 07:44

                    @Christian-Ehrlicher If this code is unreadable, then it means just it's unreadable for you, i use this whenever i use any member, so what is the point to use m_? Also this change the color to green, and for me is much better to read it.

                    The correct question should be, why is it working for me, why is it working with Qt 5.2.1, and why is NOT working with qt 5.9.8 on my friend's PC.

                    A Offline
                    A Offline
                    aha_1980
                    Lifetime Qt Champion
                    wrote on 28 Apr 2019, 08:04 last edited by aha_1980
                    #9

                    @Loc888

                    why is it working for me, why is it working with Qt 5.2.1, and why is NOT working with qt 5.9.8 on my friend's PC.

                    You would need to share compileable code that demonstrates the problem if you want us to be able to help you.

                    Qt has to stay free or it will die.

                    L 2 Replies Last reply 28 Apr 2019, 08:08
                    1
                    • A aha_1980
                      28 Apr 2019, 08:04

                      @Loc888

                      why is it working for me, why is it working with Qt 5.2.1, and why is NOT working with qt 5.9.8 on my friend's PC.

                      You would need to share compileable code that demonstrates the problem if you want us to be able to help you.

                      L Offline
                      L Offline
                      Loc888
                      wrote on 28 Apr 2019, 08:08 last edited by
                      #10

                      @aha_1980 There is no way i will send the whole source of the software, i can just send the test project. I am gonna create it now.

                      M 1 Reply Last reply 28 Apr 2019, 08:46
                      0
                      • L Loc888
                        28 Apr 2019, 08:08

                        @aha_1980 There is no way i will send the whole source of the software, i can just send the test project. I am gonna create it now.

                        M Offline
                        M Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on 28 Apr 2019, 08:46 last edited by
                        #11

                        @Loc888
                        Super that is exactly what @aha_1980 asked for. :)

                        1 Reply Last reply
                        1
                        • A aha_1980
                          28 Apr 2019, 08:04

                          @Loc888

                          why is it working for me, why is it working with Qt 5.2.1, and why is NOT working with qt 5.9.8 on my friend's PC.

                          You would need to share compileable code that demonstrates the problem if you want us to be able to help you.

                          L Offline
                          L Offline
                          Loc888
                          wrote on 28 Apr 2019, 08:51 last edited by Loc888
                          #12

                          @aha_1980 There you go, this is the link:
                          http://www.mediafire.com/file/7me3ya2tkrr9pto/Error.zip/file

                          There is Qt 5.2.1 DLL's and exe, and also Qt 5.9.8. The code also is there.
                          If you ask me why did i use Connect() in constructor, and in Connect use the real function is because i had a lot of trouble in the past by putting the connections directly in constructor, and i found this simple trick fixed it.

                          Ps. Those are the errors i get using Qt 5.9.8:

                          C: /Programs/Programming/QT/Qt5.9.8/5.9.8/mingw53_32/mkspecs/features/toolchain.prf (69): system (execute) requires one or two arguments.
                          Project ERROR: Can not run compiler 'g ++'. Output:

                          ===================
                          Maybe you forgot to setup the environment?
                          Error parsing C file: /Users/2017/Documents/Qt_Projects/Buttons_test/Buttons_Test/Buttons_Test.pro. Processing interrupted.
                          Warnings when parsing information qmltypes in C: /Programs/Programming/QT/Qt5.9.8/5.9.8/mingw53_32/imports:
                          1:24: Reading only version 1.1 parts.
                          10: 5: Only the definition of a Component or ModuleApi object was expected.

                          A 1 Reply Last reply 28 Apr 2019, 10:05
                          0
                          • L Loc888
                            28 Apr 2019, 08:51

                            @aha_1980 There you go, this is the link:
                            http://www.mediafire.com/file/7me3ya2tkrr9pto/Error.zip/file

                            There is Qt 5.2.1 DLL's and exe, and also Qt 5.9.8. The code also is there.
                            If you ask me why did i use Connect() in constructor, and in Connect use the real function is because i had a lot of trouble in the past by putting the connections directly in constructor, and i found this simple trick fixed it.

                            Ps. Those are the errors i get using Qt 5.9.8:

                            C: /Programs/Programming/QT/Qt5.9.8/5.9.8/mingw53_32/mkspecs/features/toolchain.prf (69): system (execute) requires one or two arguments.
                            Project ERROR: Can not run compiler 'g ++'. Output:

                            ===================
                            Maybe you forgot to setup the environment?
                            Error parsing C file: /Users/2017/Documents/Qt_Projects/Buttons_test/Buttons_Test/Buttons_Test.pro. Processing interrupted.
                            Warnings when parsing information qmltypes in C: /Programs/Programming/QT/Qt5.9.8/5.9.8/mingw53_32/imports:
                            1:24: Reading only version 1.1 parts.
                            10: 5: Only the definition of a Component or ModuleApi object was expected.

                            A Offline
                            A Offline
                            aha_1980
                            Lifetime Qt Champion
                            wrote on 28 Apr 2019, 10:05 last edited by
                            #13

                            @Loc888

                            I've tested your source on Linux, as I don't have Windows at home.

                            Your example worked fine, but honestly, I think it is much too complicated.

                            I've uploaded a simplified example here: https://filebin.net/x6cg9wnbwjvtt2nb

                            Maybe you can try that on Windows and report if it works?

                            Ps. Those are the errors i get using Qt 5.9.8:
                            C: /Programs/Programming/QT/Qt5.9.8/5.9.8/mingw53_32/mkspecs/features/toolchain.prf (69): system (execute) requires one or two arguments.
                            Project ERROR: Can not run compiler 'g ++'. Output:

                            That does not look related to your code, but more like a general problem. You should probably create a new thread for that.

                            Qt has to stay free or it will die.

                            1 Reply Last reply
                            2
                            • L Loc888
                              28 Apr 2019, 07:44

                              @Christian-Ehrlicher If this code is unreadable, then it means just it's unreadable for you, i use this whenever i use any member, so what is the point to use m_? Also this change the color to green, and for me is much better to read it.

                              The correct question should be, why is it working for me, why is it working with Qt 5.2.1, and why is NOT working with qt 5.9.8 on my friend's PC.

                              C Online
                              C Online
                              Christian Ehrlicher
                              Lifetime Qt Champion
                              wrote on 28 Apr 2019, 10:10 last edited by
                              #14

                              @Loc888 said in Qt 5.9.8 errors with timers and buttons:

                              The correct question should be, why is it working for me

                              If you want us to take a look into your code you should make it readable for others... and using java-style is definitely very uncomfortable to read for a C++ programmer... :)

                              From my pov it looks like a cpu problem - you're updating the label (and you internal variables) every 1ms for no reason.

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

                              L 1 Reply Last reply 28 Apr 2019, 10:30
                              1
                              • C Christian Ehrlicher
                                28 Apr 2019, 10:10

                                @Loc888 said in Qt 5.9.8 errors with timers and buttons:

                                The correct question should be, why is it working for me

                                If you want us to take a look into your code you should make it readable for others... and using java-style is definitely very uncomfortable to read for a C++ programmer... :)

                                From my pov it looks like a cpu problem - you're updating the label (and you internal variables) every 1ms for no reason.

                                L Offline
                                L Offline
                                Loc888
                                wrote on 28 Apr 2019, 10:30 last edited by
                                #15

                                @Christian-Ehrlicher Man, IF THIS is unreadable code, then look at the circus aka STD lib, and other junk, then you will see truly a not readable code. Yes, i know their code is not for read etc, but compare it.

                                You said i am updating it for no reason? It's a stopwatch.. Not a finger version of a counter..

                                1 Reply Last reply
                                0
                                • C Online
                                  C Online
                                  Christian Ehrlicher
                                  Lifetime Qt Champion
                                  wrote on 28 Apr 2019, 10:46 last edited by Christian Ehrlicher
                                  #16

                                  @Loc888 said in Qt 5.9.8 errors with timers and buttons:

                                  It's a stopwatch.. Not a finger version of a counter..

                                  So you tell me that you can read all with 1000Hz ? Ok - I'm out ...

                                  And I think you're also confused by your style:

                                  if(this->started == false){this->started = false;}
                                  else if(this->started == true){this->started = true;}
                                  

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

                                  L 1 Reply Last reply 28 Apr 2019, 10:49
                                  0
                                  • C Christian Ehrlicher
                                    28 Apr 2019, 10:46

                                    @Loc888 said in Qt 5.9.8 errors with timers and buttons:

                                    It's a stopwatch.. Not a finger version of a counter..

                                    So you tell me that you can read all with 1000Hz ? Ok - I'm out ...

                                    And I think you're also confused by your style:

                                    if(this->started == false){this->started = false;}
                                    else if(this->started == true){this->started = true;}
                                    
                                    L Offline
                                    L Offline
                                    Loc888
                                    wrote on 28 Apr 2019, 10:49 last edited by Loc888
                                    #17

                                    @Christian-Ehrlicher
                                    Actually my reflex is good, but i don't read the whole 1000. What you are doing, you are saying i should put what? Value of 50? But i can tell you something, if i spit in my eye, and run that timer with a value of 50ms, i can guarantee you i see the difference, i know because i did. It just looks stupid.

                                    Ps. That thing you show i used it to fix one issue, and i left it because it's useful in one action. Same thing with connect from Connect and connect, there was an error.... Call your Qt friends and tell them to fix it, then i will not have to lose time, because that both weird codes fixed the issues.

                                    Ps2. I tested it with value of 50, it looks like retarded finger counter, 20 a little better, but the last number never moves, by 5 i can see clearly the step is by 5, only value of 1deos the job. If someone laugh at me, i will record you a video of it and show you.

                                    A 1 Reply Last reply 28 Apr 2019, 11:13
                                    0
                                    • L Loc888
                                      28 Apr 2019, 10:49

                                      @Christian-Ehrlicher
                                      Actually my reflex is good, but i don't read the whole 1000. What you are doing, you are saying i should put what? Value of 50? But i can tell you something, if i spit in my eye, and run that timer with a value of 50ms, i can guarantee you i see the difference, i know because i did. It just looks stupid.

                                      Ps. That thing you show i used it to fix one issue, and i left it because it's useful in one action. Same thing with connect from Connect and connect, there was an error.... Call your Qt friends and tell them to fix it, then i will not have to lose time, because that both weird codes fixed the issues.

                                      Ps2. I tested it with value of 50, it looks like retarded finger counter, 20 a little better, but the last number never moves, by 5 i can see clearly the step is by 5, only value of 1deos the job. If someone laugh at me, i will record you a video of it and show you.

                                      A Offline
                                      A Offline
                                      aha_1980
                                      Lifetime Qt Champion
                                      wrote on 28 Apr 2019, 11:13 last edited by
                                      #18

                                      Hi @Loc888,

                                      Ps. That thing you show i used it to fix one issue,

                                      If you are talking about that one:

                                      if(this->started == false){this->started = false;}
                                      else if(this->started == true){this->started = true;}

                                      then no, that fixes nothing.

                                      Please try my code and tell us if it works.

                                      Same thing with connect from Connect and connect, there was an error....

                                      Which error are you talking about?

                                      Qt has to stay free or it will die.

                                      L 2 Replies Last reply 28 Apr 2019, 11:19
                                      0
                                      • A aha_1980
                                        28 Apr 2019, 11:13

                                        Hi @Loc888,

                                        Ps. That thing you show i used it to fix one issue,

                                        If you are talking about that one:

                                        if(this->started == false){this->started = false;}
                                        else if(this->started == true){this->started = true;}

                                        then no, that fixes nothing.

                                        Please try my code and tell us if it works.

                                        Same thing with connect from Connect and connect, there was an error....

                                        Which error are you talking about?

                                        L Offline
                                        L Offline
                                        Loc888
                                        wrote on 28 Apr 2019, 11:19 last edited by Loc888
                                        #19

                                        @aha_1980 I did play a little bit with my Qt, try to add / delete the versions, i did send it to my friend, and now he told me it's working perfectly.... I did change NOTHING, except i did add some qt versions to creator 5.2.1, then delete them, change some compile settings and then make the same i used.
                                        Both the tests and real softwares works, i don't know what the problem was then.

                                        ps. I talked with my fiend. What he told me, he downloaded the old versions, before i did any changes in Qt and re-compile the software, and they works both now.
                                        My friend has a big mess and junk on his pc, by accident he did install something like regCleaner, after we did the tests. That cleaner runs from nowhere, do a scan, mess up his system, and he had to delete some softwares to get it on the point. We did the tests before that thing was on his PC.

                                        After he did it, all the software started to work. Also, his UI in windows 10 was messed up ,in my software too, but it happened after we tested it, and also before the regCleaner mess up his performance, those buttons was not working, after it they started. So, whos fault was it then?

                                        1 Reply Last reply
                                        0
                                        • A aha_1980
                                          28 Apr 2019, 11:13

                                          Hi @Loc888,

                                          Ps. That thing you show i used it to fix one issue,

                                          If you are talking about that one:

                                          if(this->started == false){this->started = false;}
                                          else if(this->started == true){this->started = true;}

                                          then no, that fixes nothing.

                                          Please try my code and tell us if it works.

                                          Same thing with connect from Connect and connect, there was an error....

                                          Which error are you talking about?

                                          L Offline
                                          L Offline
                                          Loc888
                                          wrote on 28 Apr 2019, 12:13 last edited by Loc888
                                          #20

                                          @aha_1980 About that connect error, i don't remember exactly, but it was something like i changed the style sheet in the windows constructor, then use the resize event and connect, and the performance was horrible. I just move the code from there, and put into a sub-function with the same code, and it helped.

                                          1 Reply Last reply
                                          0

                                          1/20

                                          28 Apr 2019, 07:15

                                          • Login

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