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
55 QgsProcessingMultipleSelectionPanelWidget(
const QVariantList &availableOptions = QVariantList(),
56 const QVariantList &selectedOptions = QVariantList(),
63 void setValueFormatter(
const std::function< QString(
const QVariant & )> &
formatter );
65 void setValueFormatter( SIP_PYCALLABLE );
68 Py_BEGIN_ALLOW_THREADS
70 sipCpp->setValueFormatter( [a0](
const QVariant &v )->QString
74 PyObject *s = sipCallMethod( NULL, a0,
"D", &v, sipType_QVariant, NULL );
77 QString *t1 =
reinterpret_cast<QString *
>( sipConvertToType( s, sipType_QString, 0, SIP_NOT_NONE, &state, &sipIsError ) );
78 if ( sipIsError == 0 )
82 sipReleaseType( t1, sipType_QString, state );
95 QVariantList selectedOptions()
const;
100 QDialogButtonBox *buttonBox() {
return mButtonBox; }
107 void acceptClicked();
112 void selectionChanged();
119 void addOption(
const QVariant &value,
const QString &title,
bool selected,
bool updateExistingTitle =
false );
122 QListView *listView()
const {
return mSelectionList; }
125 QStandardItemModel *mModel =
nullptr;
127 std::function< QString(
const QVariant & )> mValueFormatter;
129 void dragEnterEvent( QDragEnterEvent *event )
override;
130 void dropEvent( QDropEvent *event )
override;
134 void selectAll(
bool checked );
135 void toggleSelection();
139 QPushButton *mButtonSelectAll =
nullptr;
140 QPushButton *mButtonClearSelection =
nullptr;
141 QPushButton *mButtonToggleSelection =
nullptr;
143 QList< QStandardItem * > currentItems();
145 void populateList(
const QVariantList &availableOptions,
const QVariantList &selectedOptions );
147 friend class TestProcessingGui;
153 QList<int> existingMapLayerFromMimeData(
const QMimeData *data )
const;
163class GUI_EXPORT QgsProcessingMultipleSelectionDialog :
public QDialog
178 QgsProcessingMultipleSelectionDialog(
const QVariantList &availableOptions = QVariantList(),
179 const QVariantList &selectedOptions = QVariantList(),
180 QWidget *parent
SIP_TRANSFERTHIS =
nullptr, Qt::WindowFlags flags = Qt::WindowFlags() );
187 void setValueFormatter(
const std::function< QString(
const QVariant & )> &
formatter );
189 void setValueFormatter( SIP_PYCALLABLE );
192 Py_BEGIN_ALLOW_THREADS
194 sipCpp->setValueFormatter( [a0](
const QVariant &v )->QString
198 PyObject *s = sipCallMethod( NULL, a0,
"D", &v, sipType_QVariant, NULL );
201 QString *t1 =
reinterpret_cast<QString *
>( sipConvertToType( s, sipType_QString, 0, SIP_NOT_NONE, &state, &sipIsError ) );
202 if ( sipIsError == 0 )
204 res = QString( *t1 );
206 sipReleaseType( t1, sipType_QString, state );
219 QVariantList selectedOptions()
const;
223 QgsProcessingMultipleSelectionPanelWidget *mWidget =
nullptr;
234class GUI_EXPORT QgsProcessingMultipleInputPanelWidget :
public QgsProcessingMultipleSelectionPanelWidget
244 const QVariantList &selectedOptions,
245 const QList< QgsProcessingModelChildParameterSource > &modelSources,
246 QgsProcessingModelAlgorithm *model =
nullptr,
259 static QStringList compatibleUrisFromMimeData(
261 const QMimeData *data,
270 void dragEnterEvent( QDragEnterEvent *event )
override;
271 void dropEvent( QDropEvent *event )
override;
280 void populateFromProject(
QgsProject *project );
292class GUI_EXPORT QgsProcessingMultipleInputDialog :
public QDialog
305 const QVariantList &selectedOptions,
306 const QList< QgsProcessingModelChildParameterSource > &modelSources,
307 QgsProcessingModelAlgorithm *model =
nullptr,
308 QWidget *parent
SIP_TRANSFERTHIS =
nullptr, Qt::WindowFlags flags = Qt::WindowFlags() );
313 QVariantList selectedOptions()
const;
322 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,...