1
mirror of https://invent.kde.org/network/falkon.git synced 2024-09-21 17:52:10 +02:00

[CodingStyle] TabStackedWidget::isValid should be private

And also choose better name - validIndex
This commit is contained in:
nowrep 2014-01-29 21:15:04 +01:00
parent 1d1451aee4
commit 08929228bd
2 changed files with 17 additions and 17 deletions

View File

@ -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);
}

View File

@ -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