Skip to content

Commit

Permalink
Make parameter panel a stacked panel
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Mar 24, 2020
1 parent 2ce58cd commit 2913beb
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 37 deletions.
Expand Up @@ -56,7 +56,7 @@ Returns the algorithm running in the dialog.
.. seealso:: :py:func:`setAlgorithm`
%End

void setMainWidget( QWidget *widget /Transfer/ );
void setMainWidget( QgsPanelWidget *widget /Transfer/ );
%Docstring
Sets the main ``widget`` for the dialog, usually a panel for configuring algorithm parameters.

Expand Down
Expand Up @@ -10,7 +10,7 @@



class QgsProcessingParametersWidget : QWidget
class QgsProcessingParametersWidget : QgsPanelWidget
{
%Docstring
A widget which allows users to select the value for the parameters for an algorithm.
Expand Down
6 changes: 4 additions & 2 deletions src/gui/processing/qgsprocessingalgorithmdialogbase.cpp
Expand Up @@ -24,6 +24,7 @@
#include "processing/qgsprocessingalgrunnertask.h"
#include "qgsstringutils.h"
#include "qgsapplication.h"
#include "qgspanelwidget.h"
#include <QToolButton>
#include <QDesktopServices>
#include <QScrollBar>
Expand Down Expand Up @@ -174,15 +175,16 @@ QgsProcessingAlgorithm *QgsProcessingAlgorithmDialogBase::algorithm()
return mAlgorithm.get();
}

void QgsProcessingAlgorithmDialogBase::setMainWidget( QWidget *widget )
void QgsProcessingAlgorithmDialogBase::setMainWidget( QgsPanelWidget *widget )
{
if ( mMainWidget )
{
mMainWidget->deleteLater();
}

mPanelStack->setMainPanel( widget );

mMainWidget = widget;
mTabWidget->widget( 0 )->layout()->addWidget( mMainWidget );
}

QWidget *QgsProcessingAlgorithmDialogBase::mainWidget()
Expand Down
2 changes: 1 addition & 1 deletion src/gui/processing/qgsprocessingalgorithmdialogbase.h
Expand Up @@ -119,7 +119,7 @@ class GUI_EXPORT QgsProcessingAlgorithmDialogBase : public QDialog, private Ui::
* Sets the main \a widget for the dialog, usually a panel for configuring algorithm parameters.
* \see mainWidget()
*/
void setMainWidget( QWidget *widget SIP_TRANSFER );
void setMainWidget( QgsPanelWidget *widget SIP_TRANSFER );

/**
* Returns the main widget for the dialog, usually a panel for configuring algorithm parameters.
Expand Down
2 changes: 1 addition & 1 deletion src/gui/processing/qgsprocessingparameterswidget.cpp
Expand Up @@ -20,7 +20,7 @@
///@cond NOT_STABLE

QgsProcessingParametersWidget::QgsProcessingParametersWidget( const QgsProcessingAlgorithm *algorithm, QWidget *parent )
: QWidget( parent )
: QgsPanelWidget( parent )
, mAlgorithm( algorithm )
{
Q_ASSERT( mAlgorithm );
Expand Down
2 changes: 1 addition & 1 deletion src/gui/processing/qgsprocessingparameterswidget.h
Expand Up @@ -32,7 +32,7 @@ class QgsProcessingParameterDefinition;
* \note Not stable API
* \since QGIS 3.14
*/
class GUI_EXPORT QgsProcessingParametersWidget : public QWidget, private Ui::QgsProcessingParametersWidgetBase
class GUI_EXPORT QgsProcessingParametersWidget : public QgsPanelWidget, private Ui::QgsProcessingParametersWidgetBase
{
Q_OBJECT

Expand Down
4 changes: 2 additions & 2 deletions src/ui/processing/qgsmodeldesignerdialogbase.ui
Expand Up @@ -163,7 +163,7 @@
<x>0</x>
<y>0</y>
<width>256</width>
<height>97</height>
<height>98</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout">
Expand Down Expand Up @@ -253,7 +253,7 @@
<x>0</x>
<y>0</y>
<width>256</width>
<height>153</height>
<height>152</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_6">
Expand Down
38 changes: 11 additions & 27 deletions src/ui/processing/qgsprocessingalgorithmdialogbase.ui
Expand Up @@ -58,6 +58,9 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QgsPanelWidgetStack" name="mPanelStack" native="true"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
Expand Down Expand Up @@ -217,37 +220,18 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>QgsPanelWidgetStack</class>
<extends>QWidget</extends>
<header>qgspanelwidgetstack.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
<include location="../../../images/images.qrc"/>
</resources>
<connections/>
</ui>
8 changes: 7 additions & 1 deletion src/ui/processing/qgsprocessingparameterswidgetbase.ui
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QgsProcessingParametersWidgetBase</class>
<widget class="QWidget" name="QgsProcessingParametersWidgetBase">
<widget class="QgsPanelWidget" name="QgsProcessingParametersWidgetBase">
<property name="geometry">
<rect>
<x>0</x>
Expand Down Expand Up @@ -96,6 +96,12 @@
<header>qgsscrollarea.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QgsPanelWidget</class>
<extends>QWidget</extends>
<header>qgspanelwidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>QgsCollapsibleGroupBox</class>
<extends>QGroupBox</extends>
Expand Down

0 comments on commit 2913beb

Please sign in to comment.