mirror of
https://github.com/LMMS/lmms.git
synced 2026-04-01 21:04:18 -04:00
Merge pull request #1406 from csimons/unbind-keys
Removing focus from child windows upon hiding them.
This commit is contained in:
@@ -879,6 +879,7 @@ void MainWindow::toggleWindow( QWidget *window, bool forceShow )
|
||||
else
|
||||
{
|
||||
parent->hide();
|
||||
refocus();
|
||||
}
|
||||
|
||||
// Workaround for Qt Bug #260116
|
||||
@@ -891,6 +892,38 @@ void MainWindow::toggleWindow( QWidget *window, bool forceShow )
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* When an editor window with focus is toggled off, attempt to set focus
|
||||
* to the next visible editor window, or if none are visible, set focus
|
||||
* to the parent window.
|
||||
*/
|
||||
void MainWindow::refocus()
|
||||
{
|
||||
QList<QWidget*> editors;
|
||||
editors
|
||||
<< Engine::songEditor()->parentWidget()
|
||||
<< Engine::getBBEditor()->parentWidget()
|
||||
<< Engine::pianoRoll()->parentWidget()
|
||||
<< Engine::automationEditor()->parentWidget();
|
||||
|
||||
bool found = false;
|
||||
QList<QWidget*>::Iterator editor;
|
||||
for( editor = editors.begin(); editor != editors.end(); ++editor )
|
||||
{
|
||||
if( ! (*editor)->isHidden() ) {
|
||||
(*editor)->setFocus();
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( ! found )
|
||||
this->setFocus();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void MainWindow::toggleBBEditorWin( bool forceShow )
|
||||
{
|
||||
toggleWindow( Engine::getBBEditor(), forceShow );
|
||||
|
||||
Reference in New Issue
Block a user