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);
|
|
13 |
}
|
|
14 |
|
|
15 |
MainWindow::~MainWindow()
|
|
16 |
{
|
|
17 |
delete ui;
|
|
18 |
}
|
|
19 |
|
|
20 |
void MainWindow::changeEvent(QEvent *e)
|
|
21 |
{
|
|
22 |
QMainWindow::changeEvent(e);
|
|
23 |
switch (e->type()) {
|
|
24 |
case QEvent::LanguageChange:
|
|
25 |
ui->retranslateUi(this);
|
|
26 |
break;
|
|
27 |
default:
|
|
28 |
break;
|
|
29 |
}
|
|
30 |
}
|
|
31 |
|
|
32 |
void MainWindow::resizeEvent(QResizeEvent * event)
|
|
33 |
{
|
|
34 |
Q_UNUSED(event);
|
|
35 |
|
|
36 |
if(ui->graphicsView)
|
|
37 |
ui->graphicsView->fitInView(ui->graphicsView->scene()->sceneRect(), Qt::KeepAspectRatio);
|
|
38 |
}
|