13 #include <MarbleWidget.h> 14 #include <MarbleMap.h> 15 #include <MarbleModel.h> 16 #include <ViewParams.h> 17 #include <ViewportParams.h> 20 #include <QMouseEvent> 21 #include <QWheelEvent> 22 #include <QPersistentModelIndex> 30 #define MAP_ZOOM_STEP 40 35 #define MIN_DRAG_THRESHOLD 3 39 : MarbleWidgetInputHandler()
48 QWheelEvent *wheelEvent = 0;
49 QMouseEvent *mouseEvent =
static_cast<QMouseEvent*
>(e);
52 case QEvent::MouseButtonPress:
61 m_widget->setCursor(Qt::ClosedHandCursor);
64 case QEvent::MouseButtonRelease:
66 m_widget->setCursor(Qt::OpenHandCursor);
68 m_widget->setCursor(Qt::PointingHandCursor);
71 case QEvent::MouseMove:
72 if (mouseEvent->buttons() & Qt::LeftButton) {
79 m_widget->setCursor(Qt::ClosedHandCursor);
82 if (m_widget->projection() == Spherical) {
83 if (m_widget->map()->viewParams()->viewport()->polarity() > 0) {
84 if (mouseEvent->y() < (-m_widget->northPoleY() + m_widget->height()/2))
87 if (mouseEvent->y() > (+m_widget->northPoleY() + m_widget->height()/2))
92 qreal radius = (qreal)(m_widget->radius());
95 m_widget->centerOn(lon, lat,
false);
101 m_widget->setCursor(Qt::PointingHandCursor);
103 m_widget->setCursor(Qt::OpenHandCursor);
107 case QEvent::MouseButtonDblClick:
109 if (mouseEvent->button() == Qt::LeftButton) {
112 }
else if (mouseEvent->button() == Qt::RightButton) {
120 m_widget->setViewContext(Marble::Animation);
122 wheelEvent =
static_cast<QWheelEvent*
>(e);
123 m_widget->zoomViewBy((
int)(wheelEvent->delta() / 3));
124 m_mouseWheelTimer->start(400);
130 return MarbleWidgetInputHandler::eventFilter(obj, e);
136 return (m_widget->model()->whichFeatureAt(point).size() > 0);