16#ifndef QGSPROCESSINGMULTIPLESELECTIONDIALOG_H
17#define QGSPROCESSINGMULTIPLESELECTIONDIALOG_H
21#include "ui_qgsprocessingmultipleselectiondialogbase.h"
26class QStandardItemModel;
29class QgsProcessingModelChildParameterSource;
30class QgsProcessingModelAlgorithm;
40class GUI_EXPORT QgsProcessingMultipleSelectionPanelWidget :
public QgsPanelWidget,
private Ui::QgsProcessingMultipleSelectionDialogBase
54 QgsProcessingMultipleSelectionPanelWidget(
const QVariantList &availableOptions = QVariantList(),
const QVariantList &selectedOptions = QVariantList(), QWidget *parent
SIP_TRANSFERTHIS =
nullptr );
60 void setValueFormatter(
const std::function<QString(
const QVariant & )> &formatter );
62 void setValueFormatter( SIP_PYCALLABLE );
65 Py_BEGIN_ALLOW_THREADS
67 sipCpp->setValueFormatter( [a0](
const QVariant &v ) -> QString {
70 PyObject *s = sipCallMethod( NULL, a0,
"D", &v, sipType_QVariant, NULL );
73 QString *t1 =
reinterpret_cast<QString *
>( sipConvertToType( s, sipType_QString, 0, SIP_NOT_NONE, &state, &sipIsError ) );
74 if ( sipIsError == 0 )
78 sipReleaseType( t1, sipType_QString, state );
91 QVariantList selectedOptions()
const;
96 QDialogButtonBox *buttonBox() {
return mButtonBox; }
103 void acceptClicked();
108 void selectionChanged();
114 void addOption(
const QVariant &value,
const QString &title,
bool selected,
bool updateExistingTitle =
false );
117 QListView *listView()
const {
return mSelectionList; }
120 QStandardItemModel *mModel =
nullptr;
122 std::function<QString(
const QVariant & )> mValueFormatter;
124 void dragEnterEvent( QDragEnterEvent *event )
override;
125 void dropEvent( QDropEvent *event )
override;
129 void selectAll(
bool checked );
130 void toggleSelection();
133 QPushButton *mButtonSelectAll =
nullptr;
134 QPushButton *mButtonClearSelection =
nullptr;
135 QPushButton *mButtonToggleSelection =
nullptr;
137 QList<QStandardItem *> currentItems();
139 void populateList(
const QVariantList &availableOptions,
const QVariantList &selectedOptions );
141 friend class TestProcessingGui;
147 QList<int> existingMapLayerFromMimeData(
const QMimeData *data )
const;
157class GUI_EXPORT QgsProcessingMultipleSelectionDialog :
public QDialog
171 QgsProcessingMultipleSelectionDialog(
const QVariantList &availableOptions = QVariantList(),
const QVariantList &selectedOptions = QVariantList(), QWidget *parent
SIP_TRANSFERTHIS =
nullptr, Qt::WindowFlags flags = Qt::WindowFlags() );
178 void setValueFormatter(
const std::function<QString(
const QVariant & )> &formatter );
180 void setValueFormatter( SIP_PYCALLABLE );
183 Py_BEGIN_ALLOW_THREADS
185 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;
212 QgsProcessingMultipleSelectionPanelWidget *mWidget =
nullptr;
222class GUI_EXPORT QgsProcessingMultipleInputPanelWidget :
public QgsProcessingMultipleSelectionPanelWidget
230 QgsProcessingMultipleInputPanelWidget(
const QgsProcessingParameterMultipleLayers *parameter,
const QVariantList &selectedOptions,
const QList<QgsProcessingModelChildParameterSource> &modelSources, QgsProcessingModelAlgorithm *model =
nullptr, QWidget *parent
SIP_TRANSFERTHIS =
nullptr );
242 static QStringList compatibleUrisFromMimeData(
244 const QMimeData *data,
254 void dragEnterEvent( QDragEnterEvent *event )
override;
255 void dropEvent( QDropEvent *event )
override;
263 void populateFromProject(
QgsProject *project );
275class GUI_EXPORT QgsProcessingMultipleInputDialog :
public QDialog
286 QgsProcessingMultipleInputDialog(
const QgsProcessingParameterMultipleLayers *parameter,
const QVariantList &selectedOptions,
const QList<QgsProcessingModelChildParameterSource> &modelSources, QgsProcessingModelAlgorithm *model =
nullptr, QWidget *parent
SIP_TRANSFERTHIS =
nullptr, Qt::WindowFlags flags = Qt::WindowFlags() );
291 QVariantList selectedOptions()
const;
299 QgsProcessingMultipleInputPanelWidget *mWidget =
nullptr;
QList< QgsMimeDataUtils::Uri > UriList
A parameter for processing algorithms which accepts multiple map layers.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...