-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainwidget.cpp
More file actions
50 lines (40 loc) · 1.14 KB
/
mainwidget.cpp
File metadata and controls
50 lines (40 loc) · 1.14 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
#include "mainwidget.h"
#include "ui_mainwidget.h"
MainWidget::MainWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::MainWidget)
{
ui->setupUi(this);
_deptPersonInfoW = 0;
_tbnList = ui->toolBox->findChildren<QToolButton*>();
foreach (QToolButton *tbn, _tbnList) {
connect(tbn,&QToolButton::clicked,this,&MainWidget::toolBoxTbnClicked);
}
connect(ui->deptPersonInfoBtn,&QToolButton::clicked,this,&MainWidget::deptPersonInfoClicked);
}
MainWidget::~MainWidget()
{
delete ui;
}
void MainWidget::toolBoxTbnClicked()
{
QToolButton *tbn = (QToolButton*)sender();
QString str = tbn->text();
int count = ui->tabWidget->count();
for(int i = 0;i < count;++i) {
if(ui->tabWidget->tabText(i) == str) {
ui->tabWidget->setCurrentIndex(i);
break;
}
}
}
void MainWidget::deptPersonInfoClicked()
{
if(!_deptPersonInfoW) {
_deptPersonInfoW = new ShowWidget;
_deptPersonInfo = new DeptPersonInfo;
}
ui->tabWidget->addTab(_deptPersonInfoW,"人员信息");
_deptPersonInfo->init(_deptPersonInfoW->view());
_deptPersonInfo->select();
}