diff --git a/src/lib/tools/tabstackedwidget.cpp b/src/lib/tools/tabstackedwidget.cpp index 404491bd8..32c034386 100644 --- a/src/lib/tools/tabstackedwidget.cpp +++ b/src/lib/tools/tabstackedwidget.cpp @@ -80,11 +80,6 @@ void TabStackedWidget::setTabBar(ComboTabBar* tb) setUpLayout(); } -bool TabStackedWidget::isValid(int index) -{ - return (index < m_stack->count() && index >= 0); -} - void TabStackedWidget::tabWasRemoved(int index) { m_tabBar->removeTab(index); @@ -168,7 +163,7 @@ void TabStackedWidget::keyPressEvent(QKeyEvent* event) void TabStackedWidget::showTab(int index) { - if (isValid(index)) { + if (validIndex(index)) { m_stack->setCurrentIndex(index); } @@ -301,3 +296,8 @@ int TabStackedWidget::count() const { return m_tabBar->count(); } + +bool TabStackedWidget::validIndex(int index) const +{ + return (index < m_stack->count() && index >= 0); +} diff --git a/src/lib/tools/tabstackedwidget.h b/src/lib/tools/tabstackedwidget.h index 37777b1dd..16d5e728d 100644 --- a/src/lib/tools/tabstackedwidget.h +++ b/src/lib/tools/tabstackedwidget.h @@ -38,8 +38,6 @@ public: ComboTabBar* tabBar(); void setTabBar(ComboTabBar* tb); - bool isValid(int index); - bool documentMode() const; void setDocumentMode(bool enabled); @@ -64,16 +62,14 @@ public: int indexOf(QWidget* widget) const; int count() const; +signals: + void currentChanged(int index); + void tabCloseRequested(int index); + public slots: void setCurrentIndex(int index); void setCurrentWidget(QWidget* widget); -private: - QStackedWidget* m_stack; - ComboTabBar* m_tabBar; - QVBoxLayout* m_mainLayout; - bool m_dirtyTabBar; - private slots: void tabWasRemoved(int index); void showTab(int index); @@ -83,9 +79,13 @@ protected: bool eventFilter(QObject* obj, QEvent* event); void keyPressEvent(QKeyEvent* event); -signals: - void currentChanged(int index); - void tabCloseRequested(int index); +private: + bool validIndex(int index) const; + + QStackedWidget* m_stack; + ComboTabBar* m_tabBar; + QVBoxLayout* m_mainLayout; + bool m_dirtyTabBar; }; #endif // TABSTACKEDWIDGET_H