Fix error when enabling additional providers in processing

Add an interface method to show the options dialog at a specific
page. This is required since plugins can now embed their options
in the main options dialog, so they may also need a way to
force this dialog to open.

Implement this in processing so that enabling additional providers
works again.
This commit is contained in:
Nyall Dawson 2017-03-24 11:16:49 +10:00
parent 109be1b0bb
commit 2354696f26
6 changed files with 16 additions and 2 deletions

View File

@ -213,6 +213,7 @@ class QgisInterface : QObject
virtual QList<QgsComposerInterface *> openComposers() = 0;
virtual QgsComposerInterface *openComposer( QgsComposition *composition ) = 0;
virtual void closeComposer( QgsComposition *composition ) = 0;
virtual void showOptionsDialog( QWidget *parent = 0, const QString &currentPage = QString() ) = 0;
virtual QMap<QString, QVariant> defaultStyleSheetOptions() = 0;

View File

@ -73,6 +73,7 @@ class ConfigOptionsPage(QgsOptionsPageWidget):
layout.setMargin(0)
self.setLayout(layout)
layout.addWidget(self.config_widget)
self.setObjectName('processingOptions')
def apply(self):
self.config_widget.accept()

View File

@ -74,8 +74,7 @@ class ProcessingToolbox(BASE, WIDGET):
self.txtTip.setVisible(False)
self.tipWasClosed = True
else:
dlg = ConfigDialog(self)
dlg.exec_()
iface.showOptionsDialog(iface.mainWindow(), 'processingOptions')
self.txtTip.setVisible(self.disabledProviders())
self.txtTip.linkActivated.connect(openSettings)
if hasattr(self.searchBox, 'setPlaceholderText'):

View File

@ -418,6 +418,11 @@ void QgisAppInterface::closeComposer( QgsComposition *composition )
}
}
void QgisAppInterface::showOptionsDialog( QWidget *parent, const QString &currentPage )
{
return qgis->showOptionsDialog( parent, currentPage );
}
QMap<QString, QVariant> QgisAppInterface::defaultStyleSheetOptions()
{
return qgis->styleSheetBuilder()->defaultOptions();

View File

@ -208,6 +208,7 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
QList<QgsComposerInterface *> openComposers() override;
QgsComposerInterface *openComposer( QgsComposition *composition ) override;
void closeComposer( QgsComposition *composition ) override;
virtual void showOptionsDialog( QWidget *parent = nullptr, const QString &currentPage = QString() ) override;
//! Return changeable options built from settings and/or defaults
QMap<QString, QVariant> defaultStyleSheetOptions() override;

View File

@ -293,6 +293,13 @@ class GUI_EXPORT QgisInterface : public QObject
*/
virtual void closeComposer( QgsComposition *composition ) = 0;
/**
* Opens the options dialog. The \a currentPage argument can be used to force
* the dialog to open at a specific page.
* @note added in QGIS 3.0
*/
virtual void showOptionsDialog( QWidget *parent = nullptr, const QString &currentPage = QString() ) = 0;
//! Return changeable options built from settings and/or defaults
virtual QMap<QString, QVariant> defaultStyleSheetOptions() = 0;