-
Notifications
You must be signed in to change notification settings - Fork 0
/
centralwidget.cpp
38 lines (30 loc) · 1.2 KB
/
centralwidget.cpp
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
31
32
33
34
35
36
37
38
#include "centralwidget.h"
#include <QVBoxLayout>
#include <QHBoxLayout>
#include "leftsidebar.h"
#include "splitline.h"
#include "rightstackwidget.h"
#include "navlistview.h"
CentralWidget::CentralWidget(QWidget *parent) : QWidget(parent)
{
QVBoxLayout *mainVBLayout = new QVBoxLayout(this);
QHBoxLayout *contentHBLayout = new QHBoxLayout;
LeftSideBar *leftSideBar = new LeftSideBar(this);
RightStackWidget *rightStackWidget = new RightStackWidget(this);
contentHBLayout->addWidget(leftSideBar);
contentHBLayout->addWidget(new SplitLine(SplitLine::Vertical, this));
contentHBLayout->addWidget(rightStackWidget);
contentHBLayout->setMargin(0);
contentHBLayout->setContentsMargins(0, 0, 0, 0);
contentHBLayout->setSpacing(0);
mainVBLayout->setMargin(0);
mainVBLayout->setContentsMargins(0, 0, 0, 0);
mainVBLayout->setSpacing(0);
mainVBLayout->addWidget(new SplitLine(SplitLine::Horizontal, this));
mainVBLayout->addLayout(contentHBLayout);
// 当切换左边的导航栏时切换右边的pages
connect(leftSideBar->navListView, &NavListView::currentRowChanged, rightStackWidget, &RightStackWidget::setCurrentIndex);
}
CentralWidget::~CentralWidget()
{
}