Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[processing] Move base class of ParametersPanel to c++
- Loading branch information
1 parent
41fb4df
commit 3d6e496
Showing
8 changed files
with
349 additions
and
55 deletions.
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
python/gui/auto_generated/processing/qgsprocessingparameterswidget.sip.in
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/processing/qgsprocessingparameterswidget.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
|
||
class QgsProcessingParametersWidget : QWidget | ||
{ | ||
%Docstring | ||
A widget which allows users to select the value for the parameters for an algorithm. | ||
|
||
.. note:: | ||
|
||
Not stable API | ||
|
||
.. versionadded:: 3.14 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgsprocessingparameterswidget.h" | ||
%End | ||
public: | ||
|
||
QgsProcessingParametersWidget( const QgsProcessingAlgorithm *algorithm, QWidget *parent /TransferThis/ = 0 ); | ||
%Docstring | ||
Constructor for QgsProcessingParametersWidget, for the specified ``algorithm``. | ||
%End | ||
|
||
const QgsProcessingAlgorithm *algorithm() const; | ||
|
||
protected: | ||
|
||
virtual void initWidgets(); | ||
|
||
void addParameterWidget( const QgsProcessingParameterDefinition *parameter, QWidget *widget /Transfer/ ); | ||
void addParameterLabel( const QgsProcessingParameterDefinition *parameter, QWidget *label /Transfer/ ); | ||
|
||
void addOutputLabel( QWidget *label /Transfer/ ); | ||
void addOutputWidget( QWidget *widget /Transfer/ ); | ||
|
||
QLayout *mainLayout(); | ||
|
||
|
||
}; | ||
|
||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/gui/processing/qgsprocessingparameterswidget.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
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
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
/*************************************************************************** | ||
qgsprocessingparameterswidget.cpp | ||
------------------------------------ | ||
Date : March 2020 | ||
Copyright : (C) 2020 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 "qgsprocessingparameterswidget.h" | ||
#include "qgsprocessingalgorithm.h" | ||
#include "qgsprocessingparameters.h" | ||
|
||
///@cond NOT_STABLE | ||
|
||
QgsProcessingParametersWidget::QgsProcessingParametersWidget( const QgsProcessingAlgorithm *algorithm, QWidget *parent ) | ||
: QWidget( parent ) | ||
, mAlgorithm( algorithm ) | ||
{ | ||
Q_ASSERT( mAlgorithm ); | ||
|
||
setupUi( this ); | ||
|
||
grpAdvanced->hide(); | ||
scrollAreaWidgetContents->setContentsMargins( 4, 4, 4, 4 ); | ||
} | ||
|
||
const QgsProcessingAlgorithm *QgsProcessingParametersWidget::algorithm() const | ||
{ | ||
return mAlgorithm; | ||
} | ||
|
||
void QgsProcessingParametersWidget::initWidgets() | ||
{ | ||
// if there are advanced parameters — show corresponding groupbox | ||
const QgsProcessingParameterDefinitions defs = mAlgorithm->parameterDefinitions(); | ||
for ( const QgsProcessingParameterDefinition *param : defs ) | ||
{ | ||
if ( param->flags() & QgsProcessingParameterDefinition::FlagAdvanced ) | ||
{ | ||
grpAdvanced->show(); | ||
break; | ||
} | ||
} | ||
} | ||
|
||
void QgsProcessingParametersWidget::addParameterWidget( const QgsProcessingParameterDefinition *parameter, QWidget *widget ) | ||
{ | ||
if ( parameter->flags() & QgsProcessingParameterDefinition::FlagAdvanced ) | ||
mAdvancedGroupLayout->addWidget( widget ); | ||
else | ||
mScrollAreaLayout->insertWidget( mScrollAreaLayout->count() - 2, widget ); | ||
} | ||
|
||
void QgsProcessingParametersWidget::addParameterLabel( const QgsProcessingParameterDefinition *parameter, QWidget *label ) | ||
{ | ||
if ( parameter->flags() & QgsProcessingParameterDefinition::FlagAdvanced ) | ||
mAdvancedGroupLayout->addWidget( label ); | ||
else | ||
mScrollAreaLayout->insertWidget( mScrollAreaLayout->count() - 2, label ); | ||
} | ||
|
||
void QgsProcessingParametersWidget::addOutputLabel( QWidget *label ) | ||
{ | ||
mScrollAreaLayout->insertWidget( mScrollAreaLayout->count() - 1, label ); | ||
} | ||
|
||
void QgsProcessingParametersWidget::addOutputWidget( QWidget *widget ) | ||
{ | ||
mScrollAreaLayout->insertWidget( mScrollAreaLayout->count() - 1, widget ); | ||
} | ||
|
||
QLayout *QgsProcessingParametersWidget::mainLayout() | ||
{ | ||
return mScrollAreaLayout; | ||
} | ||
|
||
///@endcond |
Oops, something went wrong.