Results 1 to 2 of 2

Thread: QAction shortcut / QShortcut conflict with other widget

  1. #1
    Join Date
    May 2013
    Posts
    321
    Thanks
    9
    Thanked 8 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default QAction shortcut / QShortcut conflict with other widget

    Hi all,
    I have multiple QAction added in menuBar() of QMainWindow with shortcut set on them using setShortcut.
    I have some QShortcut when the action is not in a menu.
    All works fine but that cause conflict on one widget I have in a dock of QMainWindow.
    When I use the delete key, the QAction where delete shortcut is used is actionned and not the keyPress.
    Is it possible to set the priority of keyPress on the focus widget and only if the key is not used use the shortcut ?
    I tried to disable the QAction but that disable the menu, only the shortcut has to be bypass.
    Is it possible to know if a key is used in keyPress to bypass propagation in eventfilter ?
    How do it if possible ?
    Thanks for the help
    Last edited by Alundra; 26th January 2015 at 21:43.

  2. #2
    Join Date
    May 2013
    Posts
    321
    Thanks
    9
    Thanked 8 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QAction shortcut / QShortcut conflict with other widget

    I have tried :
    Qt Code:
    1. virtual bool event( QEvent* event )
    2. {
    3. if( QListView::event( event ) )
    4. {
    5. event->accept();
    6. return true;
    7. }
    8. return false;
    9. }
    To copy to clipboard, switch view to plain text mode 
    That works but the problem is if a key is not handled by the widget that block the action, only the key handled by the widget should block propagation.
    I don't find any way of doing that in Qt, a miss in the API ?

Similar Threads

  1. QAction shortcut and text alignment
    By NIteLordz in forum Qt Programming
    Replies: 0
    Last Post: 18th January 2015, 02:47
  2. QAction with Escape shortcut (Qt::Key_Escape)
    By serget in forum Qt Programming
    Replies: 2
    Last Post: 21st January 2012, 16:34
  3. Replies: 3
    Last Post: 5th July 2011, 17:31
  4. checkable QAction shortcut hold
    By winder in forum Qt Programming
    Replies: 7
    Last Post: 18th February 2010, 15:48
  5. QAction shortcut
    By ^NyAw^ in forum Qt Programming
    Replies: 1
    Last Post: 3rd December 2009, 20:35

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
  •  
Qt is a trademark of The Qt Company.