[qet] [1912] Circumvented a display bug occuring when moving the current diagram from the elements panel . |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/qet Archives
]
Revision: 1912
Author: xavier
Date: 2012-07-15 15:01:04 +0200 (Sun, 15 Jul 2012)
Log Message:
-----------
Circumvented a display bug occuring when moving the current diagram from the elements panel.
Modified Paths:
--------------
trunk/sources/projectview.cpp
trunk/sources/qettabwidget.cpp
trunk/sources/qettabwidget.h
Modified: trunk/sources/projectview.cpp
===================================================================
--- trunk/sources/projectview.cpp 2012-07-14 17:02:51 UTC (rev 1911)
+++ trunk/sources/projectview.cpp 2012-07-15 13:01:04 UTC (rev 1912)
@@ -476,7 +476,7 @@
// le schema est le premier du projet
return;
}
- tabs_ -> tabBar() -> moveTab(diagram_view_position, diagram_view_position - 1);
+ tabs_ -> moveTab(diagram_view_position, diagram_view_position - 1);
}
/**
@@ -497,7 +497,7 @@
// le schema est le dernier du projet
return;
}
- tabs_ -> tabBar() -> moveTab(diagram_view_position, diagram_view_position + 1);
+ tabs_ -> moveTab(diagram_view_position, diagram_view_position + 1);
}
/**
Modified: trunk/sources/qettabwidget.cpp
===================================================================
--- trunk/sources/qettabwidget.cpp 2012-07-14 17:02:51 UTC (rev 1911)
+++ trunk/sources/qettabwidget.cpp 2012-07-15 13:01:04 UTC (rev 1912)
@@ -66,6 +66,20 @@
#endif
}
+/**
+ Move the tab from index \a from to index \a to.
+*/
+void QETTabWidget::moveTab(int from, int to) {
+ tab_bar_ -> moveTab(from, to);
+ // workaround to a weird bug when moving the current tab
+ if (count() > 1) {
+ int current_index = tab_bar_ -> currentIndex();
+ // switch to any other index then back to the current one
+ tab_bar_ -> setCurrentIndex(current_index ? 0 : 1);
+ tab_bar_ -> setCurrentIndex(current_index);
+ }
+}
+
QETTabBar *QETTabWidget::tabBar() const {
return(tab_bar_);
}
Modified: trunk/sources/qettabwidget.h
===================================================================
--- trunk/sources/qettabwidget.h 2012-07-14 17:02:51 UTC (rev 1911)
+++ trunk/sources/qettabwidget.h 2012-07-15 13:01:04 UTC (rev 1912)
@@ -40,6 +40,7 @@
public:
void setMovable(bool);
bool isMovable() const;
+ void moveTab(int, int);
QETTabBar *tabBar() const;
protected: