Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix un-changed cursor when switching between 3d tool.
  • Loading branch information
ismailsunni authored and wonder-sk committed Aug 28, 2019
1 parent a3e5275 commit c0da905
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/app/3d/qgs3dmapcanvas.cpp
Expand Up @@ -135,6 +135,7 @@ void Qgs3DMapCanvas::setMapTool( Qgs3DMapTool *tool )
if ( tool == mMapTool )
return;

// For Camera Control tool
if ( mMapTool && !tool )
{
mEngine->window()->removeEventFilter( this );
Expand All @@ -145,7 +146,6 @@ void Qgs3DMapCanvas::setMapTool( Qgs3DMapTool *tool )
{
mEngine->window()->installEventFilter( this );
mScene->cameraController()->setEnabled( tool->allowsCameraControls() );
mEngine->window()->setCursor( tool->cursor() );
}

if ( mMapTool )
Expand All @@ -154,7 +154,11 @@ void Qgs3DMapCanvas::setMapTool( Qgs3DMapTool *tool )
mMapTool = tool;

if ( mMapTool )
{
mMapTool->activate();
mEngine->window()->setCursor( mMapTool->cursor() );
}

}

bool Qgs3DMapCanvas::eventFilter( QObject *watched, QEvent *event )
Expand Down
5 changes: 5 additions & 0 deletions src/app/3d/qgs3dmaptoolmeasureline.cpp
Expand Up @@ -119,6 +119,11 @@ void Qgs3DMapToolMeasureLine::deactivate()
mDialog->hide();
}

QCursor Qgs3DMapToolMeasureLine::cursor() const
{
return Qt::CrossCursor;
}

void Qgs3DMapToolMeasureLine::onTerrainPicked( Qt3DRender::QPickEvent *event )
{
handleClick( event, event->worldIntersection() );
Expand Down
2 changes: 2 additions & 0 deletions src/app/3d/qgs3dmaptoolmeasureline.h
Expand Up @@ -65,6 +65,8 @@ class Qgs3DMapToolMeasureLine : public Qgs3DMapTool
void activate() override;
void deactivate() override;

QCursor cursor() const override;

private slots:
void onTerrainPicked( Qt3DRender::QPickEvent *event );
void onTerrainEntityChanged();
Expand Down

0 comments on commit c0da905

Please sign in to comment.