Results 1 to 3 of 3

Thread: check the time of last time keyboard is pressed

  1. #1
    Join Date
    Jan 2008
    Location
    India
    Posts
    4
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default check the time of last time keyboard is pressed

    Dear Friends;
    Is there is any idea to check that when was last time keyboard is pressed.

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: check the time of last time keyboard is pressed

    First of all please stop posting non-Qt related questions in the Qt Programming section.
    As for your question, take a look at the Win API function GetLastInputInfo.
    There is a C# example here: http://www.codeproject.com/KB/cs/GetIdleTimeWithCS.aspx.
    It is very easy to see how that API should be used.

  3. #3
    Join Date
    Aug 2007
    Location
    Gorakhpur, India
    Posts
    254
    Thanks
    8
    Thanked 14 Times in 14 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: check the time of last time keyboard is pressed

    You can store the value of current system Date/Time using with QDateTime QDateTime::currentDateTime () in the KeyPressEvent of any widget;
    Define a
    Qt Code:
    1. QDateTime latestTime();
    To copy to clipboard, switch view to plain text mode 
    object in your header file and then in the KeyPressEvent of your Widget.
    Qt Code:
    1. void keyPressEvent(QKeyEvent *event)
    2. {
    3. latestTime=currentDateTime ();
    4. }
    To copy to clipboard, switch view to plain text mode 
    it may helps!
    Anurag Shukla
    A man who never makes mistake is the man who never does anything! Theodre Rosvelt!

  4. The following user says thank you to ashukla for this useful post:

    Aki Tomar (5th February 2008)

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.