-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmymainwindow.cpp
43 lines (37 loc) · 1.17 KB
/
mymainwindow.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
39
40
41
42
43
#include "mymainwindow.h"
#include "ui_mymainwindow.h"
MyMainWindow::MyMainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MyMainWindow)
{
ui->setupUi(this);
rectGroup = new QActionGroup(this);
rectGroup->addAction(ui->actionAddRectangle);
rectGroup->addAction(ui->actionRemoveRectangle);
rectGroup->addAction(ui->actionSearchRect);
ui->actionAddRectangle->setChecked(true);
connect(ui->actionQuit,SIGNAL(triggered()),this,SLOT(close()));
ui->rectview->scene->treescene = ui->rtreeview->scene;
connect(ui->actionAddRectangle
,SIGNAL(toggled(bool)),this,SLOT(addMode(bool)));
connect(ui->actionRemoveRectangle,SIGNAL(toggled(bool)),
this,SLOT(removeMode(bool)));
connect(ui->actionSearchRect,SIGNAL(toggled(bool)),
this,SLOT(searchMode(bool)));
}
MyMainWindow::~MyMainWindow()
{
delete ui;
}
void MyMainWindow::addMode(bool a)
{
if (a) ui->rectview->scene->setMode(RectScene::Add);
}
void MyMainWindow::removeMode(bool a)
{
if (a) ui->rectview->scene->setMode(RectScene::Remove);
}
void MyMainWindow::searchMode(bool a)
{
if (a) ui->rectview->scene->setMode(RectScene::Search);
}