QGIS API Documentation  2.99.0-Master (e077efd)
Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Properties | List of all members
QgsDataDefinedButton Class Reference

A button for defining data source field mappings or expressions. More...

#include <qgsdatadefinedbutton.h>

Inheritance diagram for QgsDataDefinedButton:
Inheritance graph
[legend]

Public Types

enum  DataType { String = 1, Int = 2, Double = 4, AnyType = String | Int | Double }
 

Public Slots

void checkCheckedWidgets (bool check)
 Set siblings' checked property when data definition or expression is active. More...
 
void disableEnabledWidgets (bool disable)
 Set siblings' enabled property when data definition or expression is set/unset. More...
 
void setActive (bool active)
 Set whether the current data definition or expression is to be used. More...
 

Signals

void dataDefinedActivated (bool active)
 Emitted when active state changed. More...
 
void dataDefinedChanged (const QString &definition)
 Emitted when data definition or expression is changed. More...
 

Public Member Functions

 QgsDataDefinedButton (QWidget *parent=nullptr, const QgsVectorLayer *vl=nullptr, const QgsDataDefined *datadefined=nullptr, QgsDataDefinedButton::DataTypes datatypes=AnyType, const QString &description=QString())
 Construct a new data defined button. More...
 
 ~QgsDataDefinedButton ()
 
QgsDataDefinedAssistantassistant ()
 Returns the assistant used to defined the data defined object properties, if set. More...
 
void clearCheckedWidgets ()
 Clears list of checkable sibling widgets. More...
 
void clearEnabledWidgets ()
 Clears list of sibling widgets. More...
 
QgsDataDefined currentDataDefined () const
 Returns a QgsDataDefined which reflects the current settings from the button. More...
 
QString currentDefinition () const
 The current definition. More...
 
QMap< QString, QString > definedProperty () const
 
QString fullDescription () const
 The full definition description and current definition (internally generated on a contextual basis) More...
 
QString getExpression () const
 The current defined expression. More...
 
QString getField () const
 The current defined field. More...
 
void init (const QgsVectorLayer *vl, const QgsDataDefined *datadefined=nullptr, QgsDataDefinedButton::DataTypes datatypes=AnyType, const QString &description=QString())
 Initialize a newly constructed data defined button (useful if button already included from form layout) More...
 
bool isActive () const
 Whether the current data definition or expression is to be used. More...
 
void registerCheckedWidget (QWidget *wdgt)
 Register a sibling widget that get checked when data definition or expression is active. More...
 
void registerCheckedWidgets (const QList< QWidget *> &wdgts)
 Register list of sibling widgets that get checked when data definition or expression is active. More...
 
QList< QWidget * > registeredCheckedWidgets ()
 Return widget siblings that get checked when data definition or expression is active. More...
 
QList< QWidget * > registeredEnabledWidgets ()
 Return widget siblings that get disabled/enabled when data definition or expression is set/unset. More...
 
void registerEnabledWidget (QWidget *wdgt)
 Register a sibling widget that gets disabled/enabled when data definition or expression is set/unset. More...
 
void registerEnabledWidgets (const QList< QWidget *> &wdgts)
 Register list of sibling widgets that get disabled/enabled when data definition or expression is set/unset. More...
 
void registerExpressionContextGenerator (QgsExpressionContextGenerator *generator)
 Register an expression context generator class that will be used to retrieve an expression context for the button. More...
 
void setAssistant (const QString &title, QgsDataDefinedAssistant *assistant)
 Sets an assistant used to define the data defined object properties. More...
 
void setUsageInfo (const QString &info)
 Set the usage information about this data definition. More...
 
void setVectorLayer (QgsVectorLayer *layer)
 Sets the vector layer associated with the button. More...
 
void updateDataDefined (QgsDataDefined *dd) const
 Updates a QgsDataDefined with the current settings from the button. More...
 
QString usageInfo () const
 The usage information about this data definition. More...
 
bool useExpression () const
 Whether the current expression is to be used instead of field mapping. More...
 
const DataTypes & validDataTypes () const
 The valid data types that will work for the definition (QVariant-coercible to expected type) Compared against the variant type of the QgsField from data source and expression result. More...
 

Static Public Member Functions

static QString anyStringDesc ()
 
static QString blendModesDesc ()
 
static QString boolDesc ()
 
static QString capStyleDesc ()
 
static QString charDesc ()
 
static QString colorAlphaDesc ()
 
static QString colorNoAlphaDesc ()
 
static QString customDashDesc ()
 
static QString double0to1Desc ()
 
static QString double180RotDesc ()
 
static QString doubleDesc ()
 
static QString doublePosDesc ()
 
static QString doubleXYDesc ()
 
static QString filePathDesc ()
 
static QString fillStyleDesc ()
 
static QString gradientCoordModeDesc ()
 
static QString gradientSpreadDesc ()
 
static QString gradientTypeDesc ()
 
static QString horizontalAnchorDesc ()
 
static QString intDesc ()
 
static QString intPosDesc ()
 
static QString intPosOneDesc ()
 
static QString intTranspDesc ()
 
static QString lineStyleDesc ()
 
static QString markerStyleDesc ()
 
static QString paperOrientationDesc ()
 
static QString paperSizeDesc ()
 
static QString penJoinStyleDesc ()
 
static QString svgPathDesc ()
 
static QString textHorzAlignDesc ()
 
static QString textVertAlignDesc ()
 
static QString trString ()
 Common descriptions for expected input values. More...
 
static QString unitsMmMuDesc ()
 
static QString unitsMmMuPercentDesc ()
 
static QString verticalAnchorDesc ()
 

Protected Member Functions

void mouseReleaseEvent (QMouseEvent *event) override
 
void setExpression (const QString &exp)
 Set the current defined expression. More...
 
void setField (const QString &field)
 Set the current defined field. More...
 
void setUseExpression (bool use)
 Set whether the current expression is to be used instead of field mapping. More...
 

Properties

QString usageInfo
 

Detailed Description

A button for defining data source field mappings or expressions.

Definition at line 74 of file qgsdatadefinedbutton.h.

Member Enumeration Documentation

§ DataType

Enumerator
String 
Int 
Double 
AnyType 

Definition at line 80 of file qgsdatadefinedbutton.h.

Constructor & Destructor Documentation

§ QgsDataDefinedButton()

QgsDataDefinedButton::QgsDataDefinedButton ( QWidget *  parent = nullptr,
const QgsVectorLayer vl = nullptr,
const QgsDataDefined datadefined = nullptr,
QgsDataDefinedButton::DataTypes  datatypes = AnyType,
const QString &  description = QString() 
)

Construct a new data defined button.

Parameters
parentThe parent QWidget
vlPointer to the associated vector layer
datadefinedData defined property
datatypesThe expected data types to be compared against the variant type of the QgsField from data source and expression result
descriptionThe description of expected input data

Definition at line 31 of file qgsdatadefinedbutton.cpp.

§ ~QgsDataDefinedButton()

QgsDataDefinedButton::~QgsDataDefinedButton ( )

Definition at line 97 of file qgsdatadefinedbutton.cpp.

Member Function Documentation

§ anyStringDesc()

QString QgsDataDefinedButton::anyStringDesc ( )
static

Definition at line 750 of file qgsdatadefinedbutton.cpp.

§ assistant()

QgsDataDefinedAssistant * QgsDataDefinedButton::assistant ( )

Returns the assistant used to defined the data defined object properties, if set.

See also
setAssistant()
Note
added in QGIS 2.12

Definition at line 706 of file qgsdatadefinedbutton.cpp.

§ blendModesDesc()

QString QgsDataDefinedButton::blendModesDesc ( )
static

Definition at line 835 of file qgsdatadefinedbutton.cpp.

§ boolDesc()

QString QgsDataDefinedButton::boolDesc ( )
static

Definition at line 745 of file qgsdatadefinedbutton.cpp.

§ capStyleDesc()

QString QgsDataDefinedButton::capStyleDesc ( )
static

Definition at line 898 of file qgsdatadefinedbutton.cpp.

§ charDesc()

QString QgsDataDefinedButton::charDesc ( )
static

Definition at line 740 of file qgsdatadefinedbutton.cpp.

§ checkCheckedWidgets

void QgsDataDefinedButton::checkCheckedWidgets ( bool  check)
slot

Set siblings' checked property when data definition or expression is active.

Definition at line 711 of file qgsdatadefinedbutton.cpp.

§ clearCheckedWidgets()

void QgsDataDefinedButton::clearCheckedWidgets ( )
inline

Clears list of checkable sibling widgets.

Definition at line 230 of file qgsdatadefinedbutton.h.

§ clearEnabledWidgets()

void QgsDataDefinedButton::clearEnabledWidgets ( )
inline

Clears list of sibling widgets.

Definition at line 208 of file qgsdatadefinedbutton.h.

§ colorAlphaDesc()

QString QgsDataDefinedButton::colorAlphaDesc ( )
static

Definition at line 815 of file qgsdatadefinedbutton.cpp.

§ colorNoAlphaDesc()

QString QgsDataDefinedButton::colorNoAlphaDesc ( )
static

Definition at line 810 of file qgsdatadefinedbutton.cpp.

§ currentDataDefined()

QgsDataDefined QgsDataDefinedButton::currentDataDefined ( ) const

Returns a QgsDataDefined which reflects the current settings from the button.

Note
added in QGIS 2.9
See also
updateDataDefined

Definition at line 214 of file qgsdatadefinedbutton.cpp.

§ currentDefinition()

QString QgsDataDefinedButton::currentDefinition ( ) const
inline

The current definition.

Returns
empty QString if not active, otherwise currently defined expression or field name

Definition at line 165 of file qgsdatadefinedbutton.h.

§ customDashDesc()

QString QgsDataDefinedButton::customDashDesc ( )
static

Definition at line 916 of file qgsdatadefinedbutton.cpp.

§ dataDefinedActivated

void QgsDataDefinedButton::dataDefinedActivated ( bool  active)
signal

Emitted when active state changed.

Parameters
activeWhether the definition is active

§ dataDefinedChanged

void QgsDataDefinedButton::dataDefinedChanged ( const QString &  definition)
signal

Emitted when data definition or expression is changed.

Parameters
definitionThe current definition or expression (empty string if inactive)

§ definedProperty()

QMap< QString, QString > QgsDataDefinedButton::definedProperty ( ) const
inline

Definition at line 118 of file qgsdatadefinedbutton.h.

§ disableEnabledWidgets

void QgsDataDefinedButton::disableEnabledWidgets ( bool  disable)
slot

Set siblings' enabled property when data definition or expression is set/unset.

Definition at line 658 of file qgsdatadefinedbutton.cpp.

§ double0to1Desc()

QString QgsDataDefinedButton::double0to1Desc ( )
static

Definition at line 780 of file qgsdatadefinedbutton.cpp.

§ double180RotDesc()

QString QgsDataDefinedButton::double180RotDesc ( )
static

Definition at line 790 of file qgsdatadefinedbutton.cpp.

§ doubleDesc()

QString QgsDataDefinedButton::doubleDesc ( )
static

Definition at line 770 of file qgsdatadefinedbutton.cpp.

§ doublePosDesc()

QString QgsDataDefinedButton::doublePosDesc ( )
static

Definition at line 775 of file qgsdatadefinedbutton.cpp.

§ doubleXYDesc()

QString QgsDataDefinedButton::doubleXYDesc ( )
static

Definition at line 785 of file qgsdatadefinedbutton.cpp.

§ filePathDesc()

QString QgsDataDefinedButton::filePathDesc ( )
static

Definition at line 849 of file qgsdatadefinedbutton.cpp.

§ fillStyleDesc()

QString QgsDataDefinedButton::fillStyleDesc ( )
static

Definition at line 903 of file qgsdatadefinedbutton.cpp.

§ fullDescription()

QString QgsDataDefinedButton::fullDescription ( ) const
inline

The full definition description and current definition (internally generated on a contextual basis)

Definition at line 176 of file qgsdatadefinedbutton.h.

§ getExpression()

QString QgsDataDefinedButton::getExpression ( ) const
inline

The current defined expression.

Definition at line 154 of file qgsdatadefinedbutton.h.

§ getField()

QString QgsDataDefinedButton::getField ( ) const
inline

The current defined field.

Definition at line 159 of file qgsdatadefinedbutton.h.

§ gradientCoordModeDesc()

QString QgsDataDefinedButton::gradientCoordModeDesc ( )
static

Definition at line 883 of file qgsdatadefinedbutton.cpp.

§ gradientSpreadDesc()

QString QgsDataDefinedButton::gradientSpreadDesc ( )
static

Definition at line 888 of file qgsdatadefinedbutton.cpp.

§ gradientTypeDesc()

QString QgsDataDefinedButton::gradientTypeDesc ( )
static

Definition at line 878 of file qgsdatadefinedbutton.cpp.

§ horizontalAnchorDesc()

QString QgsDataDefinedButton::horizontalAnchorDesc ( )
static

Definition at line 868 of file qgsdatadefinedbutton.cpp.

§ init()

void QgsDataDefinedButton::init ( const QgsVectorLayer vl,
const QgsDataDefined datadefined = nullptr,
QgsDataDefinedButton::DataTypes  datatypes = AnyType,
const QString &  description = QString() 
)

Initialize a newly constructed data defined button (useful if button already included from form layout)

Parameters
vlPointer to the associated vector layer
datadefinedData defined property
datatypesThe expected data types to be compared against the variant type of the QgsField from data source and expression result
descriptionThe description of expected input data

Definition at line 144 of file qgsdatadefinedbutton.cpp.

§ intDesc()

QString QgsDataDefinedButton::intDesc ( )
static

Definition at line 755 of file qgsdatadefinedbutton.cpp.

§ intPosDesc()

QString QgsDataDefinedButton::intPosDesc ( )
static

Definition at line 760 of file qgsdatadefinedbutton.cpp.

§ intPosOneDesc()

QString QgsDataDefinedButton::intPosOneDesc ( )
static

Definition at line 765 of file qgsdatadefinedbutton.cpp.

§ intTranspDesc()

QString QgsDataDefinedButton::intTranspDesc ( )
static

Definition at line 795 of file qgsdatadefinedbutton.cpp.

§ isActive()

bool QgsDataDefinedButton::isActive ( ) const
inline

Whether the current data definition or expression is to be used.

Definition at line 144 of file qgsdatadefinedbutton.h.

§ lineStyleDesc()

QString QgsDataDefinedButton::lineStyleDesc ( )
static

Definition at line 893 of file qgsdatadefinedbutton.cpp.

§ markerStyleDesc()

QString QgsDataDefinedButton::markerStyleDesc ( )
static

Definition at line 910 of file qgsdatadefinedbutton.cpp.

§ mouseReleaseEvent()

void QgsDataDefinedButton::mouseReleaseEvent ( QMouseEvent *  event)
overrideprotected

Definition at line 226 of file qgsdatadefinedbutton.cpp.

§ paperOrientationDesc()

QString QgsDataDefinedButton::paperOrientationDesc ( )
static

Definition at line 863 of file qgsdatadefinedbutton.cpp.

§ paperSizeDesc()

QString QgsDataDefinedButton::paperSizeDesc ( )
static

Definition at line 854 of file qgsdatadefinedbutton.cpp.

§ penJoinStyleDesc()

QString QgsDataDefinedButton::penJoinStyleDesc ( )
static

Definition at line 830 of file qgsdatadefinedbutton.cpp.

§ registerCheckedWidget()

void QgsDataDefinedButton::registerCheckedWidget ( QWidget *  wdgt)

Register a sibling widget that get checked when data definition or expression is active.

Definition at line 674 of file qgsdatadefinedbutton.cpp.

§ registerCheckedWidgets()

void QgsDataDefinedButton::registerCheckedWidgets ( const QList< QWidget *> &  wdgts)

Register list of sibling widgets that get checked when data definition or expression is active.

Definition at line 666 of file qgsdatadefinedbutton.cpp.

§ registeredCheckedWidgets()

QList< QWidget * > QgsDataDefinedButton::registeredCheckedWidgets ( )

Return widget siblings that get checked when data definition or expression is active.

Returns
unguarded pointers from guarded ones

Definition at line 683 of file qgsdatadefinedbutton.cpp.

§ registeredEnabledWidgets()

QList< QWidget * > QgsDataDefinedButton::registeredEnabledWidgets ( )

Return widget siblings that get disabled/enabled when data definition or expression is set/unset.

Returns
unguarded pointers from guarded ones

Definition at line 647 of file qgsdatadefinedbutton.cpp.

§ registerEnabledWidget()

void QgsDataDefinedButton::registerEnabledWidget ( QWidget *  wdgt)

Register a sibling widget that gets disabled/enabled when data definition or expression is set/unset.

Definition at line 638 of file qgsdatadefinedbutton.cpp.

§ registerEnabledWidgets()

void QgsDataDefinedButton::registerEnabledWidgets ( const QList< QWidget *> &  wdgts)

Register list of sibling widgets that get disabled/enabled when data definition or expression is set/unset.

Definition at line 630 of file qgsdatadefinedbutton.cpp.

§ registerExpressionContextGenerator()

void QgsDataDefinedButton::registerExpressionContextGenerator ( QgsExpressionContextGenerator generator)

Register an expression context generator class that will be used to retrieve an expression context for the button.

Parameters
generatorA QgsExpressionContextGenerator class that will be used to create an expression context when required.
Note
added in QGIS 3.0

Definition at line 694 of file qgsdatadefinedbutton.cpp.

§ setActive

void QgsDataDefinedButton::setActive ( bool  active)
slot

Set whether the current data definition or expression is to be used.

Definition at line 621 of file qgsdatadefinedbutton.cpp.

§ setAssistant()

void QgsDataDefinedButton::setAssistant ( const QString &  title,
QgsDataDefinedAssistant assistant 
)

Sets an assistant used to define the data defined object properties.

Ownership of the assistant is transferred to the widget.

Parameters
titlemenu title for the assistant
assistantdata defined assistant. Set to null to remove the assistant option from the button.
Note
added in 2.10
See also
assistant()

Definition at line 699 of file qgsdatadefinedbutton.cpp.

§ setExpression()

void QgsDataDefinedButton::setExpression ( const QString &  exp)
inlineprotected

Set the current defined expression.

Definition at line 339 of file qgsdatadefinedbutton.h.

§ setField()

void QgsDataDefinedButton::setField ( const QString &  field)
inlineprotected

Set the current defined field.

Definition at line 344 of file qgsdatadefinedbutton.h.

§ setUsageInfo()

void QgsDataDefinedButton::setUsageInfo ( const QString &  info)
inline

Set the usage information about this data definition.

Definition at line 186 of file qgsdatadefinedbutton.h.

§ setUseExpression()

void QgsDataDefinedButton::setUseExpression ( bool  use)
inlineprotected

Set whether the current expression is to be used instead of field mapping.

Definition at line 334 of file qgsdatadefinedbutton.h.

§ setVectorLayer()

void QgsDataDefinedButton::setVectorLayer ( QgsVectorLayer layer)

Sets the vector layer associated with the button.

This controls which fields are displayed within the widget's pop up menu.

Parameters
layervector layer
Note
added in QGIS 3.0

Definition at line 221 of file qgsdatadefinedbutton.cpp.

§ svgPathDesc()

QString QgsDataDefinedButton::svgPathDesc ( )
static

Definition at line 842 of file qgsdatadefinedbutton.cpp.

§ textHorzAlignDesc()

QString QgsDataDefinedButton::textHorzAlignDesc ( )
static

Definition at line 820 of file qgsdatadefinedbutton.cpp.

§ textVertAlignDesc()

QString QgsDataDefinedButton::textVertAlignDesc ( )
static

Definition at line 825 of file qgsdatadefinedbutton.cpp.

§ trString()

QString QgsDataDefinedButton::trString ( )
static

Common descriptions for expected input values.

Definition at line 734 of file qgsdatadefinedbutton.cpp.

§ unitsMmMuDesc()

QString QgsDataDefinedButton::unitsMmMuDesc ( )
static

Definition at line 800 of file qgsdatadefinedbutton.cpp.

§ unitsMmMuPercentDesc()

QString QgsDataDefinedButton::unitsMmMuPercentDesc ( )
static

Definition at line 805 of file qgsdatadefinedbutton.cpp.

§ updateDataDefined()

void QgsDataDefinedButton::updateDataDefined ( QgsDataDefined dd) const

Updates a QgsDataDefined with the current settings from the button.

Parameters
ddQgsDataDefined to update
Note
added in QGIS 2.9
See also
currentDataDefined

Definition at line 203 of file qgsdatadefinedbutton.cpp.

§ usageInfo()

QString QgsDataDefinedButton::usageInfo ( ) const
inline

The usage information about this data definition.

Definition at line 181 of file qgsdatadefinedbutton.h.

§ useExpression()

bool QgsDataDefinedButton::useExpression ( ) const
inline

Whether the current expression is to be used instead of field mapping.

Definition at line 149 of file qgsdatadefinedbutton.h.

§ validDataTypes()

const DataTypes& QgsDataDefinedButton::validDataTypes ( ) const
inline

The valid data types that will work for the definition (QVariant-coercible to expected type) Compared against the variant type of the QgsField from data source and expression result.

Definition at line 171 of file qgsdatadefinedbutton.h.

§ verticalAnchorDesc()

QString QgsDataDefinedButton::verticalAnchorDesc ( )
static

Definition at line 873 of file qgsdatadefinedbutton.cpp.

Property Documentation

§ usageInfo

QString QgsDataDefinedButton::usageInfo
readwrite

Definition at line 77 of file qgsdatadefinedbutton.h.


The documentation for this class was generated from the following files: