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. Timer Cannot Stop..?
Forum Updated to NodeBB v4.3 + New Features

Timer Cannot Stop..?

Scheduled Pinned Locked Moved Solved General and Desktop
10 Posts 6 Posters 1.1k 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.
  • P Offline
    P Offline
    PrAnit
    wrote on last edited by
    #1

    Im using two different timer on Start button like below

    0_1550663309463_Screenshot_18.png

    and In STOP button im doing
    timer->Stop();
    timer->Stop();

    But timer not Stop .

    How to stop timer here?

    Thank You.

    CP71C 1 Reply Last reply
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      It should. Show us the complete code. You must be doing some mistake the objects of timer.

      Dheerendra
      @Community Service
      Certified Qt Specialist
      http://www.pthinks.com

      1 Reply Last reply
      1
      • P PrAnit

        Im using two different timer on Start button like below

        0_1550663309463_Screenshot_18.png

        and In STOP button im doing
        timer->Stop();
        timer->Stop();

        But timer not Stop .

        How to stop timer here?

        Thank You.

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

        @PrAnit said in Timer Cannot Stop..?:

        timer->Stop();
        timer->Stop();

        Hi
        I see twice "timer", maybe second is "timer2", if only "timer2" doesn't stop

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

          Hi
          timer is a single shot so should not be running.
          and you should call
          timer2->Stop();

          in STOP button.

          RatzzR 1 Reply Last reply
          6
          • mrjjM mrjj

            Hi
            timer is a single shot so should not be running.
            and you should call
            timer2->Stop();

            in STOP button.

            RatzzR Offline
            RatzzR Offline
            Ratzz
            wrote on last edited by Ratzz
            #5

            @mrjj said in Timer Cannot Stop..?:

            should not be running.

            But it will timeout once ? (As doc says set a timer to time out only once by calling setSingleShot(true) )

            what if he tries to stops the timer before timeout?

            --Alles ist gut.

            mrjjM 1 Reply Last reply
            0
            • RatzzR Ratzz

              @mrjj said in Timer Cannot Stop..?:

              should not be running.

              But it will timeout once ? (As doc says set a timer to time out only once by calling setSingleShot(true) )

              what if he tries to stops the timer before timeout?

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

              @Ratzz
              hi
              Good thinking.
              calling stop() will remove/cancel the one-shot if not triggered yet.

              RatzzR 1 Reply Last reply
              1
              • mrjjM mrjj

                @Ratzz
                hi
                Good thinking.
                calling stop() will remove/cancel the one-shot if not triggered yet.

                RatzzR Offline
                RatzzR Offline
                Ratzz
                wrote on last edited by
                #7

                @mrjj said in Timer Cannot Stop..?:

                calling stop() will remove the one-shot if not triggered yet.

                May be OP also failed to stop the timer set with setSingleShot ?

                --Alles ist gut.

                mrjjM 1 Reply Last reply
                0
                • RatzzR Ratzz

                  @mrjj said in Timer Cannot Stop..?:

                  calling stop() will remove the one-shot if not triggered yet.

                  May be OP also failed to stop the timer set with setSingleShot ?

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

                  @Ratzz
                  hi
                  it's unclear what the real issue is.
                  The code shown would not stop timer2
                  but could be copy paste error.

                  RatzzR J.HilkJ 2 Replies Last reply
                  0
                  • mrjjM mrjj

                    @Ratzz
                    hi
                    it's unclear what the real issue is.
                    The code shown would not stop timer2
                    but could be copy paste error.

                    RatzzR Offline
                    RatzzR Offline
                    Ratzz
                    wrote on last edited by
                    #9

                    @mrjj said in Timer Cannot Stop..?:

                    could be copy paste error

                    May be :)

                    --Alles ist gut.

                    1 Reply Last reply
                    0
                    • mrjjM mrjj

                      @Ratzz
                      hi
                      it's unclear what the real issue is.
                      The code shown would not stop timer2
                      but could be copy paste error.

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

                      until the op actually shows the function where he calls stop(), it may just as well be variable shadowing.


                      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.

                      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