QGCMapTool.cc 799 Bytes
Newer Older
1 2
#include "QGCMapTool.h"
#include "ui_QGCMapTool.h"
LM's avatar
LM committed
3 4
#include <QAction>
#include <QMenu>
5 6 7 8 9 10 11 12 13

QGCMapTool::QGCMapTool(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::QGCMapTool)
{
    ui->setupUi(this);

    // Connect map and toolbar
    ui->toolBar->setMap(ui->map);
LM's avatar
LM committed
14 15 16 17 18
    // Connect zoom slider and map
    ui->zoomSlider->setMinimum(ui->map->MinZoom());
    ui->zoomSlider->setMaximum(ui->map->MaxZoom());
    ui->zoomSlider->setValue(ui->map->ZoomReal());
    connect(ui->zoomSlider, SIGNAL(valueChanged(int)), ui->map, SLOT(SetZoom(int)));
19 20 21 22 23 24 25 26 27
    connect(ui->map, SIGNAL(zoomChanged(int)), this, SLOT(setZoom(int)));
}

void QGCMapTool::setZoom(int zoom)
{
    if (ui->zoomSlider->value() != zoom)
    {
        ui->zoomSlider->setValue(zoom);
    }
28 29 30 31 32 33
}

QGCMapTool::~QGCMapTool()
{
    delete ui;
}