Skip to content

Commit

Permalink
Add help button to mesh layer properties dialog
Browse files Browse the repository at this point in the history
and open dedicated section
  • Loading branch information
DelazJ authored and PeterPetrik committed Mar 13, 2020
1 parent e6fa6c8 commit dad3c0b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
23 changes: 23 additions & 0 deletions src/app/mesh/qgsmeshlayerproperties.cpp
Expand Up @@ -64,12 +64,14 @@ QgsMeshLayerProperties::QgsMeshLayerProperties( QgsMapLayer *lyr, QgsMapCanvas *
connect( buttonBox->button( QDialogButtonBox::Apply ), &QAbstractButton::clicked, this, &QgsMeshLayerProperties::apply );

connect( mMeshLayer, &QgsMeshLayer::dataChanged, this, &QgsMeshLayerProperties::syncAndRepaint );
connect( buttonBox, &QDialogButtonBox::helpRequested, this, &QgsMeshLayerProperties::showHelp );

#ifdef HAVE_3D
mMesh3DWidget = new QgsMeshLayer3DRendererWidget( mMeshLayer, canvas, mOptsPage_3DView );

mOptsPage_3DView->setLayout( new QVBoxLayout( mOptsPage_3DView ) );
mOptsPage_3DView->layout()->addWidget( mMesh3DWidget );
mOptsPage_3DView->setProperty( "helpPage", QStringLiteral( "working_with_mesh/mesh_properties.html#d-view-properties" ) );
#else
delete mOptsPage_3DView; // removes both the "3d view" list item and its page
#endif
Expand All @@ -91,6 +93,13 @@ QgsMeshLayerProperties::QgsMeshLayerProperties( QgsMapLayer *lyr, QgsMapCanvas *
if ( !mMeshLayer->styleManager()->isDefault( mMeshLayer->styleManager()->currentStyle() ) )
title += QStringLiteral( " (%1)" ).arg( mMeshLayer->styleManager()->currentStyle() );
restoreOptionsBaseUi( title );

//Add help page references
mOptsPage_Information->setProperty( "helpPage", QStringLiteral( "working_with_mesh/mesh_properties.html#information-properties" ) );
mOptsPage_Source->setProperty( "helpPage", QStringLiteral( "working_with_mesh/mesh_properties.html#source-properties" ) );
mOptsPage_Style->setProperty( "helpPage", QStringLiteral( "working_with_mesh/mesh_properties.html#symbology-properties" ) );
mOptsPage_Rendering->setProperty( "helpPage", QStringLiteral( "working_with_mesh/mesh_properties.html#rendering-properties" ) );

}

void QgsMeshLayerProperties::syncToLayer()
Expand Down Expand Up @@ -251,3 +260,17 @@ void QgsMeshLayerProperties::syncAndRepaint()
syncToLayer();
mMeshLayer->triggerRepaint();
}

void QgsMeshLayerProperties::showHelp()
{
const QVariant helpPage = mOptionsStackedWidget->currentWidget()->property( "helpPage" );

if ( helpPage.isValid() )
{
QgsHelp::openHelp( helpPage.toString() );
}
else
{
QgsHelp::openHelp( QStringLiteral( "working_with_mesh/mesh_properties.html" ) );
}
}
2 changes: 2 additions & 0 deletions src/app/mesh/qgsmeshlayerproperties.h
Expand Up @@ -71,6 +71,8 @@ class APP_EXPORT QgsMeshLayerProperties : public QgsOptionsDialogBase, private U
QgsMeshLayer3DRendererWidget *mMesh3DWidget = nullptr;

friend class TestQgsMeshLayerPropertiesDialog;

void showHelp();
};


Expand Down
4 changes: 2 additions & 2 deletions src/ui/mesh/qgsmeshlayerpropertiesbase.ui
Expand Up @@ -357,7 +357,7 @@ border-radius: 2px;</string>
</layout>
</widget>
<widget class="QWidget" name="mOptsPage_3DView"/>
<widget class="QWidget" name="mOptspage_Rendering">
<widget class="QWidget" name="mOptsPage_Rendering">
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QgsCollapsibleGroupBox" name="mSimplifyMeshGroupBox">
Expand Down Expand Up @@ -474,7 +474,7 @@ border-radius: 2px;</string>
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
Expand Down

0 comments on commit dad3c0b

Please sign in to comment.