summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libopie/otabwidget.cpp22
-rw-r--r--libopie/otabwidget.h15
2 files changed, 37 insertions, 0 deletions
diff --git a/libopie/otabwidget.cpp b/libopie/otabwidget.cpp
index aaf14ce..bed7ef1 100644
--- a/libopie/otabwidget.cpp
+++ b/libopie/otabwidget.cpp
@@ -201,6 +201,19 @@ void OTabWidget::setCurrentTab( const QString &tabname )
}
}
+void OTabWidget::setCurrentTab(int tabindex) {
+ OTabInfo *newtab = tabs.first();
+ while ( newtab && newtab->id() != tabindex )
+ {
+ newtab = tabs.next();
+ }
+ if ( newtab && newtab->id() == tabindex )
+ {
+ selectTab( newtab );
+ }
+}
+
+
OTabWidget::TabStyle OTabWidget::tabStyle() const
{
return tabBarStyle;
@@ -305,3 +318,12 @@ void OTabWidget::resizeEvent( QResizeEvent * )
{
setUpLayout();
}
+
+int OTabWidget::getCurrentTab() {
+ if ( currentTab )
+ {
+ return currentTab->id();
+ }
+ return -1;
+}
+
diff --git a/libopie/otabwidget.h b/libopie/otabwidget.h
index d61fe9e..74d683b 100644
--- a/libopie/otabwidget.h
+++ b/libopie/otabwidget.h
@@ -170,11 +170,25 @@ public:
void setCurrentTab( const QString & );
/**
+ * @fn setCurrentTab( int )
+ * @brief Selects and brings to top the desired widget, by using id.
+ *
+ * @param tab id for widget to select.
+ */
+ void setCurrentTab(int);
+
+/**
* @fn sizeHint()
* @brief Reimplemented for internal purposes.
*/
QSize sizeHint() const;
+/**
+ * @fn getCurrentTab( )
+ * @brief returns current tab id.
+ */
+ int getCurrentTab();
+
protected:
@@ -219,6 +233,7 @@ private:
*/
void setUpLayout();
+
signals:
/**
* @fn currentChanegd( QWidget *widget )