Skip to content

Commit

Permalink
[processing] Port map layer selection combobox widget to c++
Browse files Browse the repository at this point in the history
And:

- fix enable state of selected features only after changing between
map layers with/without selections
- fix state of selected features only when running an algorithm
from the history list, e.g. respect original setting for
selected features only (or not)
- ensure no duplicate changed signals are sent, and correctly
emit changed signals in all applicable circumstances
- handle drag and dropped layers from browser panel (UX fix)
- soak with unit tests
  • Loading branch information
nyalldawson committed Jun 15, 2019
1 parent 9d82273 commit fbd243b
Show file tree
Hide file tree
Showing 10 changed files with 1,110 additions and 234 deletions.
@@ -0,0 +1,111 @@
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/processing/qgsprocessingmaplayercombobox.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/






class QgsProcessingMapLayerComboBox : QWidget
{
%Docstring
Processing map layer combo box.

.. warning::

Not part of stable API and may change in future QGIS releases.

.. versionadded:: 3.8
%End

%TypeHeaderCode
#include "qgsprocessingmaplayercombobox.h"
%End
public:

QgsProcessingMapLayerComboBox( QgsProcessingParameterDefinition *parameter, QWidget *parent = 0 );
%Docstring
Constructor for QgsProcessingMapLayerComboBox, with the specified ``parameter`` definition.
%End

void setLayer( QgsMapLayer *layer );
%Docstring
Sets the combo box to the specified ``layer``, if ``layer`` is compatible with the
widget's parameter definition.
%End

QgsMapLayer *currentLayer();
%Docstring
Returns the current layer selected in the combobox, or ``None`` if the selection cannot
be represented as a map layer.

.. warning::

Prefer calling value() instead, as it correctly encapsulates all valid
values which can be represented by the widget.

.. seealso:: :py:func:`currentText`
%End

QString currentText();
%Docstring
Returns the current text of the selected item in the combobox.

.. warning::

Prefer calling value() instead, as it correctly encapsulates all valid
values which can be represented by the widget.

.. seealso:: :py:func:`currentLayer`
%End

void setValue( const QVariant &value, QgsProcessingContext &context );
%Docstring
Sets the ``value`` shown in the widget.

.. seealso:: :py:func:`value`
%End

QVariant value() const;
%Docstring
Returns the current value of the widget.

.. seealso:: :py:func:`setValue`
%End

signals:

void valueChanged();
%Docstring
Emitted whenever the value is changed in the widget.
%End

void triggerFileSelection();
%Docstring
Emitted when the widget has triggered a file selection operation (to be
handled in Python for now).
%End

protected:

virtual void dragEnterEvent( QDragEnterEvent *event );

virtual void dragLeaveEvent( QDragLeaveEvent *event );

virtual void dropEvent( QDropEvent *event );


};

/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/processing/qgsprocessingmaplayercombobox.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
1 change: 1 addition & 0 deletions python/gui/gui_auto.sip
Expand Up @@ -330,6 +330,7 @@
%Include auto_generated/locator/qgslocatorwidget.sip
%Include auto_generated/processing/qgsprocessingalgorithmconfigurationwidget.sip
%Include auto_generated/processing/qgsprocessingalgorithmdialogbase.sip
%Include auto_generated/processing/qgsprocessingmaplayercombobox.sip
%Include auto_generated/processing/qgsprocessingmodelerparameterwidget.sip
%Include auto_generated/processing/qgsprocessingmultipleselectiondialog.sip
%Include auto_generated/processing/qgsprocessingrecentalgorithmlog.sip
Expand Down

0 comments on commit fbd243b

Please sign in to comment.