Page 3 of 3 FirstFirst 123
Results 41 to 48 of 48

Thread: Multiple timers in single Application

  1. #41
    Join Date
    Sep 2012
    Posts
    32
    Thanks
    18
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Multiple timers in single Application

    Quote Originally Posted by mahi6a1985 View Post
    Hi Wysota,
    using your code i came to know that all of my slots connected to timers are executed(i.e. Each Slot start to End of it.) below 10MS. Thanks for this.
    But now what i want is that each slots should be executed every 500ms. means the slots should be called every 500ms some of them and some them every 250ms. Can you suggest me anything please.

    So this means ---

    1st timer SLOT to be called every 500ms and for execution of slot it takes 6ms.
    2nd timer SLOT to be called every 600ms and for execution of slot it takes 4ms.
    3rd timer SLOT to be called every 100ms and for the execution of slot it takes 4ms.
    4th timer SLOT to be called every 1000ms and for the execution of slot it takes 6ms.
    5th timer SLOT to be called every 3000ms and for the execution of slot it takes 3ms.
    6th timer SLOT to be called every 5000ms and for the execution of slot it takes 2ms.

    Note :- The execution of slot time i given above is calculated using the QTime::elapsed() for each of my slots.

    Thanks in Advance.
    Hi Wysota,

    please suggest me any solution for the above. and one more thing in QT tips i found a point "Keep response times short" what does it mean can i have a sample app, if possible.

    Thanks in Advance
    Last edited by mahi6a1985; 4th October 2012 at 12:58.

  2. #42
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Multiple timers in single Application

    Quote Originally Posted by mahi6a1985 View Post
    please suggest me any solution for the above
    A solution for what?

    and one more thing in QT tips i found a point "Keep response times short" what does it mean
    It means you should make your functions short and fast and not long and slow to avoid freezing the user interface (and possibly the whole system).
    can i have a sample app, if possible.
    No but you can read this article: [wiki]Keeping the GUI Responsive[/wiki].
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #43
    Join Date
    Sep 2012
    Posts
    32
    Thanks
    18
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Multiple timers in single Application

    hi Wysota,

    The solution is for my the app description i mention above-
    means,
    1st timer SLOT to be called every 500ms and for execution of slot it takes 6ms.
    2nd timer SLOT to be called every 600ms and for execution of slot it takes 4ms.
    3rd timer SLOT to be called every 100ms and for the execution of slot it takes 4ms.
    4th timer SLOT to be called every 1000ms and for the execution of slot it takes 6ms.
    5th timer SLOT to be called every 3000ms and for the execution of slot it takes 3ms.
    6th timer SLOT to be called every 5000ms and for the execution of slot it takes 2ms.

    Note :- The execution of slot time i given above is calculated using the QTime::elapsed() for each of my slots.

  4. #44
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Multiple timers in single Application

    Start one timer with 100ms interval and call appropriate functions from the timer's timeout slot. Calculate time using QTime::elapsed() rathar than counting how many times the timeout slot was called.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. The following user says thank you to wysota for this useful post:

    mahi6a1985 (5th October 2012)

  6. #45
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Multiple timers in single Application

    Quote Originally Posted by mahi6a1985 View Post
    please suggest me any solution for the above.
    I have already given you exactly this. Several people had given you all the necessary information to do it yourself before that. Why do you keep asking the same question over and over? Are you actually understanding anything or just hoping for a cut'n'paste magic bullet? Please understand that we are not going to come to your office and write your program for you.

    How to implement it in One Timer with 100ms can i know ?
    In the slot keep a count of the number of times the timer has elapsed, or use QTime::elapsed(), and:
    • every time the timer elapses do task 3,
    • every 5th time also do task 1,
    • every 6th time also do task 2,
    • every 10th time also do task 4,
    • every 30th time also do task 5,
    • every 50th time also do task 6.

    No. I will not write the code for this. I don't think you understand how the naïve version I gave you works, and this requires more understanding.

  7. #46
    Join Date
    Sep 2012
    Posts
    32
    Thanks
    18
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Multiple timers in single Application

    Quote Originally Posted by ChrisW67 View Post
    I have already given you exactly this. Several people had given you all the necessary information to do it yourself before that. Why do you keep asking the same question over and over? Are you actually understanding anything or just hoping for a cut'n'paste magic bullet? Please understand that we are not going to come to your office and write your program for you.


    In the slot keep a count of the number of times the timer has elapsed, or use QTime::elapsed(), and:
    • every time the timer elapses do task 3,
    • every 5th time also do task 1,
    • every 6th time also do task 2,
    • every 10th time also do task 4,
    • every 30th time also do task 5,
    • every 50th time also do task 6.

    No. I will not write the code for this. I don't think you understand how the naïve version I gave you works, and this requires more understanding.
    Ho ho what do you mean by this "Are you actually understanding anything or just hoping for a cut'n'paste magic bullet? Please understand that we are not going to come to your office and write your program for you."

    As i am beginner i am asking for clarification of each, each time you people gave a suggestion i am learning a new thing. that's the reason i am asking for examples.
    anyway thanks for nice understanding. Thanks To FORUM.

    Quote Originally Posted by wysota View Post
    Start one timer with 100ms interval and call appropriate functions from the timer's timeout slot. Calculate time using QTime::elapsed() rathar than counting how many times the timeout slot was called.
    Hi Wysota,

    Thanks a lot Sir, i have got so much of information & knowledge from your posts not only in this thread even the other threads i have seen your posts. They were good and helpful for beginners like me. Thanks a lot.

  8. #47
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Multiple timers in single Application

    Quote Originally Posted by mahi6a1985 View Post
    Ho ho what do you mean by this "Are you actually understanding anything or just hoping for a cut'n'paste magic bullet? Please understand that we are not going to come to your office and write your program for you."

    As i am beginner i am asking for clarification of each, each time you people gave a suggestion i am learning a new thing. that's the reason i am asking for examples.
    anyway thanks for nice understanding.
    Chris means that you have been given answer to your question many times in this thread now and you were ignoring it and asking the question again and again. The fact that you are a beginner is not something that should make us go easier on you -- it should make you go harder on yourself. You should be writing your own examples as much as possible, otherwise you will always be a beginner. We will happily correct your code but you need to do your own coding.



    Thanks a lot Sir, i have got so much of information & knowledge from your posts not only in this thread even the other threads i have seen your posts. They were good and helpful for beginners like me. Thanks a lot.
    Unfortunately buttering me up won't help here. I second every word Chris said in his post.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. #48
    Join Date
    Sep 2012
    Posts
    32
    Thanks
    18
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Multiple timers in single Application

    Quote Originally Posted by wysota View Post
    Chris means that you have been given answer to your question many times in this thread now and you were ignoring it and asking the question again and again. The fact that you are a beginner is not something that should make us go easier on you -- it should make you go harder on yourself. You should be writing your own examples as much as possible, otherwise you will always be a beginner. We will happily correct your code but you need to do your own coding.




    Unfortunately buttering me up won't help here. I second every word Chris said in his post.
    lol buttering for what. Anyway still i wanna thank you for the support. Because of you i came to know what exactly the problem in my application. So hope i can solve it by myself.

    Thanks a lot to one and all and forum. Finally got it what the problem is so will try myself.

Similar Threads

  1. Single Application Instance
    By BadKnees in forum Qt Programming
    Replies: 8
    Last Post: 4th November 2014, 15:57
  2. Multiple project files in a single directory
    By jogeshwarakundi in forum Qt for Embedded and Mobile
    Replies: 5
    Last Post: 17th July 2008, 08:03
  3. Single QGLContext across multiple QGLWidgets
    By pseudosig in forum Qt Programming
    Replies: 2
    Last Post: 23rd June 2008, 00:13
  4. Single slot for multiple list boxes
    By Sheetal in forum Qt Programming
    Replies: 1
    Last Post: 15th April 2008, 07:53
  5. KDE/QWT doubt on debian sarge
    By hildebrand in forum KDE Forum
    Replies: 13
    Last Post: 25th April 2007, 07:13

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.