×

Discussion Board

Results 1 to 5 of 5

Thread: QTimer Example

  1. #1
    Registered User
    Join Date
    Feb 2010
    Posts
    46

    QTimer Example

    Hi,

    Can you please send me the simple Example to understand QTimer class and how we use it.

    Thanks in advance.

  2. #2
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: QTimer Example

    QTimer description contains pretty good explanation:
    http://doc.trolltech.com/4.6/qtimer.html#details

  3. #3
    Super Contributor
    Join Date
    Jul 2008
    Posts
    2,020

    Re: QTimer Example

    Hello,
    if you just want to use a form local timer, this approach could work better:

    Set up the timer as follows:
    Code:
    myTimerID=startTimer(75);
    Then, override this event handler:
    Code:
    void QtGameForm::timerEvent(QTimerEvent *event)
    {
    	if (event->timerId()==myTimerID)
    	{	
    MY CODE HERE
    	}
    }
    The lines above are the best I have to offer.If anyone of you is of more advanced knowledge, I ask for your patience and understanding! - unknown arab poet
    http://www.tamoggemon.com - Symbian blog - Windows Phone blog
    My other blogs:
    webOS blog iPhone blog BlackBerry blog Samsung bada blog Android blog

  4. #4
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: QTimer Example

    And use
    Code:
    killTimer(myTimerID)
    to stop timer. There is a complete example in documentation:
    http://doc.trolltech.com/4.6/qobject.html#startTimer

  5. #5
    Super Contributor
    Join Date
    Jul 2008
    Posts
    2,020

    Re: QTimer Example

    Hi Daniil,
    my bad - forgot to paste that in!

    Tam
    The lines above are the best I have to offer.If anyone of you is of more advanced knowledge, I ask for your patience and understanding! - unknown arab poet
    http://www.tamoggemon.com - Symbian blog - Windows Phone blog
    My other blogs:
    webOS blog iPhone blog BlackBerry blog Samsung bada blog Android blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×