Results 1 to 3 of 3

Thread: Print screen key in Qt windows

  1. #1
    Join Date
    Apr 2010
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Print screen key in Qt windows

    Hi ,
    I am using Qt 4.5.0 in MSVisual Studio 2005.I need a scancode for all the keyboard keys and I used the following Qt events in my application to collect the scancodes for all the keys.
    code A:
    bool event(QEvent *event)// event handler
    {
    QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
    codevalue = keyEvent->nativeScanCode();
    qDebug()<<"The scancode is "<<codevalue<<endl; //to print the scancode to the console.
    }

    Code B:
    void keyPressEvent(QKeyEvent * keyEvent)
    {
    codevalue = keyEvent->nativeScanCode();
    qDebug()<<"scancode is "<<codevalue<<endl;
    }

    In windows,using these functions I got the scancodes for all the keys except PrintScreen key. Please help me how do I get the Scancode for PrintScreen key in Windows.

    Note:: In linux PrintScreen key has scancode integer value of 111.

    Thanks in advance,
    Hanumanth..
    Last edited by hanumanth; 9th April 2010 at 05:43. Reason: reformatted to look better

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Print screen key in Qt windows

    Check for Qt::Key_Print. Maybe the key event is catched by the os.

  3. #3
    Join Date
    Apr 2010
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Print screen key in Qt windows

    Thanks for the reply.. I tried that but it is not captured. I used eventFilter, accept(),grabKeyboard(),setFocus(),Key_Print to capture the Printscreen event, but none of them worked.

    Please let me know if there is any special way of handling this Print screen key in Qt. Or Should I use X11 calls to suppress the PrintScreen key in SUSE.

    Thanks,
    Hanumanth..

Similar Threads

  1. Creating a Screen Saver for Windows
    By spud in forum Qt Programming
    Replies: 1
    Last Post: 2nd November 2011, 15:58
  2. QT4 and Vista/Windows 7 High Screen DPI
    By ChrisW67 in forum Qt Programming
    Replies: 2
    Last Post: 9th April 2010, 07:43
  3. Replies: 1
    Last Post: 9th November 2009, 09:27
  4. Cancelling Long-running Print/Print Preview
    By ChrisW67 in forum Newbie
    Replies: 4
    Last Post: 16th June 2009, 23:05
  5. Print PDF under Windows
    By giusepped in forum Qt Programming
    Replies: 4
    Last Post: 9th January 2009, 00:35

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.