Results 1 to 3 of 3

Thread: keyevent

  1. #1
    Join Date
    Sep 2009
    Location
    Warsaw/Poland
    Posts
    56
    Thanks
    8
    Thanked 4 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: keyevent

    How can I catch Ctrl+Shift+TAB ?

    Qt Code:
    1. if (k->key() == Qt::Key_Tab)
    2. {
    3. if (k->modifiers() == Qt::ControlModifier)
    4. {
    To copy to clipboard, switch view to plain text mode 

    This is for Ctrl+Tab, but how can I catch Ctrl+Shift+Tab ?


    Added after 40 minutes:


    OK, I found solution:

    Qt Code:
    1. if ((k->key() == Qt::Key_Backtab) && (k->modifiers() == (Qt::ControlModifier | Qt::ShiftModifier)))
    To copy to clipboard, switch view to plain text mode 
    Last edited by mero; 12th June 2011 at 02:47.

  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: keyevent

    This would be better:

    Qt Code:
    1. if ((k->key() == Qt::Key_Backtab) && (k->modifiers() & (Qt::ControlModifier | Qt::ShiftModifier)))
    To copy to clipboard, switch view to plain text mode 
    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:

    mero (22nd July 2012)

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

    Default Re: keyevent

    Qt Code:
    1. (k->modifiers() & (Qt::ControlModifier | Qt::ShiftModifier) == (Qt::ControlModifier | Qt::ShiftModifier)
    To copy to clipboard, switch view to plain text mode 
    or
    Qt Code:
    1. (k->modifiers() & Qt::ControlModifier) && (k-<modifiers() & Qt::ShiftModifier)
    To copy to clipboard, switch view to plain text mode 

    would be best

Similar Threads

  1. Replies: 6
    Last Post: 10th August 2009, 04:12
  2. keyevent/zoom
    By bhogasena in forum Qt Programming
    Replies: 7
    Last Post: 23rd January 2009, 14:28
  3. KeyEvent to go to a parent/grandparent widget?
    By thomaspu in forum Qt Programming
    Replies: 2
    Last Post: 29th December 2007, 03:07
  4. KeyEvent propagation to Desktop
    By ^NyAw^ in forum Qt Programming
    Replies: 3
    Last Post: 27th November 2007, 12: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.