tools/drawMapTest/drawmapwidget.cpp
changeset 4477 63a21fac8bf7
equal deleted inserted replaced
4475:54e78c40970b 4477:63a21fac8bf7
       
     1 #include "drawmapwidget.h"
       
     2 
       
     3 DrawMapWidget::DrawMapWidget(QWidget *parent) :
       
     4     QWidget(parent),
       
     5     ui(new Ui::DrawMapWidget)
       
     6 {
       
     7     ui->setupUi(this);
       
     8 }
       
     9 
       
    10 DrawMapWidget::~DrawMapWidget()
       
    11 {
       
    12     delete ui;
       
    13 }
       
    14 
       
    15 void DrawMapWidget::changeEvent(QEvent *e)
       
    16 {
       
    17     QWidget::changeEvent(e);
       
    18     switch (e->type()) {
       
    19     case QEvent::LanguageChange:
       
    20         ui->retranslateUi(this);
       
    21         break;
       
    22     default:
       
    23         break;
       
    24     }
       
    25 }
       
    26 
       
    27 void DrawMapWidget::setScene(DrawMapScene * scene)
       
    28 {
       
    29     ui->graphicsView->setScene(scene);
       
    30 }
       
    31 
       
    32 void DrawMapWidget::resizeEvent(QResizeEvent * event)
       
    33 {
       
    34     Q_UNUSED(event);
       
    35 
       
    36     if(ui->graphicsView && ui->graphicsView->scene())
       
    37         ui->graphicsView->fitInView(ui->graphicsView->scene()->sceneRect(), Qt::KeepAspectRatio);
       
    38 }