2017-05-10 16:09:20 +02:00
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
|
|
|
* src/gui/qgspropertyoverridebutton.h *
|
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class QgsPropertyOverrideButton: QToolButton
|
2017-01-19 18:54:16 +10:00
|
|
|
{
|
2017-05-10 16:09:20 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
A button for controlling property overrides which may apply to a widget.
|
2017-05-10 16:09:20 +02:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
QgsPropertyOverrideButton is designed to be used alongside the QGIS
|
|
|
|
properties framework (QgsProperty, QgsPropertyDefinition
|
|
|
|
and QgsPropertyCollection).
|
|
|
|
|
|
|
|
It allows users to specify field or expression based overrides
|
|
|
|
which should be applied to a property of an object. Eg, this widget
|
|
|
|
is used for controlling data defined overrides in symbology, labeling
|
2018-01-11 06:52:24 +10:00
|
|
|
and layouts.
|
2017-05-10 16:09:20 +02:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
2017-01-19 18:54:16 +10:00
|
|
|
%TypeHeaderCode
|
2017-05-10 16:09:20 +02:00
|
|
|
#include "qgspropertyoverridebutton.h"
|
2017-01-19 18:54:16 +10:00
|
|
|
%End
|
|
|
|
public:
|
|
|
|
|
2017-05-10 16:09:20 +02:00
|
|
|
QgsPropertyOverrideButton( QWidget *parent /TransferThis/ = 0,
|
|
|
|
const QgsVectorLayer *layer = 0 );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Constructor for QgsPropertyOverrideButton.
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param parent: parent widget
|
|
|
|
:param layer: associated vector layer
|
2019-01-11 15:23:30 +10:00
|
|
|
%End
|
2017-01-19 18:54:16 +10:00
|
|
|
|
|
|
|
void init( int propertyKey,
|
2017-05-10 16:09:20 +02:00
|
|
|
const QgsProperty &property,
|
|
|
|
const QgsPropertiesDefinition &definitions,
|
2017-09-02 14:53:51 +01:00
|
|
|
const QgsVectorLayer *layer = 0,
|
|
|
|
bool auxiliaryStorageEnabled = false );
|
2017-05-10 16:09:20 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Initialize a newly constructed property button (useful if button was included in a UI layout).
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param propertyKey: key for corresponding property
|
|
|
|
:param property: initial value of associated property to show in widget
|
|
|
|
:param definitions: properties definitions for corresponding collection
|
|
|
|
:param layer: associated vector layer
|
2019-02-26 19:54:09 +10:00
|
|
|
:param auxiliaryStorageEnabled: If ``True``, activate the button to store data defined in auxiliary storage
|
2017-05-10 16:09:20 +02:00
|
|
|
%End
|
2017-01-19 18:54:16 +10:00
|
|
|
|
2017-11-26 17:15:31 +10:00
|
|
|
void init( int propertyKey,
|
|
|
|
const QgsProperty &property,
|
|
|
|
const QgsPropertyDefinition &definition,
|
|
|
|
const QgsVectorLayer *layer = 0,
|
|
|
|
bool auxiliaryStorageEnabled = false );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Initialize a newly constructed property button (useful if button was included in a UI layout).
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param propertyKey: key for corresponding property
|
|
|
|
:param property: initial value of associated property to show in widget
|
|
|
|
:param definition: properties definition for button
|
|
|
|
:param layer: associated vector layer
|
2019-02-26 19:54:09 +10:00
|
|
|
:param auxiliaryStorageEnabled: If ``True``, activate the button to store data defined in auxiliary storage
|
2017-11-26 17:15:31 +10:00
|
|
|
%End
|
|
|
|
|
2017-01-19 18:54:16 +10:00
|
|
|
void init( int propertyKey,
|
2017-05-10 16:09:20 +02:00
|
|
|
const QgsAbstractPropertyCollection &collection,
|
|
|
|
const QgsPropertiesDefinition &definitions,
|
2017-09-02 14:53:51 +01:00
|
|
|
const QgsVectorLayer *layer = 0,
|
|
|
|
bool auxiliaryStorageEnabled = false );
|
2017-05-10 16:09:20 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Initialize a newly constructed property button (useful if button was included in a UI layout).
|
2017-12-15 21:36:08 -04:00
|
|
|
|
2017-12-15 10:36:55 -04:00
|
|
|
:param propertyKey: key for corresponding property
|
|
|
|
:param collection: associated property collection
|
|
|
|
:param definitions: properties definitions for collection
|
|
|
|
:param layer: associated vector layer
|
2019-02-26 19:54:09 +10:00
|
|
|
:param auxiliaryStorageEnabled: If ``True``, activate the button to store data defined in auxiliary storage
|
2017-05-10 16:09:20 +02:00
|
|
|
%End
|
2017-01-19 18:54:16 +10:00
|
|
|
|
|
|
|
QgsProperty toProperty() const;
|
2017-05-10 16:09:20 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns a QgsProperty object encapsulating the current state of the
|
|
|
|
widget.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setToProperty`
|
2017-05-10 16:09:20 +02:00
|
|
|
%End
|
2017-01-19 18:54:16 +10:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
void setToProperty( const QgsProperty &property );
|
2017-05-10 16:09:20 +02:00
|
|
|
%Docstring
|
2017-12-19 11:43:52 -04:00
|
|
|
Sets the widget to reflect the current state of a :py:class:`QgsProperty`.
|
2017-05-10 16:09:20 +02:00
|
|
|
%End
|
2017-01-19 18:54:16 +10:00
|
|
|
|
|
|
|
int propertyKey() const;
|
2017-05-10 16:09:20 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the property key linked to the button.
|
2017-05-10 16:09:20 +02:00
|
|
|
%End
|
2017-01-19 18:54:16 +10:00
|
|
|
|
|
|
|
bool isActive() const;
|
2017-05-10 16:09:20 +02:00
|
|
|
%Docstring
|
2019-02-26 19:54:09 +10:00
|
|
|
Returns ``True`` if the button has an active property.
|
2017-05-10 16:09:20 +02:00
|
|
|
%End
|
2017-01-19 18:54:16 +10:00
|
|
|
|
|
|
|
QgsPropertyDefinition::DataType validDataType() const;
|
2017-05-10 16:09:20 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the data type which the widget will accept. This is used to filter
|
|
|
|
out fields from the associated vector layer to only show fields which
|
|
|
|
are compatible with the property.
|
2017-05-10 16:09:20 +02:00
|
|
|
%End
|
2017-01-19 18:54:16 +10:00
|
|
|
|
|
|
|
QString fullDescription() const;
|
2017-05-10 16:09:20 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the full definition description and current definition
|
|
|
|
(internally generated on a contextual basis).
|
2017-05-10 16:09:20 +02:00
|
|
|
%End
|
2017-01-19 18:54:16 +10:00
|
|
|
|
|
|
|
QString usageInfo() const;
|
2017-05-10 16:09:20 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns usage information for the property.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setUsageInfo`
|
2017-05-10 16:09:20 +02:00
|
|
|
%End
|
2017-01-19 18:54:16 +10:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
void setUsageInfo( const QString &info );
|
2017-05-10 16:09:20 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Set the usage information for the property.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`usageInfo`
|
2017-05-10 16:09:20 +02:00
|
|
|
%End
|
2017-01-19 18:54:16 +10:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
void setVectorLayer( const QgsVectorLayer *layer );
|
2017-05-10 16:09:20 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Sets the vector layer associated with the button. This controls which fields are
|
|
|
|
displayed within the widget's pop up menu.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`vectorLayer`
|
2017-05-10 16:09:20 +02:00
|
|
|
%End
|
2017-01-19 18:54:16 +10:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
const QgsVectorLayer *vectorLayer() const;
|
2017-05-10 16:09:20 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Returns the vector layer associated with the button. This controls which fields are
|
|
|
|
displayed within the widget's pop up menu.
|
|
|
|
|
2018-01-09 17:26:37 -04:00
|
|
|
.. seealso:: :py:func:`setVectorLayer`
|
2017-05-10 16:09:20 +02:00
|
|
|
%End
|
2017-01-19 18:54:16 +10:00
|
|
|
|
2017-05-10 16:09:20 +02:00
|
|
|
void registerCheckedWidget( QWidget *widget, bool natural = true );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Register a sibling ``widget`` that gets checked when the property is active.
|
2019-02-26 19:54:09 +10:00
|
|
|
if ``natural`` is ``False``, widget gets unchecked when the property is active.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-05-10 16:09:20 +02:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
this should be called after calling init() to be correctly initialized.
|
|
|
|
%End
|
|
|
|
|
|
|
|
void registerEnabledWidget( QWidget *widget, bool natural = true );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Register a sibling ``widget`` that gets enabled when the property is active, and disabled when the property is inactive.
|
2019-02-26 19:54:09 +10:00
|
|
|
if ``natural`` is ``False``, widget gets disabled when the property is active, and enabled when the property is inactive.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-05-10 16:09:20 +02:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
this should be called after calling init() to be correctly initialized.
|
|
|
|
%End
|
|
|
|
|
|
|
|
void registerVisibleWidget( QWidget *widget, bool natural = true );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Register a sibling ``widget`` that gets visible when the property is active, and hidden when the property is inactive.
|
2019-02-26 19:54:09 +10:00
|
|
|
if ``natural`` is ``False``, widget gets hidden when the property is active, and visible when the property is inactive.
|
2017-12-15 10:36:55 -04:00
|
|
|
|
2017-05-10 16:09:20 +02:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
this should be called after calling init() to be correctly initialized.
|
|
|
|
%End
|
|
|
|
|
|
|
|
void registerExpressionWidget( QWidget *widget );
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Register a sibling ``widget`` (line edit, text edit) that will receive the property as an expression
|
|
|
|
|
2017-05-10 16:09:20 +02:00
|
|
|
.. note::
|
|
|
|
|
|
|
|
this should be called after calling init() to be correctly initialized.
|
|
|
|
%End
|
2017-01-19 18:54:16 +10:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
void registerExpressionContextGenerator( QgsExpressionContextGenerator *generator );
|
2017-05-10 16:09:20 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Register an expression context generator class that will be used to retrieve
|
|
|
|
an expression context for the button when required.
|
2019-01-12 18:54:42 +10:00
|
|
|
%End
|
|
|
|
|
|
|
|
void registerLinkedWidget( QWidget *widget );
|
|
|
|
%Docstring
|
|
|
|
Registers a ``widget`` which is linked to this button. The meaning of linked widgets
|
|
|
|
depends on the property type, and the type of linked widget.
|
|
|
|
|
|
|
|
For color properties, linking a QgsColorButton allows the color button to correctly
|
|
|
|
reflect the status of the property when it's set to follow a project color.
|
|
|
|
|
|
|
|
.. versionadded:: 3.6
|
2017-05-10 16:09:20 +02:00
|
|
|
%End
|
|
|
|
|
2017-08-29 05:58:40 +01:00
|
|
|
void updateFieldLists();
|
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Updates list of fields.
|
2017-08-29 05:58:40 +01:00
|
|
|
|
|
|
|
.. versionadded:: 3.0
|
|
|
|
%End
|
|
|
|
|
2017-01-19 18:54:16 +10:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
|
|
|
|
void setActive( bool active );
|
2017-05-10 16:09:20 +02:00
|
|
|
%Docstring
|
2017-12-15 10:36:55 -04:00
|
|
|
Set whether the current property override definition is to be used
|
2017-05-10 16:09:20 +02:00
|
|
|
%End
|
2017-01-19 18:54:16 +10:00
|
|
|
|
[FEATURE] Show Project Colors in color bound data defined buttons
This adds a new "Project Colors" section in data defined buttons
which are linked to a color value. The color menu contains all
colors defined as part of the current project's Project Color
Scheme (which is defined through project properties).
When a project color is selected from the button, the property
becomes linked to that color. It will automatically follow any
future changes to the color when made through project properties.
This allows users to define common colors for a project once,
and then "bind" symbol, label, layout, etc colors to these
preset colors. The link is live, so you change it once, and
the change is reflected EVERYWHERE. Sure beats updating a color
100 times when it's use has been scattered throughout a project's
symbols, labels, etc...
(Basically, this is just adding a shortcut to setting a data
defined expression "project_color(...)" for the property. The
project_color function has been around a LOOONG time, but it's
only really been usable by power users before this change)
2019-01-11 15:14:23 +10:00
|
|
|
|
|
|
|
|
|
|
|
void aboutToShowMenu();
|
|
|
|
void menuActionTriggered( QAction *action );
|
|
|
|
|
|
|
|
|
2017-01-19 18:54:16 +10:00
|
|
|
signals:
|
|
|
|
|
|
|
|
void changed();
|
2017-05-10 16:09:20 +02:00
|
|
|
%Docstring
|
|
|
|
Emitted when property definition changes
|
|
|
|
%End
|
2017-01-19 18:54:16 +10:00
|
|
|
|
|
|
|
void activated( bool isActive );
|
2017-05-10 16:09:20 +02:00
|
|
|
%Docstring
|
|
|
|
Emitted when the activated status of the widget changes
|
2017-08-29 05:39:43 +01:00
|
|
|
%End
|
|
|
|
|
|
|
|
void createAuxiliaryField();
|
|
|
|
%Docstring
|
|
|
|
Emitted when creating a new auxiliary field
|
2017-05-10 16:09:20 +02:00
|
|
|
%End
|
2017-01-19 18:54:16 +10:00
|
|
|
|
|
|
|
protected:
|
2017-05-10 16:09:20 +02:00
|
|
|
virtual void mouseReleaseEvent( QMouseEvent *event );
|
|
|
|
|
|
|
|
|
2017-01-19 18:54:16 +10:00
|
|
|
};
|
|
|
|
|
2017-05-10 16:09:20 +02:00
|
|
|
/************************************************************************
|
|
|
|
* This file has been generated automatically from *
|
|
|
|
* *
|
|
|
|
* src/gui/qgspropertyoverridebutton.h *
|
|
|
|
* *
|
|
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
|
|
************************************************************************/
|