From 15db5dcc124e7a2ed38c35293a4c6c3c1e166ce9 Mon Sep 17 00:00:00 2001
From: Marco Biasini <marco.biasini@unibas.ch>
Date: Tue, 8 Feb 2011 12:21:20 +0100
Subject: [PATCH] fix crash in sequence viewer for MacOS X and Qt versions>=4.6

---
 .../src/sequence_viewer/sequence_table_view.cc | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/modules/gui/src/sequence_viewer/sequence_table_view.cc b/modules/gui/src/sequence_viewer/sequence_table_view.cc
index a4998dcf3..199ee8c4a 100644
--- a/modules/gui/src/sequence_viewer/sequence_table_view.cc
+++ b/modules/gui/src/sequence_viewer/sequence_table_view.cc
@@ -227,19 +227,21 @@ QModelIndex SequenceTableView::moveCursor(CursorAction action, Qt::KeyboardModif
 {
   QModelIndex current = QTableView::moveCursor(action, modifiers);
 
-  if(action == MoveLeft && current.column()>0
-     && this->visualRect(current).topLeft().x() < static_column_->columnWidth(0) ){
-   const int new_value = horizontalScrollBar()->value() + this->visualRect(current).topLeft().x() - static_column_->columnWidth(0);
+#if !(defined(__APPLE__) && (QT_VERSION>=0x040600))
+  if (action == MoveLeft && current.column()>0
+     && this->visualRect(current).topLeft().x() < static_column_->columnWidth(0)){
+  int new_value = horizontalScrollBar()->value() + this->visualRect(current).topLeft().x();
+   new_value-=static_column_->columnWidth(0);
+
    horizontalScrollBar()->setValue(new_value);
   }
 
-
-  if(action == MoveUp && current.row()>0
-     && this->visualRect(current).bottomLeft().y() < static_row_->rowHeight(0) ){
-   const int new_value = verticalScrollBar()->value() + this->visualRect(current).bottomRight().y() - static_row_->rowHeight(0);
+  if (action == MoveUp && current.row()>0 && this->visualRect(current).bottomLeft().y() < static_row_->rowHeight(0)){
+    int new_value = verticalScrollBar()->value() + this->visualRect(current).bottomRight().y();
+    new_value-=static_row_->rowHeight(0);   
    verticalScrollBar()->setValue(new_value);
   }
-
+#endif
   return current;
 }
 
-- 
GitLab