Results 1 to 2 of 2

Thread: shortcut with more than one key

  1. #1
    Join Date
    Jan 2007
    Posts
    26
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default shortcut with more than one key

    I am trying to create a shortcut that uses a multi-key combination for a widget.

    This works:
    Qt Code:
    1. (void) new QShortcut(Qt::Key_F5, this, SLOT(refresh())); // refresh
    To copy to clipboard, switch view to plain text mode 

    This doesnt:
    Qt Code:
    1. (void) new QShortcut(Qt::Key_Shift + Qt::Key_C, this, SLOT(clear())); // clear
    To copy to clipboard, switch view to plain text mode 
    I also tried this, but it does not work either.
    Qt Code:
    1. (void) new QShortcut(QKeySequence(Qt::Key_Shift + Qt::Key_C), this, SLOT(clear())); // clear
    To copy to clipboard, switch view to plain text mode 

    Do i need to override keyPressEvent or is QShortcut capable of handling Shift+C some other way?

    Thanks in advance.

  2. #2
    Join Date
    Jan 2007
    Posts
    26
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: shortcut with more than one key

    i just realized that I should be using Qt::SHIFT instead of Qt::Key_Shift.

    This is somewhat confusing. What is the difference between the two?

Similar Threads

  1. Trying to set shortcut
    By mikro in forum Newbie
    Replies: 2
    Last Post: 30th November 2006, 10:55
  2. QIde, a new IDE for Qt4
    By jlbrd in forum Qt-based Software
    Replies: 114
    Last Post: 4th October 2006, 22:12

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.