Skip to content
Permalink
Browse files

Merge pull request #5054 from nyalldawson/canvas_select

Ensure canvas has focus if nothing else has
  • Loading branch information
nyalldawson committed Aug 27, 2017
2 parents 37052db + a2c9710 commit d476abf5a7c6895086c3761b3277e056c49328a8
Showing with 13 additions and 0 deletions.
  1. +11 −0 src/app/qgisapp.cpp
  2. +2 −0 src/app/qgisapp.h
@@ -1234,6 +1234,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
}
#endif

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

QgisApp::QgisApp()
@@ -8791,6 +8792,16 @@ void QgisApp::userRotation()
mMapCanvas->refresh();
}

void QgisApp::onFocusChanged( QWidget *oldWidget, QWidget *newWidget )
{
Q_UNUSED( oldWidget );
// If nothing has focus even though this window is active, ensure map canvas receives it
if ( !newWidget && isActiveWindow() )
{
mapCanvas()->setFocus();
}
}

// toggle overview status
void QgisApp::isInOverview()
{
@@ -1510,6 +1510,8 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow

void updateCrsStatusBar();

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

signals:

/**

0 comments on commit d476abf

Please sign in to comment.
You can’t perform that action at this time.