Skip to content

Commit

Permalink
Followup canvas focus commit
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Aug 21, 2017
1 parent a6b0c44 commit a2c9710
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/app/qgisapp.cpp
Expand Up @@ -1234,7 +1234,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
}
#endif

connect( qApp, SIGNAL( focusChanged( QWidget*, QWidget* ) ), this, SLOT( onFocusChanged( QWidget*, QWidget* ) ) );
connect( qApp, &QApplication::focusChanged, this, &QgisApp::onFocusChanged );
} // QgisApp ctor

QgisApp::QgisApp()
Expand Down Expand Up @@ -8792,10 +8792,11 @@ void QgisApp::userRotation()
mMapCanvas->refresh();
}

void QgisApp::onFocusChanged( QWidget* /*old*/, QWidget* now )
void QgisApp::onFocusChanged( QWidget *oldWidget, QWidget *newWidget )
{
// If nothing has focus even though the window is active, ensure map canvas receives it
if ( !now && isActiveWindow() )
Q_UNUSED( oldWidget );
// If nothing has focus even though this window is active, ensure map canvas receives it
if ( !newWidget && isActiveWindow() )
{
mapCanvas()->setFocus();
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgisapp.h
Expand Up @@ -1510,7 +1510,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow

void updateCrsStatusBar();

void onFocusChanged( QWidget* old, QWidget* now );
void onFocusChanged( QWidget *oldWidget, QWidget *newWidget );

signals:

Expand Down

0 comments on commit a2c9710

Please sign in to comment.