forked from organicmaps/organicmaps
[qt][linux] Handle touchpad rotation gesture
Signed-off-by: Ferenc Géczi <ferenc.gm@gmail.com>
This commit is contained in:
parent
d730ce9466
commit
64ebd79b4a
3 changed files with 16 additions and 1 deletions
|
@ -253,6 +253,12 @@ bool DrawWidget::event(QEvent * event)
|
|||
m_framework.Scale(exp(factor), m2::PointD(L2D(pos.x()), L2D(pos.y())), false);
|
||||
return true;
|
||||
}
|
||||
if (qNativeGestureEvent->gestureType() == Qt::RotateNativeGesture)
|
||||
{
|
||||
m_currentRotation += qNativeGestureEvent->value();
|
||||
m_framework.Rotate(m_currentRotation, false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// Everything else
|
||||
return QOpenGLWidget::event(event);
|
||||
|
@ -775,6 +781,12 @@ void DrawWidget::SetRuler(bool enabled)
|
|||
m_ruler.SetActive(enabled);
|
||||
}
|
||||
|
||||
void DrawWidget::OnViewportChanged(ScreenBase const & screen)
|
||||
{
|
||||
MapWidget::OnViewportChanged(screen);
|
||||
m_currentRotation = static_cast<qreal>(screen.GetAngle());
|
||||
}
|
||||
|
||||
// static
|
||||
void DrawWidget::RefreshDrawingRules()
|
||||
{
|
||||
|
|
|
@ -87,6 +87,8 @@ protected:
|
|||
void keyPressEvent(QKeyEvent * e) override;
|
||||
void keyReleaseEvent(QKeyEvent * e) override;
|
||||
|
||||
void OnViewportChanged(ScreenBase const & screen) override;
|
||||
|
||||
private:
|
||||
void SubmitFakeLocationPoint(m2::PointD const & pt);
|
||||
void SubmitRulerPoint(m2::PointD const & pt);
|
||||
|
@ -124,5 +126,6 @@ private:
|
|||
std::unique_ptr<Screenshoter> m_screenshoter;
|
||||
Ruler m_ruler;
|
||||
RoutingTurnsVisualizer m_turnsVisualizer;
|
||||
qreal m_currentRotation = 0.0;
|
||||
};
|
||||
} // namespace qt
|
||||
|
|
|
@ -82,7 +82,7 @@ protected:
|
|||
void Build();
|
||||
void ShowInfoPopup(QMouseEvent * e, m2::PointD const & pt);
|
||||
|
||||
void OnViewportChanged(ScreenBase const & screen);
|
||||
virtual void OnViewportChanged(ScreenBase const & screen);
|
||||
|
||||
// QOpenGLWidget overrides:
|
||||
void initializeGL() override;
|
||||
|
|
Loading…
Add table
Reference in a new issue