Scope
3rd April 2016, 16:57
In menubar I have action "Show menu" which is checkable. For that action I have also shortcut and it works great only when menu is visible. When menubar is not visible then shortcut does not work.
How I can implement shortcuts which will work with not visible / hidden actions in menubar?
Thanks,
Added after 41 minutes:
Ok, I found solution - reimplement parent QWidget::keyPressEvent(QKeyEvent *event);
void MyWidget::keyPressEvent(QKeyEvent *event)
{
if( event->modifiers() == Qt::ControlModifier ) {
if( event->key() == Qt::Key_M )
// show my menubar
}
but now second question - is it the best solution for that purpose?
How I can implement shortcuts which will work with not visible / hidden actions in menubar?
Thanks,
Added after 41 minutes:
Ok, I found solution - reimplement parent QWidget::keyPressEvent(QKeyEvent *event);
void MyWidget::keyPressEvent(QKeyEvent *event)
{
if( event->modifiers() == Qt::ControlModifier ) {
if( event->key() == Qt::Key_M )
// show my menubar
}
but now second question - is it the best solution for that purpose?