From 4a9cc3b790d5a47805452ccc8d9e57e52b210691 Mon Sep 17 00:00:00 2001 From: edouard Date: Mon, 5 Jul 2010 16:19:55 +0000 Subject: [PATCH] OP-52 : small work on gpsgadget, one day it might be useful... git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1027 ebee16cc-31ac-478f-84a7-5cbb03baadba --- ground/src/plugins/gpsdisplay/gpsdisplay.pro | 1 + .../plugins/gpsdisplay/gpsdisplaywidget.cpp | 16 + .../plugins/gpsdisplay/gpsdisplaywidget.ui | 37 +- .../plugins/gpsdisplay/images/gpsEarth.svg | 344 ++++++++++++++++++ 4 files changed, 397 insertions(+), 1 deletion(-) create mode 100644 ground/src/plugins/gpsdisplay/images/gpsEarth.svg diff --git a/ground/src/plugins/gpsdisplay/gpsdisplay.pro b/ground/src/plugins/gpsdisplay/gpsdisplay.pro index b6008f4bf..f532fe1f7 100644 --- a/ground/src/plugins/gpsdisplay/gpsdisplay.pro +++ b/ground/src/plugins/gpsdisplay/gpsdisplay.pro @@ -20,3 +20,4 @@ SOURCES += gpsdisplaygadgetoptionspage.cpp OTHER_FILES += GpsDisplayGadget.pluginspec FORMS += gpsdisplaygadgetoptionspage.ui \ gpsdisplaywidget.ui +RESOURCES += widgetresources.qrc diff --git a/ground/src/plugins/gpsdisplay/gpsdisplaywidget.cpp b/ground/src/plugins/gpsdisplay/gpsdisplaywidget.cpp index b5a5c88ba..788e693b2 100644 --- a/ground/src/plugins/gpsdisplay/gpsdisplaywidget.cpp +++ b/ground/src/plugins/gpsdisplay/gpsdisplaywidget.cpp @@ -45,6 +45,22 @@ GpsDisplayWidget::GpsDisplayWidget(QWidget *parent) : QWidget(parent) widget = new Ui_GpsDisplayWidget(); widget->setupUi(this); + QGraphicsScene *scene = new QGraphicsScene(this); + QSvgRenderer *renderer = new QSvgRenderer(); + QGraphicsSvgItem *world = new QGraphicsSvgItem(); + renderer->load(QString(":/gpsgadget/images/gpsEarth.svg")); + world->setSharedRenderer(renderer); + world->setElementId("map"); + scene->addItem(world); + scene->setSceneRect(world->boundingRect()); + widget->gpsWorld->setScene(scene); + // Somehow fitInView does not work there at all? Makes + // the 'world' element tiny tiny tiny. anyone knows why?? + //widget->gpsWorld->fitInView(world,Qt::KeepAspectRatio); + qreal factor = widget->gpsWorld->size().height()/world->boundingRect().height(); + widget->gpsWorld->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed); + world->setScale(factor); + } GpsDisplayWidget::~GpsDisplayWidget() diff --git a/ground/src/plugins/gpsdisplay/gpsdisplaywidget.ui b/ground/src/plugins/gpsdisplay/gpsdisplaywidget.ui index 70b8ac0d8..41f30cb02 100644 --- a/ground/src/plugins/gpsdisplay/gpsdisplaywidget.ui +++ b/ground/src/plugins/gpsdisplay/gpsdisplaywidget.ui @@ -120,7 +120,7 @@ Connect - + 300 @@ -129,6 +129,41 @@ 171 + + + 0 + 0 + + + + + 171 + 171 + + + + + 171 + 171 + + + + false + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + + 0.000000000000000 + 0.000000000000000 + 169.000000000000000 + 169.000000000000000 + + diff --git a/ground/src/plugins/gpsdisplay/images/gpsEarth.svg b/ground/src/plugins/gpsdisplay/images/gpsEarth.svg new file mode 100644 index 000000000..1a7a60cef --- /dev/null +++ b/ground/src/plugins/gpsdisplay/images/gpsEarth.svg @@ -0,0 +1,344 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + N + + + + E + + + + S + + + + W + + + + + + + + + + + + + + + + + + +