Commit 0742932d authored by dt's avatar dt
Browse files

Add currentIndex API to DoubleTabWidget

Reviewed-By: con
parent a3f827b1
......@@ -71,6 +71,21 @@ DoubleTabWidget::~DoubleTabWidget()
delete ui;
}
int DoubleTabWidget::currentIndex() const
{
return m_currentIndex;
}
void DoubleTabWidget::setCurrentIndex(int index)
{
Q_ASSERT(index < m_tabs.size());
if (index == m_currentIndex)
return;
m_currentIndex = index;
emit currentIndexChanged(m_currentIndex, m_tabs.at(m_currentIndex).currentSubTab);
update();
}
void DoubleTabWidget::setTitle(const QString &title)
{
m_title = title;
......
......@@ -12,7 +12,8 @@ namespace Ui {
class DoubleTabWidget;
}
class DoubleTabWidget : public QWidget {
class DoubleTabWidget : public QWidget
{
Q_OBJECT
public:
DoubleTabWidget(QWidget *parent = 0);
......@@ -26,6 +27,9 @@ public:
void removeTab(int index);
int tabCount() const;
int currentIndex() const;
void setCurrentIndex(int index);
signals:
void currentIndexChanged(int index, int subIndex);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment