Discussion Board

Results 1 to 9 of 9
  1. #1
    Regular Contributor adhavanj's Avatar
    Join Date
    Aug 2010
    Location
    chennai India
    Posts
    62
    hi all i want to close my application automatically, when the system time reaches the user given time.
    any ideas???
    Thank you all in advance
    CHANGE is the only constant thing in this world.

  2. #2
    Registered User boddison's Avatar
    Join Date
    Jul 2009
    Location
    Manchester, UK
    Posts
    35
    Create a QTimer object that emits a timeout() signal every few seconds.
    Connect the signal to a slot that checks if the required time has elapsed and, if it has, call this->close()

  3. #3
    Nokia Developer Champion danhicksbyron's Avatar
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209
    Why not just compute the time to the given time and set that for the timer interval?

  4. #4
    Registered User boddison's Avatar
    Join Date
    Jul 2009
    Location
    Manchester, UK
    Posts
    35
    Quote Originally Posted by danhicksbyron View Post
    Why not just compute the time to the given time and set that for the timer interval?
    As it is a user supplied time it may change after the timer is set.
    Checking periodically saves having to cancel and restart the timer if the user changes the value.

  5. #5
    Nokia Developer Champion danhicksbyron's Avatar
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209
    If the user time changes you simply reset the timer. You probably need to be able to cancel it anyway, if some user activity interrupts things.

    Polling is evil on a phone (or on any device, actually).

  6. #6
    Registered User boddison's Avatar
    Join Date
    Jul 2009
    Location
    Manchester, UK
    Posts
    35
    Quote Originally Posted by danhicksbyron View Post
    Polling is evil on a phone (or on any device, actually).
    Clearly Nokia don't think it is that bad or they wouldn't have provided the QTimer class with a polling function!
    But yes, on second thoughts it is probably better to set the timer for the time the application needs to close......

  7. #7
    Nokia Developer Champion danhicksbyron's Avatar
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209
    Any tool can be abused.

  8. #8
    Regular Contributor adhavanj's Avatar
    Join Date
    Aug 2010
    Location
    chennai India
    Posts
    62
    Thank buddy.... i got it
    CHANGE is the only constant thing in this world.

  9. #9
    Nokia Developer Moderator divanov's Avatar
    Join Date
    Oct 2009
    Posts
    4,326
    Quote Originally Posted by boddison View Post
    Clearly Nokia don't think it is that bad or they wouldn't have provided the QTimer class with a polling function!
    Please note, that Qt is cross-platform framework, which is available on dozen architectures and only some of them are mobile platforms.

Similar Threads

  1. Close Another application
    By Talib7 in forum Python
    Replies: 9
    Last Post: 2010-04-05, 12:46
  2. how to close application by close buttons in n900
    By babulamiet in forum Nokia N9
    Replies: 2
    Last Post: 2010-03-15, 09:08
  3. Replies: 35
    Last Post: 2010-02-26, 14:49
  4. close my application after uninstallation?
    By mismael in forum Nokia N9
    Replies: 1
    Last Post: 2010-02-24, 13:08
  5. How to close an application from Widget
    By soumyso in forum Symbian Web Runtime
    Replies: 6
    Last Post: 2009-11-13, 14:50

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved