4425
|
1 |
#include "mainwindow.h"
|
|
2 |
#include "ui_mainwindow.h"
|
|
3 |
#include "drawmapscene.h"
|
|
4 |
|
|
5 |
MainWindow::MainWindow(QWidget *parent) :
|
|
6 |
QMainWindow(parent),
|
|
7 |
ui(new Ui::MainWindow)
|
|
8 |
{
|
|
9 |
ui->setupUi(this);
|
|
10 |
|
|
11 |
DrawMapScene * scene = new DrawMapScene(this);
|
|
12 |
ui->graphicsView->setScene(scene);
|
4426
|
13 |
|
|
14 |
connect(ui->pbUndo, SIGNAL(clicked()), scene, SLOT(undo()));
|
4425
|
15 |
}
|
|
16 |
|
|
17 |
MainWindow::~MainWindow()
|
|
18 |
{
|
|
19 |
delete ui;
|
|
20 |
}
|
|
21 |
|
|
22 |
void MainWindow::changeEvent(QEvent *e)
|
|
23 |
{
|
|
24 |
QMainWindow::changeEvent(e);
|
|
25 |
switch (e->type()) {
|
|
26 |
case QEvent::LanguageChange:
|
|
27 |
ui->retranslateUi(this);
|
|
28 |
break;
|
|
29 |
default:
|
|
30 |
break;
|
|
31 |
}
|
|
32 |
}
|
|
33 |
|
|
34 |
void MainWindow::resizeEvent(QResizeEvent * event)
|
|
35 |
{
|
|
36 |
Q_UNUSED(event);
|
|
37 |
|
|
38 |
if(ui->graphicsView)
|
|
39 |
ui->graphicsView->fitInView(ui->graphicsView->scene()->sceneRect(), Qt::KeepAspectRatio);
|
|
40 |
}
|