16 #ifndef QGSPROCESSINGMULTIPLESELECTIONDIALOG_H
17 #define QGSPROCESSINGMULTIPLESELECTIONDIALOG_H
21 #include "ui_qgsprocessingmultipleselectiondialogbase.h"
25 class QStandardItemModel;
28 class QgsProcessingModelChildParameterSource;
29 class QgsProcessingModelAlgorithm;
39 class GUI_EXPORT QgsProcessingMultipleSelectionPanelWidget :
public QgsPanelWidget,
private Ui::QgsProcessingMultipleSelectionDialogBase
54 QgsProcessingMultipleSelectionPanelWidget(
const QVariantList &availableOptions = QVariantList(),
55 const QVariantList &selectedOptions = QVariantList(),
62 void setValueFormatter(
const std::function< QString(
const QVariant & )> &
formatter );
64 void setValueFormatter( SIP_PYCALLABLE );
67 Py_BEGIN_ALLOW_THREADS
69 sipCpp->setValueFormatter( [a0](
const QVariant &v )->QString
73 PyObject *s = sipCallMethod( NULL, a0,
"D", &v, sipType_QVariant, NULL );
76 QString *t1 =
reinterpret_cast<QString *
>( sipConvertToType( s, sipType_QString, 0, SIP_NOT_NONE, &state, &sipIsError ) );
77 if ( sipIsError == 0 )
81 sipReleaseType( t1, sipType_QString, state );
94 QVariantList selectedOptions()
const;
99 QDialogButtonBox *buttonBox() {
return mButtonBox; }
106 void acceptClicked();
111 void selectionChanged();
118 void addOption(
const QVariant &value,
const QString &title,
bool selected,
bool updateExistingTitle =
false );
121 QListView *listView()
const {
return mSelectionList; }
124 QStandardItemModel *mModel =
nullptr;
126 std::function< QString(
const QVariant & )> mValueFormatter;
129 void selectAll(
bool checked );
130 void toggleSelection();
134 QPushButton *mButtonSelectAll =
nullptr;
135 QPushButton *mButtonClearSelection =
nullptr;
136 QPushButton *mButtonToggleSelection =
nullptr;
138 QList< QStandardItem * > currentItems();
141 void populateList(
const QVariantList &availableOptions,
const QVariantList &selectedOptions );
143 friend class TestProcessingGui;
153 class GUI_EXPORT QgsProcessingMultipleSelectionDialog :
public QDialog
168 QgsProcessingMultipleSelectionDialog(
const QVariantList &availableOptions = QVariantList(),
169 const QVariantList &selectedOptions = QVariantList(),
170 QWidget *parent
SIP_TRANSFERTHIS =
nullptr, Qt::WindowFlags flags = Qt::WindowFlags() );
177 void setValueFormatter(
const std::function< QString(
const QVariant & )> &
formatter );
179 void setValueFormatter( SIP_PYCALLABLE );
182 Py_BEGIN_ALLOW_THREADS
184 sipCpp->setValueFormatter( [a0](
const QVariant &v )->QString
188 PyObject *s = sipCallMethod( NULL, a0,
"D", &v, sipType_QVariant, NULL );
191 QString *t1 =
reinterpret_cast<QString *
>( sipConvertToType( s, sipType_QString, 0, SIP_NOT_NONE, &state, &sipIsError ) );
192 if ( sipIsError == 0 )
194 res = QString( *t1 );
196 sipReleaseType( t1, sipType_QString, state );
209 QVariantList selectedOptions()
const;
213 QgsProcessingMultipleSelectionPanelWidget *mWidget =
nullptr;
224 class GUI_EXPORT QgsProcessingMultipleInputPanelWidget :
public QgsProcessingMultipleSelectionPanelWidget
234 const QVariantList &selectedOptions,
235 const QList< QgsProcessingModelChildParameterSource > &modelSources,
236 QgsProcessingModelAlgorithm *model =
nullptr,
251 void populateFromProject(
QgsProject *project );
263 class GUI_EXPORT QgsProcessingMultipleInputDialog :
public QDialog
276 const QVariantList &selectedOptions,
277 const QList< QgsProcessingModelChildParameterSource > &modelSources,
278 QgsProcessingModelAlgorithm *model =
nullptr,
279 QWidget *parent
SIP_TRANSFERTHIS =
nullptr, Qt::WindowFlags flags = Qt::WindowFlags() );
284 QVariantList selectedOptions()
const;
293 QgsProcessingMultipleInputPanelWidget *mWidget =
nullptr;
A parameter for processing algorithms which accepts multiple map layers.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...