16#ifndef QGSPROCESSINGMULTIPLESELECTIONDIALOG_H
17#define QGSPROCESSINGMULTIPLESELECTIONDIALOG_H
19#include "ui_qgsprocessingmultipleselectiondialogbase.h"
28class QStandardItemModel;
31class QgsProcessingModelChildParameterSource;
32class QgsProcessingModelAlgorithm;
42class GUI_EXPORT QgsProcessingMultipleSelectionPanelWidget :
public QgsPanelWidget,
private Ui::QgsProcessingMultipleSelectionDialogBase
56 QgsProcessingMultipleSelectionPanelWidget(
const QVariantList &availableOptions = QVariantList(),
const QVariantList &selectedOptions = QVariantList(), QWidget *parent
SIP_TRANSFERTHIS =
nullptr );
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 {
72 PyObject *s = sipCallMethod( NULL, a0,
"D", &v, sipType_QVariant, NULL );
75 QString *t1 =
reinterpret_cast<QString *
>( sipConvertToType( s, sipType_QString, 0, SIP_NOT_NONE, &state, &sipIsError ) );
76 if ( sipIsError == 0 )
80 sipReleaseType( t1, sipType_QString, state );
93 QVariantList selectedOptions()
const;
98 QDialogButtonBox *buttonBox() {
return mButtonBox; }
105 void acceptClicked();
110 void selectionChanged();
119 void addOption(
const QVariant &value,
const QString &title,
bool selected,
bool updateExistingTitle =
false, QIcon optionalIconDecoration = QIcon(),
const QString &tooltip = QString() );
121 QListView *listView()
const {
return mSelectionList; }
124 QStandardItemModel *mModel =
nullptr;
126 std::function<QString(
const QVariant & )> mValueFormatter;
128 void dragEnterEvent( QDragEnterEvent *event )
override;
129 void dropEvent( QDropEvent *event )
override;
133 void selectAll(
bool checked );
134 void toggleSelection();
137 QPushButton *mButtonSelectAll =
nullptr;
138 QPushButton *mButtonClearSelection =
nullptr;
139 QPushButton *mButtonToggleSelection =
nullptr;
141 QList<QStandardItem *> currentItems();
143 void populateList(
const QVariantList &availableOptions,
const QVariantList &selectedOptions );
145 friend class TestProcessingGui;
151 QList<int> existingMapLayerFromMimeData(
const QMimeData *data )
const;
161class GUI_EXPORT QgsProcessingMultipleSelectionDialog :
public QDialog
175 QgsProcessingMultipleSelectionDialog(
176 const QVariantList &availableOptions = QVariantList(),
const QVariantList &selectedOptions = QVariantList(), QWidget *parent
SIP_TRANSFERTHIS =
nullptr, Qt::WindowFlags flags = Qt::WindowFlags()
184 void setValueFormatter(
const std::function<QString(
const QVariant & )> &formatter );
186 void setValueFormatter( SIP_PYCALLABLE );
189 Py_BEGIN_ALLOW_THREADS
191 sipCpp->setValueFormatter( [a0](
const QVariant &v ) -> QString {
194 PyObject *s = sipCallMethod( NULL, a0,
"D", &v, sipType_QVariant, NULL );
197 QString *t1 =
reinterpret_cast<QString *
>( sipConvertToType( s, sipType_QString, 0, SIP_NOT_NONE, &state, &sipIsError ) );
198 if ( sipIsError == 0 )
200 res = QString( *t1 );
202 sipReleaseType( t1, sipType_QString, state );
215 QVariantList selectedOptions()
const;
218 QgsProcessingMultipleSelectionPanelWidget *mWidget =
nullptr;
228class GUI_EXPORT QgsProcessingMultipleInputPanelWidget :
public QgsProcessingMultipleSelectionPanelWidget
236 QgsProcessingMultipleInputPanelWidget(
237 const QgsProcessingParameterMultipleLayers *parameter,
238 const QVariantList &selectedOptions,
239 const QList<QgsProcessingModelChildParameterSource> &modelSources,
240 QgsProcessingModelAlgorithm *model =
nullptr,
247 void setProject( QgsProject *project );
254 static QStringList compatibleUrisFromMimeData(
const QgsProcessingParameterMultipleLayers *parameter,
const QMimeData *data,
const QgsMimeDataUtils::UriList &skipUrls )
SIP_SKIP;
262 void dragEnterEvent( QDragEnterEvent *event )
override;
263 void dropEvent( QDropEvent *event )
override;
271 void populateFromProject( QgsProject *project );
273 const QgsProcessingParameterMultipleLayers *mParameter =
nullptr;
283class GUI_EXPORT QgsProcessingMultipleInputDialog :
public QDialog
294 QgsProcessingMultipleInputDialog(
295 const QgsProcessingParameterMultipleLayers *parameter,
296 const QVariantList &selectedOptions,
297 const QList<QgsProcessingModelChildParameterSource> &modelSources,
298 QgsProcessingModelAlgorithm *model =
nullptr,
300 Qt::WindowFlags flags = Qt::WindowFlags()
306 QVariantList selectedOptions()
const;
311 void setProject( QgsProject *project );
314 QgsProcessingMultipleInputPanelWidget *mWidget =
nullptr;
QList< QgsMimeDataUtils::Uri > UriList