Results 1 to 3 of 3

Thread: detecting "user idleness"

  1. #1
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default detecting "user idleness"

    I want to detect if the user of my program has been idle the last X seconds (like a screensaver has to).

    Is there anything in Qt that already does something like that?
    (I have a working prototype that uses a QTimer and overrides QApplication::notify() to detect "user input events". But I would prefer to use an existing solution that is part of Qt.)

    Which leads to a second question: is there some function that classifies a QEvent as "user input" or do I have to check against KeyPress, KeyRelease etc (which means the code will break if a new input event type is introduced)?

    Best regards and thanks for thinking about my question.

  2. #2
    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: detecting "user idleness"

    I think it would be easiest to use a native system call to get such information. XScreenSaverQueryInfo() will do the trick on X11.
    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. The following user says thank you to wysota for this useful post:

    caduel (12th November 2009)

  4. #3
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: detecting "user idleness"

    On Windows, try GetLastInputInfo API function.

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

    caduel (12th November 2009)

Tags for this Thread

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.