From 74d96d0073b705224e9b402f44a2ba1b76ce5ff8 Mon Sep 17 00:00:00 2001 From: PT_Dreamer Date: Tue, 8 May 2012 16:22:06 +0100 Subject: [PATCH] Minor cleaning --- .../opmapcontrol/src/mapwidget/mapgraphicitem.cpp | 12 +++++++++++- .../libs/opmapcontrol/src/mapwidget/mapgraphicitem.h | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/mapgraphicitem.cpp b/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/mapgraphicitem.cpp index d4c548015..91623b03f 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/mapgraphicitem.cpp +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/mapgraphicitem.cpp @@ -40,6 +40,7 @@ namespace mapcontrol core->SetCurrentRegion(internals::Rectangle(0, 0, maprect.width(), maprect.height())); core->SetMapType(MapType::GoogleHybrid); this->SetZoom(2); + this->setFlag(ItemIsFocusable); connect(core,SIGNAL(OnNeedInvalidation()),this,SLOT(Core_OnNeedInvalidation())); connect(core,SIGNAL(OnMapDrag()),this,SLOT(ChildPosRefresh())); connect(core,SIGNAL(OnMapZoomChanged()),this,SLOT(ChildPosRefresh())); @@ -238,7 +239,6 @@ namespace mapcontrol selectionStart = FromLocalToLatLng(event->pos().x(), event->pos().y()); } } - } void MapGraphicItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { @@ -272,6 +272,16 @@ namespace mapcontrol } } + void MapGraphicItem::keyPressEvent(QKeyEvent *event) + { + if(event->modifiers()&(Qt::ShiftModifier|Qt::ControlModifier)) + this->setCursor(Qt::CrossCursor); + } + void MapGraphicItem::keyReleaseEvent(QKeyEvent *event) + { + if((event->modifiers()&(Qt::ShiftModifier|Qt::ControlModifier))==0) + this->setCursor(Qt::ArrowCursor); + } bool MapGraphicItem::SetZoomToFitRect(internals::RectLatLng const& rect) { int maxZoom = core->GetMaxZoomToFitRect(rect); diff --git a/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/mapgraphicitem.h b/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/mapgraphicitem.h index 034b1c8b8..c3c235617 100644 --- a/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/mapgraphicitem.h +++ b/ground/openpilotgcs/src/libs/opmapcontrol/src/mapwidget/mapgraphicitem.h @@ -107,6 +107,8 @@ namespace mapcontrol void wheelEvent ( QGraphicsSceneWheelEvent * event ); void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); bool IsMouseOverMarker()const{return isMouseOverMarker;} + void keyPressEvent ( QKeyEvent * event ); + void keyReleaseEvent ( QKeyEvent * event ); /** * @brief Returns current map zoom