PDA

View Full Version : QAction shortcut / QShortcut conflict with other widget



Alundra
26th January 2015, 20:01
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

Alundra
27th January 2015, 03:09
I have tried :


virtual bool event( QEvent* event )
{
if( QListView::event( event ) )
{
event->accept();
return true;
}
return false;
}

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 ?