Skip to content

Commit

Permalink
Add bool argument to avoid sender check in slot.
Browse files Browse the repository at this point in the history
  • Loading branch information
ismailsunni committed Jun 7, 2019
1 parent e299301 commit f22e4ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
11 changes: 4 additions & 7 deletions src/app/3d/qgs3dmapcanvasdockwidget.cpp
Expand Up @@ -57,12 +57,13 @@ Qgs3DMapCanvasDockWidget::Qgs3DMapCanvasDockWidget( QWidget *parent )

QAction *toggleOnScreenNavigation = toolBar->addAction(
QgsApplication::getThemeIcon( QStringLiteral( "mAction3DNavigation.svg" ) ),
tr( "Toggle On-Screen Navigation" ), this, &Qgs3DMapCanvasDockWidget::toggleNavigationWidget );
tr( "Toggle On-Screen Navigation" ));

toggleOnScreenNavigation->setCheckable( true );
toggleOnScreenNavigation->setChecked(
setting.value( QStringLiteral( "/3D/navigationWidget/visibility" ), true, QgsSettings::Gui ).toBool()
);
QObject::connect(toggleOnScreenNavigation, &QAction::toggled, this, &Qgs3DMapCanvasDockWidget::toggleNavigationWidget);

toolBar->addSeparator();

Expand Down Expand Up @@ -158,13 +159,9 @@ void Qgs3DMapCanvasDockWidget::identify()
mCanvas->setMapTool( action->isChecked() ? mMapToolIdentify : nullptr );
}

void Qgs3DMapCanvasDockWidget::toggleNavigationWidget()
void Qgs3DMapCanvasDockWidget::toggleNavigationWidget(bool visibility)
{
QAction *action = qobject_cast<QAction *>( sender() );
if ( !action )
return;

mCanvas->setOnScreenNavigationVisibility( action->isChecked() );
mCanvas->setOnScreenNavigationVisibility( visibility );
}

void Qgs3DMapCanvasDockWidget::setMapSettings( Qgs3DMapSettings *map )
Expand Down
2 changes: 1 addition & 1 deletion src/app/3d/qgs3dmapcanvasdockwidget.h
Expand Up @@ -48,7 +48,7 @@ class Qgs3DMapCanvasDockWidget : public QgsDockWidget
void saveAsImage();
void toggleAnimations();
void identify();
void toggleNavigationWidget();
void toggleNavigationWidget(bool visibility);

void onMainCanvasLayersChanged();
void onMainCanvasColorChanged();
Expand Down

0 comments on commit f22e4ec

Please sign in to comment.