-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoverviewpanel.cpp
More file actions
30 lines (24 loc) · 893 Bytes
/
Copy pathoverviewpanel.cpp
File metadata and controls
30 lines (24 loc) · 893 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <QTabBar>
#include <QStackedWidget>
#include <QBoxLayout>
#include "overviewpanel.h"
OverviewPanel::OverviewPanel(QWidget *compilationUnits, QWidget *headers)
{
QTabBar *tabBar = new QTabBar(this);
tabBar->addTab("Compilation Units");
tabBar->addTab("Headers");
QBoxLayout *layoutHor = new QBoxLayout(QBoxLayout::LeftToRight);
layoutHor->addWidget(tabBar);
layoutHor->addStretch();
m_stackedWidget = new QStackedWidget(this);
m_stackedWidget->addWidget(compilationUnits);
m_stackedWidget->addWidget(headers);
QBoxLayout *layoutVert = new QBoxLayout(QBoxLayout::TopToBottom, this);
layoutVert->addLayout(layoutHor);
layoutVert->addWidget(m_stackedWidget);
connect(tabBar, &QTabBar::currentChanged, this, &OverviewPanel::switchTabs );
}
void OverviewPanel::switchTabs(int index)
{
m_stackedWidget->setCurrentIndex(index);
}