From faf4fabe9f13ababa7bd860b1c6d12012e54beb5 Mon Sep 17 00:00:00 2001
From: stefan <stefan@5a81b35b-ba03-0410-adc8-b2c5c5119f08>
Date: Wed, 14 Apr 2010 12:52:13 +0000
Subject: [PATCH] Fixes: BZDNG-98 (double click on entity/mapiso and so in in
 scene menu should not start editing)

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@1998 5a81b35b-ba03-0410-adc8-b2c5c5119f08
---
 modules/gui/src/scene_win/scene_win.cc | 6 ++++++
 modules/gui/src/scene_win/scene_win.hh | 1 +
 2 files changed, 7 insertions(+)

diff --git a/modules/gui/src/scene_win/scene_win.cc b/modules/gui/src/scene_win/scene_win.cc
index 1a8f5c68e..c97253b34 100644
--- a/modules/gui/src/scene_win/scene_win.cc
+++ b/modules/gui/src/scene_win/scene_win.cc
@@ -57,6 +57,7 @@ SceneWin::SceneWin(QWidget* parent) :
   view_->setModel(model_);
   view_->setSelectionBehavior(QAbstractItemView::SelectRows);
   view_->setSelectionMode(QAbstractItemView::ExtendedSelection);
+  view_->setEditTriggers(QAbstractItemView::EditKeyPressed);
   view_->expandAll();
 
   layout->addWidget(view_);
@@ -67,6 +68,8 @@ SceneWin::SceneWin(QWidget* parent) :
               const QItemSelection&)));
   connect(view_, SIGNAL(customContextMenuRequested(const QPoint&)), this,
       SLOT(ContextMenuRequested(const QPoint&)));
+  connect(view_, SIGNAL(doubleClicked(const QModelIndex &)), this,
+	  SLOT(DoubleClicked(const QModelIndex &)));
   connect(model_, SIGNAL(rowsInserted(const QModelIndex&, int, int)), this, SLOT(RowsInserted(const QModelIndex&, int, int)));
 }
 
@@ -108,6 +111,9 @@ void SceneWin::RowsInserted(const QModelIndex & parent, int start, int end){
   }
 }
 
+void SceneWin::DoubleClicked(const QModelIndex & index){
+  SceneSelection::Instance()->CenterOnObjects();
+}
 
 void SceneWin::AddView(gfx::EntityP entity, mol::EntityView view){
 
diff --git a/modules/gui/src/scene_win/scene_win.hh b/modules/gui/src/scene_win/scene_win.hh
index 0cdf11540..05706c5b6 100644
--- a/modules/gui/src/scene_win/scene_win.hh
+++ b/modules/gui/src/scene_win/scene_win.hh
@@ -66,6 +66,7 @@ public slots:
 
 private slots:
   void RowsInserted(const QModelIndex & parent, int start, int end);
+  void DoubleClicked(const QModelIndex & index);
 
 private:
   SceneWinModel* model_;
-- 
GitLab