From 80596c54bb97fa53efd81eac83de7c54c0b4e89b Mon Sep 17 00:00:00 2001
From: Julien Michel <julien.michel@orfeo-toolbox.org>
Date: Mon, 25 Feb 2013 15:03:50 +0100
Subject: [PATCH] BUG: Fixing #633 and #639 - Set the right focus policy for
 GlImageWidget, and remove keyboard grab in main application

---
 Code/Application/mvdMainWindow.cxx | 3 ---
 Code/Common/mvdGLImageWidget.cxx   | 8 ++++++++
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/Code/Application/mvdMainWindow.cxx b/Code/Application/mvdMainWindow.cxx
index cbae7238c1..90ec0767f6 100644
--- a/Code/Application/mvdMainWindow.cxx
+++ b/Code/Application/mvdMainWindow.cxx
@@ -96,9 +96,6 @@ MainWindow
     )
   );
 
-  // grab the keyboard notifications in this widget
-  centralWidget()->grabKeyboard();
-
   // instanciate the Ql manipulator here to be able to connect
   // its signals to the centralWidget manipulator slots
   m_QLViewManipulator = new QuicklookViewManipulator();
diff --git a/Code/Common/mvdGLImageWidget.cxx b/Code/Common/mvdGLImageWidget.cxx
index 5ea25d03de..c465e83d74 100644
--- a/Code/Common/mvdGLImageWidget.cxx
+++ b/Code/Common/mvdGLImageWidget.cxx
@@ -61,6 +61,8 @@ GLImageWidget
   m_ImageModelRenderer( NULL ),
   m_ImageModel( NULL )
 {
+  // Set focus policy so that the widget gets the focus if it is clicked
+  setFocusPolicy(Qt::StrongFocus);
   Initialize(manipulator, renderer);
 }
 
@@ -77,6 +79,9 @@ GLImageWidget
   m_ImageModelRenderer( NULL ),
   m_ImageModel( NULL )
 {
+  // Set focus policy so that the widget gets the focus if it is clicked
+  setFocusPolicy(Qt::StrongFocus);
+
   Initialize(manipulator, renderer);
 }
 
@@ -93,6 +98,9 @@ GLImageWidget
   m_ImageModelRenderer( NULL ),
   m_ImageModel( NULL )
 {
+  // Set focus policy so that the widget gets the focus if it is clicked
+  setFocusPolicy(Qt::StrongFocus);
+
   Initialize(manipulator, renderer);
 }
 
-- 
GitLab