tools/drawMapTest/mainwindow.cpp
changeset 4477 63a21fac8bf7
parent 4458 7351e6f1ee28
equal deleted inserted replaced
4475:54e78c40970b 4477:63a21fac8bf7
     9     ui(new Ui::MainWindow)
     9     ui(new Ui::MainWindow)
    10 {
    10 {
    11     ui->setupUi(this);
    11     ui->setupUi(this);
    12 
    12 
    13     scene = new DrawMapScene(this);
    13     scene = new DrawMapScene(this);
    14     ui->graphicsView->setScene(scene);
    14     //ui->graphicsView->setScene(scene);
       
    15     ui->drawMapWidget->setScene(scene);
    15 
    16 
    16     connect(ui->pbUndo, SIGNAL(clicked()), scene, SLOT(undo()));
    17     connect(ui->pbUndo, SIGNAL(clicked()), scene, SLOT(undo()));
    17     connect(scene, SIGNAL(pathChanged()), this, SLOT(scene_pathChanged()));
    18     connect(scene, SIGNAL(pathChanged()), this, SLOT(scene_pathChanged()));
    18 }
    19 }
    19 
    20 
    32     default:
    33     default:
    33         break;
    34         break;
    34     }
    35     }
    35 }
    36 }
    36 
    37 
    37 void MainWindow::resizeEvent(QResizeEvent * event)
       
    38 {
       
    39     Q_UNUSED(event);
       
    40 
       
    41     if(ui->graphicsView)
       
    42         ui->graphicsView->fitInView(ui->graphicsView->scene()->sceneRect(), Qt::KeepAspectRatio);
       
    43 }
       
    44 
       
    45 void MainWindow::scene_pathChanged()
    38 void MainWindow::scene_pathChanged()
    46 {
    39 {
    47     QString str = scene->encode().toBase64();
    40     QString str = scene->encode().toBase64();
    48     ui->plainTextEdit->setPlainText(str);
    41     ui->plainTextEdit->setPlainText(str);
    49     ui->sbBytes->setValue(str.size());
    42     ui->sbBytes->setValue(str.size());
    50 }
       
    51 
       
    52 void MainWindow::on_pbSimplify_clicked()
       
    53 {
       
    54     scene->simplifyLast();
       
    55 }
    43 }
    56 
    44 
    57 void MainWindow::on_pbSave_clicked()
    45 void MainWindow::on_pbSave_clicked()
    58 {
    46 {
    59     QString fileName = QFileDialog::getSaveFileName(this, tr("Save map"), ".");
    47     QString fileName = QFileDialog::getSaveFileName(this, tr("Save map"), ".");