mirror of
https://github.com/leozide/leocad.git
synced 2026-07-28 04:07:11 +00:00
Add Zoom and SmartZoom gesture.
This commit is contained in:
@@ -87,6 +87,30 @@ void lcViewWidget::paintGL()
|
|||||||
mView->OnDraw();
|
mView->OnDraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool lcViewWidget::event(QEvent* Event)
|
||||||
|
{
|
||||||
|
if (Event->type() == QEvent::NativeGesture)
|
||||||
|
{
|
||||||
|
QNativeGestureEvent* GestureEvent = static_cast<QNativeGestureEvent*>(Event);
|
||||||
|
|
||||||
|
switch (GestureEvent->gestureType())
|
||||||
|
{
|
||||||
|
case Qt::ZoomNativeGesture:
|
||||||
|
mView->Zoom(GestureEvent->value() * 100.0f);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Qt::SmartZoomNativeGesture:
|
||||||
|
mView->ZoomExtents();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return QWidget::event(Event);
|
||||||
|
}
|
||||||
|
|
||||||
void lcViewWidget::focusInEvent(QFocusEvent* FocusEvent)
|
void lcViewWidget::focusInEvent(QFocusEvent* FocusEvent)
|
||||||
{
|
{
|
||||||
if (mView)
|
if (mView)
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ protected:
|
|||||||
void initializeGL() override;
|
void initializeGL() override;
|
||||||
void resizeGL(int Width, int Height) override;
|
void resizeGL(int Width, int Height) override;
|
||||||
void paintGL() override;
|
void paintGL() override;
|
||||||
|
bool event(QEvent* Event) override;
|
||||||
void focusInEvent(QFocusEvent* FocusEvent) override;
|
void focusInEvent(QFocusEvent* FocusEvent) override;
|
||||||
void focusOutEvent(QFocusEvent* FocusEvent) override;
|
void focusOutEvent(QFocusEvent* FocusEvent) override;
|
||||||
void keyPressEvent(QKeyEvent* KeyEvent) override;
|
void keyPressEvent(QKeyEvent* KeyEvent) override;
|
||||||
|
|||||||
Reference in New Issue
Block a user