Skip to content

Commit

Permalink
Move connect from construction for maptoolidentify.
Browse files Browse the repository at this point in the history
  • Loading branch information
ismailsunni committed Mar 15, 2020
1 parent b134c77 commit 6211fe2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/app/3d/qgs3dmapcanvasdockwidget.cpp
Expand Up @@ -128,7 +128,7 @@ Qgs3DMapCanvasDockWidget::Qgs3DMapCanvasDockWidget( QWidget *parent )

mMapToolIdentify = new Qgs3DMapToolIdentify( mCanvas );

mMapToolMeasureLine = new Qgs3DMapToolMeasureLine( mCanvas );
// mMapToolMeasureLine = new Qgs3DMapToolMeasureLine( mCanvas );

mLabelPendingJobs = new QLabel( this );
mProgressPendingJobs = new QProgressBar( this );
Expand Down Expand Up @@ -223,6 +223,9 @@ void Qgs3DMapCanvasDockWidget::setMapSettings( Qgs3DMapSettings *map )

connect( mCanvas->scene(), &Qgs3DMapScene::totalPendingJobsCountChanged, this, &Qgs3DMapCanvasDockWidget::onTotalPendingJobsCountChanged );

// Update the connection after the map is updated
mMapToolIdentify->updateSignalSlots();

mAnimationWidget->setCameraController( mCanvas->scene()->cameraController() );
mAnimationWidget->setMap( map );

Expand Down
7 changes: 6 additions & 1 deletion src/app/3d/qgs3dmaptoolidentify.cpp
Expand Up @@ -63,7 +63,7 @@ void Qgs3DMapToolIdentifyPickHandler::handlePickOnVectorLayer( QgsVectorLayer *v
Qgs3DMapToolIdentify::Qgs3DMapToolIdentify( Qgs3DMapCanvas *canvas )
: Qgs3DMapTool( canvas )
{
connect( mCanvas->scene(), &Qgs3DMapScene::terrainEntityChanged, this, &Qgs3DMapToolIdentify::onTerrainEntityChanged );
// connect( mCanvas->scene(), &Qgs3DMapScene::terrainEntityChanged, this, &Qgs3DMapToolIdentify::onTerrainEntityChanged );

mPickHandler.reset( new Qgs3DMapToolIdentifyPickHandler( this ) );
}
Expand Down Expand Up @@ -104,6 +104,11 @@ QCursor Qgs3DMapToolIdentify::cursor() const
return QgsApplication::getThemeCursor( QgsApplication::Cursor::Identify );
}

void Qgs3DMapToolIdentify::updateSignalSlots()
{
connect( mCanvas->scene(), &Qgs3DMapScene::terrainEntityChanged, this, &Qgs3DMapToolIdentify::onTerrainEntityChanged );
}

void Qgs3DMapToolIdentify::onTerrainPicked( Qt3DRender::QPickEvent *event )
{
if ( event->button() != Qt3DRender::QPickEvent::LeftButton )
Expand Down
6 changes: 5 additions & 1 deletion src/app/3d/qgs3dmaptoolidentify.h
Expand Up @@ -45,9 +45,13 @@ class Qgs3DMapToolIdentify : public Qgs3DMapTool

QCursor cursor() const override;

void updateSignalSlots();

public slots:
void onTerrainEntityChanged();

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

private:
std::unique_ptr<Qgs3DMapToolIdentifyPickHandler> mPickHandler;
Expand Down

0 comments on commit 6211fe2

Please sign in to comment.