Results 1 to 4 of 4

Thread: Mouse detection

  1. #1
    Join Date
    Feb 2007
    Posts
    16
    Thanks
    8
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question Mouse detection

    Hi,

    How can I detect if my mouse is moving? My applications has only a System Tray icon.

    The thing is I want to know if the user is really using the PC, so I can calculate how much time this user actually worked on this machine. So I need to detect mouse or keyboard events (any event) to make sure the PC is really in use.
    Last edited by eu.x; 25th April 2007 at 22:16.

  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: Mouse detection

    I don't think Qt can help you with that much. I think all you can do is to query the mouse for position using QCursor::pos() every second or so and based on that decide if the mouse is active or not. Just be aware that you'll increase the system load this way.

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

    eu.x (26th April 2007)

  4. #3
    Join Date
    Feb 2007
    Posts
    16
    Thanks
    8
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question Re: Mouse detection

    Cool!

    How about keyboard detection?

  5. #4
    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: Mouse detection

    With plain Qt you can forget about that. You'd have to dive into platform dependent solutions.

Similar Threads

  1. Game mouse movement
    By chaosgeorge in forum Qt Programming
    Replies: 1
    Last Post: 3rd December 2006, 00:41
  2. mouse moving don't produce mouse events
    By coralbird in forum Qt Programming
    Replies: 1
    Last Post: 13th September 2006, 07:13
  3. Replies: 2
    Last Post: 24th July 2006, 19:36
  4. QStackerWidget and mouse events
    By high_flyer in forum Qt Programming
    Replies: 3
    Last Post: 25th April 2006, 20:25
  5. setCanvas blocks mouse movement on QtCanvasView
    By YuriyRusinov in forum Qt Programming
    Replies: 8
    Last Post: 20th April 2006, 08:38

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.