mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
Merge pull request #5245 from nyalldawson/conditionalHelpLink
Set the most accurate User Manual page to Options tabs
This commit is contained in:
commit
b0f27c532c
@ -25,6 +25,19 @@ class QgsOptionsPageWidget : QWidget
|
||||
Constructor for QgsOptionsPageWidget.
|
||||
%End
|
||||
|
||||
virtual QString helpKey() const;
|
||||
%Docstring
|
||||
Returns the optional help key for the options page. The default implementation
|
||||
returns an empty string.
|
||||
|
||||
If a non-empty string is returned by this method, it will be used as the help key
|
||||
retrieved when the "help" button is clicked while this options page is active.
|
||||
|
||||
If an empty string is returned by this method the default QGIS options
|
||||
help will be retrieved.
|
||||
:rtype: str
|
||||
%End
|
||||
|
||||
public slots:
|
||||
|
||||
virtual void apply() = 0;
|
||||
|
@ -81,6 +81,9 @@ class ConfigOptionsPage(QgsOptionsPageWidget):
|
||||
def apply(self):
|
||||
self.config_widget.accept()
|
||||
|
||||
def helpKey(self):
|
||||
return 'processing/index.html'
|
||||
|
||||
|
||||
class ConfigDialog(BASE, WIDGET):
|
||||
|
||||
|
@ -2354,5 +2354,35 @@ void QgsOptions::setZoomFactorValue()
|
||||
|
||||
void QgsOptions::showHelp()
|
||||
{
|
||||
QgsHelp::openHelp( QStringLiteral( "introduction/qgis_configuration.html#options" ) );
|
||||
QWidget *activeTab = mOptionsStackedWidget->currentWidget();
|
||||
QString link;
|
||||
|
||||
// give first priority to created pages which have specified a help key
|
||||
for ( const QgsOptionsPageWidget *widget : qgsAsConst( mAdditionalOptionWidgets ) )
|
||||
{
|
||||
if ( widget == activeTab )
|
||||
{
|
||||
link = widget->helpKey();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( link.isEmpty() )
|
||||
{
|
||||
link = QStringLiteral( "introduction/qgis_configuration.html" );
|
||||
|
||||
if ( activeTab == mOptionsPageAuth )
|
||||
{
|
||||
link = QStringLiteral( "auth_system/index.html" );
|
||||
}
|
||||
else if ( activeTab == mOptionsPageVariables )
|
||||
{
|
||||
link = QStringLiteral( "introduction/general_tools.html#variables" );
|
||||
}
|
||||
else if ( activeTab == mOptionsPageCRS )
|
||||
{
|
||||
link = QStringLiteral( "working_with_projections/working_with_projections.html" );
|
||||
}
|
||||
}
|
||||
QgsHelp::openHelp( link );
|
||||
}
|
||||
|
@ -38,6 +38,18 @@ class GUI_EXPORT QgsOptionsPageWidget : public QWidget
|
||||
: QWidget( parent )
|
||||
{}
|
||||
|
||||
/**
|
||||
* Returns the optional help key for the options page. The default implementation
|
||||
* returns an empty string.
|
||||
*
|
||||
* If a non-empty string is returned by this method, it will be used as the help key
|
||||
* retrieved when the "help" button is clicked while this options page is active.
|
||||
*
|
||||
* If an empty string is returned by this method the default QGIS options
|
||||
* help will be retrieved.
|
||||
*/
|
||||
virtual QString helpKey() const { return QString(); }
|
||||
|
||||
public slots:
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user