mirror of
https://github.com/qgis/QGIS.git
synced 2025-05-03 00:03:15 -04:00
A new widget which handles parameter values for child algorithms within a model. Instead of the previous approach of requiring individual widget wrappers to handle creation of a suitable model widget, we do all this automatically for them. This widget uses a stacked widget with a toolbutton to select the parameter's source, instead of the previous combo box approach (which didn't scale well for large models). I.e. users select first whether the value is taken from a static value, a model input, or an output from a different child algorithm. The widget then changes appearance and behavior based on this choice. Additionally, a new option is present for all parameters of using a "precalculated expression". This expression is evaluated once before the child algorithm is executed and used during the execution of that algorithm.
66 lines
2.5 KiB
C++
66 lines
2.5 KiB
C++
/***************************************************************************
|
|
qgsprocessingwidgetwrapperimpl.h
|
|
---------------------
|
|
begin : August 2018
|
|
copyright : (C) 2018 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 QGSPROCESSINGWIDGETWRAPPERIMPL_H
|
|
#define QGSPROCESSINGWIDGETWRAPPERIMPL_H
|
|
|
|
#define SIP_NO_FILE
|
|
#include "qgsprocessingwidgetwrapper.h"
|
|
|
|
class QCheckBox;
|
|
class QComboBox;
|
|
|
|
///@cond PRIVATE
|
|
|
|
class GUI_EXPORT QgsProcessingBooleanWidgetWrapper : public QgsAbstractProcessingParameterWidgetWrapper, public QgsProcessingParameterWidgetFactoryInterface
|
|
{
|
|
public:
|
|
|
|
QgsProcessingBooleanWidgetWrapper( const QgsProcessingParameterDefinition *parameter = nullptr,
|
|
QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QWidget *parent = nullptr );
|
|
|
|
// QgsProcessingParameterWidgetFactoryInterface
|
|
QString parameterType() const override;
|
|
QgsAbstractProcessingParameterWidgetWrapper *createWidgetWrapper( const QgsProcessingParameterDefinition *parameter, QgsProcessingGui::WidgetType type ) override;
|
|
|
|
// QgsProcessingParameterWidgetWrapper interface
|
|
QWidget *createWidget() override SIP_FACTORY;
|
|
QLabel *createLabel() override SIP_FACTORY;
|
|
void setWidgetValue( const QVariant &value, const QgsProcessingContext &context ) override;
|
|
QVariant value() const override;
|
|
|
|
protected:
|
|
|
|
protected:
|
|
|
|
QStringList compatibleParameterTypes() const override;
|
|
|
|
QStringList compatibleOutputTypes() const override;
|
|
|
|
QList< int > compatibleDataTypes() const override;
|
|
|
|
private:
|
|
|
|
QCheckBox *mCheckBox = nullptr;
|
|
QComboBox *mComboBox = nullptr;
|
|
};
|
|
|
|
///@endcond PRIVATE
|
|
|
|
#endif // QGSPROCESSINGWIDGETWRAPPERIMPL_H
|