mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +02:00
Made the toggle menubar key shortcut work when the menubar is hidden.
This commit is contained in:
@@ -276,6 +276,11 @@ TomahawkWindow::setupToolBar()
|
|||||||
compactMenuButton->setMenu( m_compactMainMenu );
|
compactMenuButton->setMenu( m_compactMainMenu );
|
||||||
compactMenuButton->setToolButtonStyle( Qt::ToolButtonIconOnly );
|
compactMenuButton->setToolButtonStyle( Qt::ToolButtonIconOnly );
|
||||||
m_compactMenuAction = toolbar->addWidget( compactMenuButton );
|
m_compactMenuAction = toolbar->addWidget( compactMenuButton );
|
||||||
|
//HACK: adding the toggle action to the window, otherwise the shortcut keys
|
||||||
|
// won't be picked up when the menu is hidden.
|
||||||
|
// This must be done for all menu bar actions that have shortcut keys :(
|
||||||
|
// Does not apply to Mac which always shows the menu bar.
|
||||||
|
addAction( ActionCollection::instance()->getAction( "toggleMenuBar" ) );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -75,11 +75,13 @@ ActionCollection::initActions()
|
|||||||
m_actionCollection[ "copyPlaylist" ] = new QAction( tr( "&Copy Playlist Link" ), this );
|
m_actionCollection[ "copyPlaylist" ] = new QAction( tr( "&Copy Playlist Link" ), this );
|
||||||
m_actionCollection[ "playPause" ] = new QAction( tr( "&Play" ), this );
|
m_actionCollection[ "playPause" ] = new QAction( tr( "&Play" ), this );
|
||||||
m_actionCollection[ "playPause" ]->setShortcut( Qt::Key_Space );
|
m_actionCollection[ "playPause" ]->setShortcut( Qt::Key_Space );
|
||||||
|
m_actionCollection[ "playPause" ]->setShortcutContext( Qt::ApplicationShortcut );
|
||||||
m_actionCollection[ "stop" ] = new QAction( tr( "&Stop" ), this );
|
m_actionCollection[ "stop" ] = new QAction( tr( "&Stop" ), this );
|
||||||
m_actionCollection[ "previousTrack" ] = new QAction( tr( "&Previous Track" ), this );
|
m_actionCollection[ "previousTrack" ] = new QAction( tr( "&Previous Track" ), this );
|
||||||
m_actionCollection[ "nextTrack" ] = new QAction( tr( "&Next Track" ), this );
|
m_actionCollection[ "nextTrack" ] = new QAction( tr( "&Next Track" ), this );
|
||||||
m_actionCollection[ "quit" ] = new QAction( tr( "&Quit" ), this );
|
m_actionCollection[ "quit" ] = new QAction( tr( "&Quit" ), this );
|
||||||
m_actionCollection[ "quit" ]->setShortcut( QKeySequence::Quit );
|
m_actionCollection[ "quit" ]->setShortcut( QKeySequence::Quit );
|
||||||
|
m_actionCollection[ "quit" ]->setShortcutContext( Qt::ApplicationShortcut );
|
||||||
m_actionCollection[ "quit" ]->setMenuRole( QAction::QuitRole );
|
m_actionCollection[ "quit" ]->setMenuRole( QAction::QuitRole );
|
||||||
|
|
||||||
// connect actions to AudioEngine
|
// connect actions to AudioEngine
|
||||||
@@ -105,6 +107,7 @@ ActionCollection::initActions()
|
|||||||
#else
|
#else
|
||||||
m_actionCollection[ "toggleMenuBar" ] = new QAction( tr( "Hide Menu Bar" ), this );
|
m_actionCollection[ "toggleMenuBar" ] = new QAction( tr( "Hide Menu Bar" ), this );
|
||||||
m_actionCollection[ "toggleMenuBar" ]->setShortcut( QKeySequence( "Ctrl+M" ) );
|
m_actionCollection[ "toggleMenuBar" ]->setShortcut( QKeySequence( "Ctrl+M" ) );
|
||||||
|
m_actionCollection[ "toggleMenuBar" ]->setShortcutContext( Qt::ApplicationShortcut );
|
||||||
#endif
|
#endif
|
||||||
m_actionCollection[ "diagnostics" ] = new QAction( tr( "Diagnostics..." ), this );
|
m_actionCollection[ "diagnostics" ] = new QAction( tr( "Diagnostics..." ), this );
|
||||||
m_actionCollection[ "diagnostics" ]->setMenuRole( QAction::ApplicationSpecificRole );
|
m_actionCollection[ "diagnostics" ]->setMenuRole( QAction::ApplicationSpecificRole );
|
||||||
|
Reference in New Issue
Block a user