1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682
|
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/processing/qgsprocessingwidgetwrapper.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
class QgsProcessingContextGenerator
{
%Docstring(signature="appended")
An interface for objects which can create Processing contexts.
.. versionadded:: 3.4
%End
%TypeHeaderCode
#include "qgsprocessingwidgetwrapper.h"
%End
public:
virtual QgsProcessingContext *processingContext() = 0;
%Docstring
This method needs to be reimplemented in all classes which implement
this interface and return a Processing context.
Note that ownership of the context is not transferred - it is intended
that subclasses return a pointer to a context which they have already
created and own.
%End
virtual ~QgsProcessingContextGenerator();
};
class QgsProcessingParametersGenerator
{
%Docstring(signature="appended")
An interface for objects which can create sets of parameter values for
processing algorithms.
.. versionadded:: 3.14
%End
%TypeHeaderCode
#include "qgsprocessingwidgetwrapper.h"
%End
public:
enum class Flag
{
SkipDefaultValueParameters,
};
typedef QFlags<QgsProcessingParametersGenerator::Flag> Flags;
virtual QVariantMap createProcessingParameters( QgsProcessingParametersGenerator::Flags flags = QgsProcessingParametersGenerator::Flags() ) = 0;
%Docstring
This method needs to be reimplemented in all classes which implement
this interface and return a algorithm parameters.
Since QGIS 3.24 the optional ``flags`` argument can be used to control
the behavior of the parameter generation.
%End
virtual ~QgsProcessingParametersGenerator();
};
QFlags<QgsProcessingParametersGenerator::Flag> operator|(QgsProcessingParametersGenerator::Flag f1, QFlags<QgsProcessingParametersGenerator::Flag> f2);
class QgsProcessingParameterWidgetContext
{
%Docstring(signature="appended")
Contains settings which reflect the context in which a Processing
parameter widget is shown, e.g., the parent model algorithm, a linked
map canvas, and other relevant information which allows the widget to
fine-tune its behavior.
.. versionadded:: 3.4
%End
%TypeHeaderCode
#include "qgsprocessingwidgetwrapper.h"
%End
public:
QgsProcessingParameterWidgetContext();
void setMapCanvas( QgsMapCanvas *canvas );
%Docstring
Sets the map ``canvas`` associated with the widget. This allows the
widget to retrieve the current map scale and other properties from the
canvas.
.. seealso:: :py:func:`mapCanvas`
%End
QgsMapCanvas *mapCanvas() const;
%Docstring
Returns the map canvas associated with the widget.
.. seealso:: :py:func:`setMapCanvas`
%End
void setMessageBar( QgsMessageBar *bar );
%Docstring
Sets the message ``bar`` associated with the widget. This allows the
widget to push feedback messages to the user.
.. seealso:: :py:func:`messageBar`
.. versionadded:: 3.12
%End
QgsMessageBar *messageBar() const;
%Docstring
Returns the message bar associated with the widget. This allows the
widget to push feedback messages to the user.
.. seealso:: :py:func:`setMessageBar`
.. versionadded:: 3.12
%End
void setBrowserModel( QgsBrowserGuiModel *model );
%Docstring
Sets the browser ``model`` associated with the widget. This will usually
be the shared app instance of the browser model
.. seealso:: :py:func:`browserModel`
.. versionadded:: 3.14
%End
QgsBrowserGuiModel *browserModel() const;
%Docstring
Returns the browser model associated with the widget.
.. seealso:: :py:func:`setBrowserModel`
.. versionadded:: 3.12
%End
void setProject( QgsProject *project );
%Docstring
Sets the ``project`` associated with the widget. This allows the widget
to retrieve the map layers and other properties from the correct
project.
.. seealso:: :py:func:`project`
.. versionadded:: 3.8
%End
QgsProject *project() const;
%Docstring
Returns the project associated with the widget.
.. seealso:: :py:func:`setProject`
%End
QgsProcessingModelAlgorithm *model() const;
%Docstring
Returns the model which the parameter widget is associated with.
.. seealso:: :py:func:`setModel`
.. seealso:: :py:func:`modelChildAlgorithmId`
%End
void setModel( QgsProcessingModelAlgorithm *model );
%Docstring
Sets the ``model`` which the parameter widget is associated with.
.. seealso:: :py:func:`model`
.. seealso:: :py:func:`setModelChildAlgorithmId`
%End
QString modelChildAlgorithmId() const;
%Docstring
Returns the child algorithm ID within the model which the parameter
widget is associated with.
.. seealso:: :py:func:`setModelChildAlgorithmId`
.. seealso:: :py:func:`model`
%End
void setModelChildAlgorithmId( const QString &id );
%Docstring
Sets the child algorithm ``id`` within the model which the parameter
widget is associated with.
.. seealso:: :py:func:`modelChildAlgorithmId`
.. seealso:: :py:func:`setModel`
%End
QgsMapLayer *activeLayer() const;
%Docstring
Returns the current active layer.
.. seealso:: :py:func:`setActiveLayer`
.. versionadded:: 3.14
%End
void setActiveLayer( QgsMapLayer *layer );
%Docstring
Sets the current active ``layer``.
.. seealso:: :py:func:`activeLayer`
.. versionadded:: 3.14
%End
};
class QgsAbstractProcessingParameterWidgetWrapper : QObject, QgsExpressionContextGenerator
{
%Docstring(signature="appended")
A widget wrapper for Processing parameter value widgets.
Widget wrappers are used to create widgets for individual Processing
parameters, and handle retrieving and setting the current value for
those parameters.
Widget wrappers can be created for different dialog types, allowing
different appearance and behavior of widgets depending on whether they
are being created for use in a standard algorithm dialog, a batch
processing dialog, or a modeler dialog.
Individual widget wrappers are not usually created directly, instead
they are constructed through the central registry, via calls to
:py:func:`QgsGui.processingGuiRegistry()`->:py:func:`~createParameterWidgetWrapper`.
.. versionadded:: 3.4
%End
%TypeHeaderCode
#include "qgsprocessingwidgetwrapper.h"
%End
public:
QgsAbstractProcessingParameterWidgetWrapper( const QgsProcessingParameterDefinition *parameter = 0, QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QObject *parent /TransferThis/ = 0 );
%Docstring
Constructor for QgsAbstractProcessingParameterWidgetWrapper, for the
specified ``parameter`` definition and dialog ``type``.
%End
QgsProcessingGui::WidgetType type() const;
%Docstring
Returns the dialog type for which widgets and labels will be created by
this wrapper.
%End
virtual void setWidgetContext( const QgsProcessingParameterWidgetContext &context );
%Docstring
Sets the ``context`` in which the Processing parameter widget is shown,
e.g., the parent model algorithm, a linked map canvas, and other
relevant information which allows the widget to fine-tune its behavior.
Subclasses should take care to call the base class method when
reimplementing this method.
.. seealso:: :py:func:`widgetContext`
%End
const QgsProcessingParameterWidgetContext &widgetContext() const;
%Docstring
Returns the context in which the Processing parameter widget is shown,
e.g., the parent model algorithm, a linked map canvas, and other
relevant information which allows the widget to fine-tune its behavior.
.. seealso:: :py:func:`setWidgetContext`
%End
QWidget *createWrappedWidget( QgsProcessingContext &context ) /Factory/;
%Docstring
Creates and return a new wrapped widget which allows customization of
the parameter's value.
The caller takes ownership of the returned widget. The wrapped widget
can be retrieved at a later stage by calling
:py:func:`~QgsAbstractProcessingParameterWidgetWrapper.wrappedWidget`.
The supplied ``context`` is used while initializing the widget to the
parameter's default value.
.. seealso:: :py:func:`createWrappedLabel`
%End
QLabel *createWrappedLabel() /Factory/;
%Docstring
Creates and returns a new label to accompany widgets created by the
wrapper.
The caller takes ownership of the returned label. Some parameter type
and dialog type combinations will return ``None`` for this method. If
``None`` is returned, then no label should be shown for the parameter's
widget (i.e. the label is embedded inside the widget itself).
The wrapped label can be retrieved at a later stage by calling
:py:func:`~QgsAbstractProcessingParameterWidgetWrapper.wrappedLabel`.
.. seealso:: :py:func:`createWrappedWidget`
%End
QWidget *wrappedWidget();
%Docstring
Returns the current wrapped widget, if any.
.. seealso:: :py:func:`createWrappedWidget`
%End
QLabel *wrappedLabel();
%Docstring
Returns the current wrapped label, if any.
.. seealso:: :py:func:`createWrappedLabel`
%End
const QgsProcessingParameterDefinition *parameterDefinition() const;
%Docstring
Returns the parameter definition associated with this wrapper.
%End
%Property( name = param, get = parameterDefinition )
void setParameterValue( const QVariant &value, QgsProcessingContext &context );
%Docstring
Sets the current ``value`` for the parameter.
The ``context`` argument is used to specify the wider Processing context
which the current value is associated with.
.. seealso:: :py:func:`parameterValue`
%End
QVariant parameterValue() const;
%Docstring
Returns the current value of the parameter.
.. seealso:: :py:func:`setParameterValue`
%End
virtual QVariantMap customProperties() const;
%Docstring
Returns any custom properties set by the wrapper.
%End
virtual void registerProcessingContextGenerator( QgsProcessingContextGenerator *generator );
%Docstring
Registers a Processing context ``generator`` class that will be used to
retrieve a Processing context for the wrapper when required.
Care must be taken to call the base class implementation if overwrite
this method.
%End
void registerProcessingParametersGenerator( QgsProcessingParametersGenerator *generator );
%Docstring
Registers a Processing parameters ``generator`` class that will be used
to retrieve algorithm parameters for the wrapper when required (e.g.
when a wrapper needs access to other parameter's values).
.. versionadded:: 3.14
%End
virtual void postInitialize( const QList<QgsAbstractProcessingParameterWidgetWrapper *> &wrappers );
%Docstring
Called after all wrappers have been created within a particular dialog
or context, allowing the wrapper to connect to the wrappers of other,
related parameters.
%End
virtual int stretch() const;
%Docstring
Returns the Qt layout "stretch" factor to use when adding this widget to
a layout.
The default implementation returns 0.
.. versionadded:: 3.14
%End
virtual QgsExpressionContext createExpressionContext() const;
virtual void setDialog( QDialog *dialog );
%Docstring
Sets the parent ``dialog`` in which the wrapper is shown.
.. versionadded:: 3.8
%End
signals:
void widgetValueHasChanged( QgsAbstractProcessingParameterWidgetWrapper *wrapper );
%Docstring
Emitted whenever the parameter value (as defined by the wrapped widget)
is changed.
%End
protected:
virtual QWidget *createWidget() = 0 /Factory/;
%Docstring
Creates a new widget which allows customization of the parameter's
value.
The caller takes ownership of the returned widget.
.. seealso:: :py:func:`createLabel`
%End
virtual QLabel *createLabel() /Factory/;
%Docstring
Creates a new label to accompany widgets created by the wrapper.
The caller takes ownership of the returned label. Some parameter type
and dialog type combinations will return ``None`` for this method. If
``None`` is returned, then no label should be shown for the parameter's
widget (i.e. the label is embedded inside the widget itself).
.. seealso:: :py:func:`createWidget`
%End
virtual void setWidgetValue( const QVariant &value, QgsProcessingContext &context ) = 0;
%Docstring
Sets the current ``value`` for the parameter to show in the widget.
The ``context`` argument is used to specify the wider Processing context
which the current value is associated with.
.. seealso:: :py:func:`widgetValue`
%End
virtual QVariant widgetValue() const = 0;
%Docstring
Returns the current value of the parameter.
.. seealso:: :py:func:`setWidgetValue`
%End
virtual const QgsVectorLayer *linkedVectorLayer() const;
%Docstring
Returns the optional vector layer associated with this widget wrapper,
or ``None`` if no vector layer is applicable.
This is used to correctly generate expression contexts within the GUI,
e.g. to allow expression buttons and property override buttons to
correctly show the appropriate vector layer fields.
.. versionadded:: 3.6
%End
protected:
};
class QgsProcessingParameterWidgetFactoryInterface
{
%Docstring(signature="appended")
An interface for Processing widget wrapper factories.
Widget wrapper factories allow creation of
:py:class:`QgsAbstractProcessingParameterWidgetWrapper` objects. They
are centrally managed by :py:class:`QgsProcessingGuiRegistry`. Usually,
individual factories are not directly utilized, rather the
:py:func:`QgsGui.processingGuiRegistry()`->:py:func:`~createParameterWidgetWrapper`
method is used to create widget wrappers.
.. versionadded:: 3.4
%End
%TypeHeaderCode
#include "qgsprocessingwidgetwrapper.h"
%End
public:
virtual ~QgsProcessingParameterWidgetFactoryInterface();
virtual QString parameterType() const = 0;
%Docstring
Returns the type string for the parameter type the factory is associated
with.
%End
virtual QgsAbstractProcessingParameterWidgetWrapper *createWidgetWrapper( const QgsProcessingParameterDefinition *parameter, QgsProcessingGui::WidgetType type ) = 0 /Factory/;
%Docstring
Creates a new widget wrapper for the specified ``parameter`` definition.
The ``type`` argument indicates the dialog type to create a wrapper for.
.. seealso:: :py:func:`createModelerWidgetWrapper`
%End
virtual QgsProcessingModelerParameterWidget *createModelerWidgetWrapper( QgsProcessingModelAlgorithm *model, const QString &childId, const QgsProcessingParameterDefinition *parameter, QgsProcessingContext &context );
%Docstring
Creates a new modeler parameter widget for the given ``parameter``. This
widget allows configuration of the parameter's value when used inside a
Processing ``model``.
The ID of the child algorithm within the model must be specified via the
``childId`` argument. This value corresponds to the
:py:func:`QgsProcessingModelChildAlgorithm.childId()` string, which
uniquely identifies which child algorithm the parameter is associated
with inside the given ``model``.
A Processing ``context`` must also be specified, which allows the widget
to resolve parameter values which are context dependent. The context
must last for the lifetime of the widget.
.. seealso:: :py:func:`createWidgetWrapper`
%End
virtual QgsProcessingAbstractParameterDefinitionWidget *createParameterDefinitionWidget(
QgsProcessingContext &context,
const QgsProcessingParameterWidgetContext &widgetContext,
const QgsProcessingParameterDefinition *definition = 0,
const QgsProcessingAlgorithm *algorithm = 0
) /Factory/;
%Docstring
Creates a new parameter definition widget allowing for configuration of
an instance of the parameter type handled by this factory.
The ``context`` argument must specify a Processing context, which will
be used by the widget to evaluate existing ``definition`` properties
such as default values. Similarly, the ``widgetContext`` argument
specifies the wider GUI context in which the widget will be used.
The optional ``definition`` argument may specify a parameter definition
which should be reflected in the initial state of the returned widget.
Subclasses must ensure that they correctly handle both the case when a
initial ``definition`` is passed, or when ``definition`` is ``None`` (in
which case sensible defaults should be shown in the returned widget).
Additionally, the optional ``algorithm`` parameter may be used to
specify the algorithm or model associated with the parameter.
If a factory subclass returns ``None`` for this method (i.e. as the base
class implementation does), it indicates that the parameter type cannot
be configured via GUI. In this case the parameter type will not be
configurable when users add it as an input to their graphical models.
.. versionadded:: 3.10
%End
protected:
virtual QStringList compatibleParameterTypes() const = 0;
%Docstring
Returns a list of compatible Processing parameter types for inputs for
this parameter.
In order to determine the available sources for the parameter in a model
the types returned by this method are checked. The returned list
corresponds to the various available values for
:py:func:`QgsProcessingParameterDefinition.type()`.
Subclasses should return a list of all
:py:func:`QgsProcessingParameterDefinition.type()` values which can be
used as input values for the parameter.
.. seealso:: :py:func:`compatibleOutputTypes`
.. seealso:: :py:func:`compatibleDataTypes`
%End
virtual QStringList compatibleOutputTypes() const = 0;
%Docstring
Returns a list of compatible Processing output types for inputs for this
parameter.
In order to determine the available sources for the parameter in a model
the types returned by this method are checked. The returned list
corresponds to the various available values for
:py:func:`QgsProcessingOutputDefinition.type()`.
Subclasses should return a list of all
:py:func:`QgsProcessingOutputDefinition.type()` values which can be used
as values for the parameter.
.. seealso:: :py:func:`compatibleParameterTypes`
.. seealso:: :py:func:`compatibleDataTypes`
%End
virtual QList<int> compatibleDataTypes( const QgsProcessingParameterDefinition *parameter ) const;
%Docstring
Returns a list of compatible Processing data types for inputs for this
widget for the specified ``parameter``.
In order to determine the available sources for the parameter in a model
the types returned by this method are checked. The returned list
corresponds to the various available values from
:py:class:`QgsProcessing`.SourceType.
Subclasses should return a list of all
:py:class:`QgsProcessing`.SourceType values which can be used as values
for the parameter.
.. seealso:: :py:func:`compatibleParameterTypes`
.. seealso:: :py:func:`compatibleOutputTypes`
%End
virtual QString modelerExpressionFormatString() const;
%Docstring
Returns the expected expression format string for expression results for
the parameter within model child algorithms.
This is shown in modeler widget wrappers when using the "pre-calculated"
expression mode, and should give helpful text to users to indicate the
expected results from the expression.
This is purely a text format and no expression validation is made
against it.
%End
virtual Qgis::ProcessingModelChildParameterSource defaultModelSource( const QgsProcessingParameterDefinition *parameter ) const;
%Docstring
Returns the default source type to use for the widget for the specified
``parameter``.
.. versionadded:: 3.24
%End
};
class QgsProcessingHiddenWidgetWrapper : QgsAbstractProcessingParameterWidgetWrapper
{
%Docstring(signature="appended")
An widget wrapper for hidden widgets.
The hidden widget wrapper allows for creation of a widget wrapper which
does not provide a graphical widget, yet still implements the
:py:class:`QgsAbstractProcessingParameterWidgetWrapper` interface.
.. versionadded:: 3.14
%End
%TypeHeaderCode
#include "qgsprocessingwidgetwrapper.h"
%End
public:
QgsProcessingHiddenWidgetWrapper( const QgsProcessingParameterDefinition *parameter = 0, QgsProcessingGui::WidgetType type = QgsProcessingGui::Standard, QObject *parent /TransferThis/ = 0 );
%Docstring
Constructor for QgsProcessingHiddenWidgetWrapper, for the specified
``parameter`` definition and dialog ``type``.
%End
virtual void setWidgetValue( const QVariant &value, QgsProcessingContext &context );
virtual QVariant widgetValue() const;
virtual const QgsVectorLayer *linkedVectorLayer() const;
void setLinkedVectorLayer( const QgsVectorLayer *layer );
%Docstring
Sets the vector layer linked to the wrapper.
%End
protected:
virtual QWidget *createWidget();
virtual QLabel *createLabel();
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/processing/qgsprocessingwidgetwrapper.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
|