Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[options] Ensure that the "Advanced" tab is always the last tab in th…
…e list
- Loading branch information
1 parent
ba4906e
commit f6b0331
Showing
8 changed files
with
222 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,70 @@ | |||
/*************************************************************************** | |||
qgsadvancedoptions.cpp | |||
------------------------- | |||
begin : September 2020 | |||
copyright : (C) 2020 by Nyall Dawson | |||
email : nyall dot dawson at gmail dot com | |||
*************************************************************************** | |||
* * | |||
* This program is free software; you can redistribute it and/or modify * | |||
* it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | |||
* * | |||
***************************************************************************/ | |||
|
|||
#include "qgsadvancedoptions.h" | |||
#include "qgsapplication.h" | |||
#include "qgssettings.h" | |||
#include "qgis.h" | |||
|
|||
// | |||
// QgsAdvancedSettingsWidget | |||
// | |||
|
|||
QgsAdvancedSettingsWidget::QgsAdvancedSettingsWidget( QWidget *parent ) | |||
: QgsOptionsPageWidget( parent ) | |||
{ | |||
setupUi( this ); | |||
|
|||
layout()->setContentsMargins( 0, 0, 0, 0 ); | |||
|
|||
connect( mAdvancedSettingsEnableButton, &QPushButton::clicked, this, [ = ] | |||
{ | |||
mAdvancedSettingsEditor->show(); | |||
mAdvancedSettingsWarning->hide(); | |||
} ); | |||
} | |||
|
|||
QgsAdvancedSettingsWidget::~QgsAdvancedSettingsWidget() | |||
{ | |||
} | |||
|
|||
void QgsAdvancedSettingsWidget::apply() | |||
{ | |||
// nothing to do -- mAdvancedSettingsEditor applies changes immediately | |||
} | |||
|
|||
QgsSettingsTree *QgsAdvancedSettingsWidget::settingsTree() | |||
{ | |||
return mAdvancedSettingsEditor; | |||
} | |||
|
|||
// | |||
// QgsAdvancedSettingsOptionsFactory | |||
// | |||
QgsAdvancedSettingsOptionsFactory::QgsAdvancedSettingsOptionsFactory() | |||
: QgsOptionsWidgetFactory( tr( "Advanced" ), QIcon() ) | |||
{ | |||
|
|||
} | |||
|
|||
QIcon QgsAdvancedSettingsOptionsFactory::icon() const | |||
{ | |||
return QgsApplication::getThemeIcon( QStringLiteral( "/mIconWarning.svg" ) ); | |||
} | |||
|
|||
QgsOptionsPageWidget *QgsAdvancedSettingsOptionsFactory::createWidget( QWidget *parent ) const | |||
{ | |||
return new QgsAdvancedSettingsWidget( parent ); | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,65 @@ | |||
/*************************************************************************** | |||
qgsadvancedoptions.h | |||
------------------------- | |||
begin : September 2020 | |||
copyright : (C) 2020 by Nyall Dawson | |||
email : nyall dot dawson at gmail dot com | |||
*************************************************************************** | |||
* * | |||
* This program is free software; you can redistribute it and/or modify * | |||
* it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | |||
* (at your option) any later version. * | |||
* * | |||
***************************************************************************/ | |||
#ifndef QGSADVANCEDOPTIONS_H | |||
#define QGSADVANCEDOPTIONS_H | |||
|
|||
#include "ui_qgsadvancedsettingswidget.h" | |||
#include "qgsoptionswidgetfactory.h" | |||
#include "qgssettings.h" | |||
|
|||
/** | |||
* \ingroup app | |||
* \class QgsAdvancedSettingsWidget | |||
* \brief An options widget showing an advanced settings editor. | |||
* | |||
* \since QGIS 3.16 | |||
*/ | |||
class QgsAdvancedSettingsWidget : public QgsOptionsPageWidget, private Ui::QgsAdvancedSettingsWidgetBase | |||
{ | |||
Q_OBJECT | |||
|
|||
public: | |||
|
|||
/** | |||
* Constructor for QgsAdvancedSettingsWidget with the specified \a parent widget. | |||
*/ | |||
QgsAdvancedSettingsWidget( QWidget *parent ); | |||
~QgsAdvancedSettingsWidget() override; | |||
void apply() override; | |||
|
|||
QgsSettingsTree *settingsTree(); | |||
|
|||
private: | |||
|
|||
QgsSettings mSettings; | |||
|
|||
}; | |||
|
|||
|
|||
class QgsAdvancedSettingsOptionsFactory : public QgsOptionsWidgetFactory | |||
{ | |||
Q_OBJECT | |||
|
|||
public: | |||
|
|||
QgsAdvancedSettingsOptionsFactory(); | |||
|
|||
QIcon icon() const override; | |||
QgsOptionsPageWidget *createWidget( QWidget *parent = nullptr ) const override; | |||
|
|||
}; | |||
|
|||
|
|||
#endif // QGSADVANCEDOPTIONS_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,68 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> | |||
<ui version="4.0"> | |||
<class>QgsAdvancedSettingsWidgetBase</class> | |||
<widget class="QWidget" name="QgsAdvancedSettingsWidgetBase"> | |||
<property name="geometry"> | |||
<rect> | |||
<x>0</x> | |||
<y>0</y> | |||
<width>714</width> | |||
<height>610</height> | |||
</rect> | |||
</property> | |||
<property name="windowTitle"> | |||
<string>Form</string> | |||
</property> | |||
<layout class="QHBoxLayout" name="horizontalLayout"> | |||
<item> | |||
<widget class="QGroupBox" name="groupBox_26"> | |||
<property name="title"> | |||
<string>Advanced Settings Editor</string> | |||
</property> | |||
<layout class="QVBoxLayout" name="verticalLayout_42"> | |||
<item> | |||
<widget class="QWidget" name="mAdvancedSettingsWarning" native="true"> | |||
<layout class="QVBoxLayout" name="verticalLayout_44"> | |||
<item> | |||
<widget class="QLabel" name="label_44"> | |||
<property name="text"> | |||
<string><html><head/><body><p>Changes on this page are dangerous and can break your QGIS installation in various ways. Any change you make is applied immediately, without clicking the <span style=" font-style:italic;">OK</span> button.</p></body></html></string> | |||
</property> | |||
<property name="wordWrap"> | |||
<bool>true</bool> | |||
</property> | |||
</widget> | |||
</item> | |||
<item> | |||
<widget class="QPushButton" name="mAdvancedSettingsEnableButton"> | |||
<property name="text"> | |||
<string>I will be careful, I promise!</string> | |||
</property> | |||
</widget> | |||
</item> | |||
</layout> | |||
</widget> | |||
</item> | |||
<item> | |||
<widget class="QgsSettingsTree" name="mAdvancedSettingsEditor" native="true"> | |||
<property name="visible"> | |||
<bool>false</bool> | |||
</property> | |||
</widget> | |||
</item> | |||
</layout> | |||
</widget> | |||
</item> | |||
</layout> | |||
</widget> | |||
<customwidgets> | |||
<customwidget> | |||
<class>QgsSettingsTree</class> | |||
<extends>QWidget</extends> | |||
<header>qgssettingstree.h</header> | |||
<container>1</container> | |||
</customwidget> | |||
</customwidgets> | |||
<resources/> | |||
<connections/> | |||
</ui> |
Oops, something went wrong.