QGIS API Documentation
2.2.0-Valmiera
|
A button for defining data source field mappings or expressions. More...
#include <qgsdatadefinedbutton.h>
Public Types | |
enum | DataType { AnyType = 0, String = 1, Int = 2, Double = 4 } |
Public Slots | |
void | setActive (bool active) |
Set whether the current data definition or expression is to be used. | |
void | disableEnabledWidgets (bool disable) |
Set siblings' enabled property when data definition or expression is set/unset. | |
void | checkCheckedWidgets (bool check) |
Set siblings' checked property when data definition or expression is active. |
Signals | |
void | dataDefinedChanged (const QString &definition) |
Emitted when data definition or expression is changed. | |
void | dataDefinedActivated (bool active) |
Emitted when active state changed. |
Public Member Functions | |
QgsDataDefinedButton (QWidget *parent=0, const QgsVectorLayer *vl=0, const QgsDataDefined *datadefined=0, DataTypes datatypes=AnyType, QString description=QString("")) | |
Construct a new data defined button. | |
~QgsDataDefinedButton () | |
void | init (const QgsVectorLayer *vl, const QgsDataDefined *datadefined=0, DataTypes datatypes=AnyType, QString description=QString("")) |
Initialize a newly constructed data defined button (useful if button already included from form layout) | |
QMap< QString, QString > | definedProperty () const |
bool | isActive () |
Whether the current data definition or expression is to be used. | |
bool | useExpression () |
Whether the current expression is to be used instead of field mapping. | |
QString | getExpression () const |
The current defined expression. | |
QString | getField () const |
The current defined field. | |
QString | currentDefinition () const |
The current definition. | |
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. | |
QString | fullDescription () const |
The full definition description and current definition (internally generated on a contextual basis) | |
QString | usageInfo () const |
The usage information about this data definition. | |
void | setUsageInfo (const QString &info) |
Set the usage information about this data definition. | |
void | registerEnabledWidgets (QList< QWidget * > wdgts) |
Register list of sibling widgets that get disabled/enabled when data definition or expression is set/unset. | |
void | registerEnabledWidget (QWidget *wdgt) |
Register a sibling widget that gets disabled/enabled when data definition or expression is set/unset. | |
QList< QWidget * > | registeredEnabledWidgets () |
Return widget siblings that get disabled/enabled when data definition or expression is set/unset. | |
void | clearEnabledWidgets () |
Clears list of sibling widgets. | |
void | registerCheckedWidgets (QList< QWidget * > wdgts) |
Register list of sibling widgets that get checked when data definition or expression is active. | |
void | registerCheckedWidget (QWidget *wdgt) |
Register a sibling widget that get checked when data definition or expression is active. | |
QList< QWidget * > | registeredCheckedWidgets () |
Return widget siblings that get checked when data definition or expression is active. | |
void | clearCheckedWidgets () |
Clears list of checkable sibling widgets. |
Static Public Member Functions | |
static QString | trString () |
Common descriptions for expected input values. | |
static QString | boolDesc () |
static QString | anyStringDesc () |
static QString | intDesc () |
static QString | intPosDesc () |
static QString | intPosOneDesc () |
static QString | doubleDesc () |
static QString | doublePosDesc () |
static QString | doubleXYDesc () |
static QString | double180RotDesc () |
static QString | intTranspDesc () |
static QString | unitsMmMuDesc () |
static QString | unitsMmMuPercentDesc () |
static QString | colorNoAlphaDesc () |
static QString | colorAlphaDesc () |
static QString | textHorzAlignDesc () |
static QString | textVertAlignDesc () |
static QString | penJoinStyleDesc () |
static QString | blendModesDesc () |
static QString | svgPathDesc () |
Protected Member Functions | |
void | mouseReleaseEvent (QMouseEvent *event) |
void | setUseExpression (bool use) |
Set whether the current expression is to be used instead of field mapping. | |
void | setExpression (QString exp) |
Set the current defined expression. | |
void | setField (QString field) |
Set the current defined field. |
Private Slots | |
void | aboutToShowMenu () |
void | menuActionTriggered (QAction *action) |
Private Member Functions | |
void | showDescriptionDialog () |
void | showExpressionDialog () |
void | updateGui () |
Private Attributes | |
const QgsVectorLayer * | mVectorLayer |
QgsFields | mFields |
QStringList | mFieldNameList |
QStringList | mFieldTypeList |
QMap< QString, QString > | mProperty |
QList< QPointer< QWidget > > | mEnabledWidgets |
QList< QPointer< QWidget > > | mCheckedWidgets |
QMenu * | mDefineMenu |
QAction * | mActionDataTypes |
QMenu * | mFieldsMenu |
QAction * | mActionActive |
QAction * | mActionDescription |
QAction * | mActionExpDialog |
QAction * | mActionExpression |
QAction * | mActionPasteExpr |
QAction * | mActionCopyExpr |
QAction * | mActionClearExpr |
DataTypes | mDataTypes |
QString | mDataTypesString |
QString | mInputDescription |
QString | mFullDescription |
QString | mUsageInfo |
QString | mCurrentDefinition |
Static Private Attributes | |
static QIcon | mIconDataDefine |
static QIcon | mIconDataDefineOn |
static QIcon | mIconDataDefineError |
static QIcon | mIconDataDefineExpression |
static QIcon | mIconDataDefineExpressionOn |
static QIcon | mIconDataDefineExpressionError |
A button for defining data source field mappings or expressions.
Definition at line 34 of file qgsdatadefinedbutton.h.
Definition at line 39 of file qgsdatadefinedbutton.h.
QgsDataDefinedButton::QgsDataDefinedButton | ( | QWidget * | parent = 0 , |
const QgsVectorLayer * | vl = 0 , |
||
const QgsDataDefined * | datadefined = 0 , |
||
DataTypes | datatypes = AnyType , |
||
QString | description = QString( "" ) |
||
) |
Construct a new data defined button.
parent | The parent QWidget |
vl | Pointer to the associated vector layer |
datadefined | Data defined property |
datatypes | The expected data types to be compared against the variant type of the QgsField from data source and expression result |
description | The description of expected input data |
Definition at line 38 of file qgsdatadefinedbutton.cpp.
References aboutToShowMenu(), checkCheckedWidgets(), dataDefinedActivated(), disableEnabledWidgets(), QgsApplication::getThemeIcon(), init(), mActionActive, mActionClearExpr, mActionCopyExpr, mActionDataTypes, mActionDescription, mActionExpDialog, mActionExpression, mActionPasteExpr, mDefineMenu, menuActionTriggered(), mFieldsMenu, mIconDataDefine, mIconDataDefineError, mIconDataDefineExpression, mIconDataDefineExpressionError, mIconDataDefineExpressionOn, mIconDataDefineOn, and tr.
QgsDataDefinedButton::~QgsDataDefinedButton | ( | ) |
Definition at line 93 of file qgsdatadefinedbutton.cpp.
References mCheckedWidgets, and mEnabledWidgets.
|
privateslot |
Definition at line 209 of file qgsdatadefinedbutton.cpp.
References getExpression(), getField(), QgsExpression::hasParserError(), isActive(), mActionActive, mActionClearExpr, mActionCopyExpr, mActionDataTypes, mActionDescription, mActionExpDialog, mActionExpression, mActionPasteExpr, mDataTypesString, mDefineMenu, mFieldNameList, mFieldsMenu, mFieldTypeList, mFullDescription, tr, and useExpression().
Referenced by QgsDataDefinedButton().
|
static |
Definition at line 611 of file qgsdatadefinedbutton.cpp.
References tr.
|
static |
Definition at line 691 of file qgsdatadefinedbutton.cpp.
References trString().
|
static |
Definition at line 606 of file qgsdatadefinedbutton.cpp.
References tr.
|
slot |
Set siblings' checked property when data definition or expression is active.
Definition at line 577 of file qgsdatadefinedbutton.cpp.
References mCheckedWidgets.
Referenced by QgsDataDefinedButton().
|
inline |
Clears list of checkable sibling widgets.
Definition at line 168 of file qgsdatadefinedbutton.h.
|
inline |
Clears list of sibling widgets.
Definition at line 146 of file qgsdatadefinedbutton.h.
|
static |
Definition at line 671 of file qgsdatadefinedbutton.cpp.
References tr.
|
static |
Definition at line 666 of file qgsdatadefinedbutton.cpp.
References tr.
|
inline |
The current definition.
Definition at line 103 of file qgsdatadefinedbutton.h.
|
signal |
Emitted when active state changed.
active | Whether the definition is active |
Referenced by QgsDataDefinedButton(), and setActive().
|
signal |
Emitted when data definition or expression is changed.
definition | The current definition or expression (empty string if inactive) |
Referenced by updateGui().
|
inline |
Definition at line 77 of file qgsdatadefinedbutton.h.
|
slot |
Set siblings' enabled property when data definition or expression is set/unset.
Definition at line 542 of file qgsdatadefinedbutton.cpp.
References mEnabledWidgets.
Referenced by QgsDataDefinedButton().
|
static |
Definition at line 646 of file qgsdatadefinedbutton.cpp.
References tr.
|
static |
Definition at line 631 of file qgsdatadefinedbutton.cpp.
References tr.
|
static |
Definition at line 636 of file qgsdatadefinedbutton.cpp.
References tr.
|
static |
Definition at line 641 of file qgsdatadefinedbutton.cpp.
References tr.
|
inline |
The full definition description and current definition (internally generated on a contextual basis)
Definition at line 114 of file qgsdatadefinedbutton.h.
|
inline |
The current defined expression.
Definition at line 92 of file qgsdatadefinedbutton.h.
Referenced by aboutToShowMenu(), menuActionTriggered(), showExpressionDialog(), and updateGui().
|
inline |
The current defined field.
Definition at line 97 of file qgsdatadefinedbutton.h.
Referenced by aboutToShowMenu(), menuActionTriggered(), and updateGui().
void QgsDataDefinedButton::init | ( | const QgsVectorLayer * | vl, |
const QgsDataDefined * | datadefined = 0 , |
||
DataTypes | datatypes = AnyType , |
||
QString | description = QString( "" ) |
||
) |
Initialize a newly constructed data defined button (useful if button already included from form layout)
vl | Pointer to the associated vector layer |
datadefined | Data defined property |
datatypes | The expected data types to be compared against the variant type of the QgsField from data source and expression result |
description | The description of expected input data |
Definition at line 99 of file qgsdatadefinedbutton.cpp.
References AnyType, QgsFields::at(), QgsFields::count(), Double, QgsDataDefined::expressionString(), QgsDataDefined::field(), Int, QgsDataDefined::isActive(), mActionDataTypes, mCurrentDefinition, mDataTypes, mDataTypesString, mFieldNameList, mFieldTypeList, mFullDescription, mInputDescription, mProperty, mUsageInfo, mVectorLayer, QgsField::name(), QgsVectorLayer::pendingFields(), String, tr, QgsField::type(), updateGui(), and QgsDataDefined::useExpression().
Referenced by QgsDataDefinedButton().
|
static |
Definition at line 616 of file qgsdatadefinedbutton.cpp.
References tr.
|
static |
Definition at line 621 of file qgsdatadefinedbutton.cpp.
References tr.
|
static |
Definition at line 626 of file qgsdatadefinedbutton.cpp.
References tr.
|
static |
Definition at line 651 of file qgsdatadefinedbutton.cpp.
References tr.
|
inline |
Whether the current data definition or expression is to be used.
Definition at line 82 of file qgsdatadefinedbutton.h.
Referenced by aboutToShowMenu(), menuActionTriggered(), mouseReleaseEvent(), setActive(), and updateGui().
|
privateslot |
Definition at line 325 of file qgsdatadefinedbutton.cpp.
References getExpression(), getField(), isActive(), mActionActive, mActionClearExpr, mActionCopyExpr, mActionDescription, mActionExpDialog, mActionExpression, mActionPasteExpr, mFieldsMenu, setActive(), setExpression(), setField(), setUseExpression(), showDescriptionDialog(), showExpressionDialog(), updateGui(), and useExpression().
Referenced by QgsDataDefinedButton().
|
protected |
Definition at line 193 of file qgsdatadefinedbutton.cpp.
References isActive(), setActive(), and updateGui().
|
static |
Definition at line 686 of file qgsdatadefinedbutton.cpp.
References trString().
void QgsDataDefinedButton::registerCheckedWidget | ( | QWidget * | wdgt | ) |
Register a sibling widget that get checked when data definition or expression is active.
Definition at line 558 of file qgsdatadefinedbutton.cpp.
References mCheckedWidgets.
Referenced by registerCheckedWidgets().
void QgsDataDefinedButton::registerCheckedWidgets | ( | QList< QWidget * > | wdgts | ) |
Register list of sibling widgets that get checked when data definition or expression is active.
Definition at line 550 of file qgsdatadefinedbutton.cpp.
References registerCheckedWidget().
QList< QWidget * > QgsDataDefinedButton::registeredCheckedWidgets | ( | ) |
Return widget siblings that get checked when data definition or expression is active.
Definition at line 567 of file qgsdatadefinedbutton.cpp.
References mCheckedWidgets.
QList< QWidget * > QgsDataDefinedButton::registeredEnabledWidgets | ( | ) |
Return widget siblings that get disabled/enabled when data definition or expression is set/unset.
Definition at line 532 of file qgsdatadefinedbutton.cpp.
References mEnabledWidgets.
void QgsDataDefinedButton::registerEnabledWidget | ( | QWidget * | wdgt | ) |
Register a sibling widget that gets disabled/enabled when data definition or expression is set/unset.
Definition at line 523 of file qgsdatadefinedbutton.cpp.
References mEnabledWidgets.
Referenced by registerEnabledWidgets().
void QgsDataDefinedButton::registerEnabledWidgets | ( | QList< QWidget * > | wdgts | ) |
Register list of sibling widgets that get disabled/enabled when data definition or expression is set/unset.
Definition at line 515 of file qgsdatadefinedbutton.cpp.
References registerEnabledWidget().
|
slot |
Set whether the current data definition or expression is to be used.
Definition at line 506 of file qgsdatadefinedbutton.cpp.
References dataDefinedActivated(), isActive(), and mProperty.
Referenced by menuActionTriggered(), mouseReleaseEvent(), showExpressionDialog(), and updateGui().
|
inlineprotected |
Set the current defined expression.
Definition at line 234 of file qgsdatadefinedbutton.h.
Referenced by menuActionTriggered(), and showExpressionDialog().
|
inlineprotected |
Set the current defined field.
Definition at line 239 of file qgsdatadefinedbutton.h.
Referenced by menuActionTriggered().
|
inline |
Set the usage information about this data definition.
Definition at line 124 of file qgsdatadefinedbutton.h.
|
inlineprotected |
Set whether the current expression is to be used instead of field mapping.
Definition at line 229 of file qgsdatadefinedbutton.h.
Referenced by menuActionTriggered(), showExpressionDialog(), and updateGui().
|
private |
Definition at line 387 of file qgsdatadefinedbutton.cpp.
References mFullDescription, QgsMessageViewer::setMessageAsHtml(), and tr.
Referenced by menuActionTriggered().
|
private |
Definition at line 395 of file qgsdatadefinedbutton.cpp.
References QgsExpressionBuilderDialog::expressionText(), getExpression(), mVectorLayer, setActive(), setExpression(), setUseExpression(), and updateGui().
Referenced by menuActionTriggered().
|
static |
Definition at line 698 of file qgsdatadefinedbutton.cpp.
References trString().
|
static |
Definition at line 676 of file qgsdatadefinedbutton.cpp.
References trString().
|
static |
Definition at line 681 of file qgsdatadefinedbutton.cpp.
References trString().
|
static |
Common descriptions for expected input values.
Definition at line 600 of file qgsdatadefinedbutton.cpp.
References tr.
Referenced by blendModesDesc(), penJoinStyleDesc(), svgPathDesc(), textHorzAlignDesc(), textVertAlignDesc(), unitsMmMuDesc(), and unitsMmMuPercentDesc().
|
static |
Definition at line 656 of file qgsdatadefinedbutton.cpp.
References trString().
|
static |
Definition at line 661 of file qgsdatadefinedbutton.cpp.
References trString().
|
private |
Definition at line 411 of file qgsdatadefinedbutton.cpp.
References dataDefinedChanged(), getExpression(), getField(), QgsExpression::hasParserError(), icon(), isActive(), mCurrentDefinition, mDataTypesString, mFieldNameList, mFullDescription, mIconDataDefine, mIconDataDefineError, mIconDataDefineExpression, mIconDataDefineExpressionError, mIconDataDefineExpressionOn, mIconDataDefineOn, mInputDescription, mUsageInfo, QgsExpression::parserErrorString(), setActive(), setUseExpression(), tr, and useExpression().
Referenced by init(), menuActionTriggered(), mouseReleaseEvent(), and showExpressionDialog().
|
inline |
The usage information about this data definition.
Definition at line 119 of file qgsdatadefinedbutton.h.
|
inline |
Whether the current expression is to be used instead of field mapping.
Definition at line 87 of file qgsdatadefinedbutton.h.
Referenced by aboutToShowMenu(), menuActionTriggered(), and updateGui().
|
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 109 of file qgsdatadefinedbutton.h.
|
private |
Definition at line 258 of file qgsdatadefinedbutton.h.
Referenced by aboutToShowMenu(), menuActionTriggered(), and QgsDataDefinedButton().
|
private |
Definition at line 264 of file qgsdatadefinedbutton.h.
Referenced by aboutToShowMenu(), menuActionTriggered(), and QgsDataDefinedButton().
|
private |
Definition at line 263 of file qgsdatadefinedbutton.h.
Referenced by aboutToShowMenu(), menuActionTriggered(), and QgsDataDefinedButton().
|
private |
Definition at line 255 of file qgsdatadefinedbutton.h.
Referenced by aboutToShowMenu(), init(), and QgsDataDefinedButton().
|
private |
Definition at line 259 of file qgsdatadefinedbutton.h.
Referenced by aboutToShowMenu(), menuActionTriggered(), and QgsDataDefinedButton().
|
private |
Definition at line 260 of file qgsdatadefinedbutton.h.
Referenced by aboutToShowMenu(), menuActionTriggered(), and QgsDataDefinedButton().
|
private |
Definition at line 261 of file qgsdatadefinedbutton.h.
Referenced by aboutToShowMenu(), menuActionTriggered(), and QgsDataDefinedButton().
|
private |
Definition at line 262 of file qgsdatadefinedbutton.h.
Referenced by aboutToShowMenu(), menuActionTriggered(), and QgsDataDefinedButton().
|
private |
Definition at line 252 of file qgsdatadefinedbutton.h.
Referenced by checkCheckedWidgets(), registerCheckedWidget(), registeredCheckedWidgets(), and ~QgsDataDefinedButton().
|
private |
Definition at line 271 of file qgsdatadefinedbutton.h.
Referenced by init(), and updateGui().
|
private |
Definition at line 266 of file qgsdatadefinedbutton.h.
Referenced by init().
|
private |
Definition at line 267 of file qgsdatadefinedbutton.h.
Referenced by aboutToShowMenu(), init(), and updateGui().
|
private |
Definition at line 254 of file qgsdatadefinedbutton.h.
Referenced by aboutToShowMenu(), and QgsDataDefinedButton().
|
private |
Definition at line 251 of file qgsdatadefinedbutton.h.
Referenced by disableEnabledWidgets(), registeredEnabledWidgets(), registerEnabledWidget(), and ~QgsDataDefinedButton().
|
private |
Definition at line 248 of file qgsdatadefinedbutton.h.
Referenced by aboutToShowMenu(), init(), and updateGui().
|
private |
Definition at line 247 of file qgsdatadefinedbutton.h.
|
private |
Definition at line 256 of file qgsdatadefinedbutton.h.
Referenced by aboutToShowMenu(), menuActionTriggered(), and QgsDataDefinedButton().
|
private |
Definition at line 249 of file qgsdatadefinedbutton.h.
Referenced by aboutToShowMenu(), and init().
|
private |
Definition at line 269 of file qgsdatadefinedbutton.h.
Referenced by aboutToShowMenu(), init(), showDescriptionDialog(), and updateGui().
|
staticprivate |
Definition at line 273 of file qgsdatadefinedbutton.h.
Referenced by QgsDataDefinedButton(), and updateGui().
|
staticprivate |
Definition at line 275 of file qgsdatadefinedbutton.h.
Referenced by QgsDataDefinedButton(), and updateGui().
|
staticprivate |
Definition at line 276 of file qgsdatadefinedbutton.h.
Referenced by QgsDataDefinedButton(), and updateGui().
|
staticprivate |
Definition at line 278 of file qgsdatadefinedbutton.h.
Referenced by QgsDataDefinedButton(), and updateGui().
|
staticprivate |
Definition at line 277 of file qgsdatadefinedbutton.h.
Referenced by QgsDataDefinedButton(), and updateGui().
|
staticprivate |
Definition at line 274 of file qgsdatadefinedbutton.h.
Referenced by QgsDataDefinedButton(), and updateGui().
|
private |
Definition at line 268 of file qgsdatadefinedbutton.h.
Referenced by init(), and updateGui().
|
private |
Definition at line 250 of file qgsdatadefinedbutton.h.
Referenced by init(), and setActive().
|
private |
Definition at line 270 of file qgsdatadefinedbutton.h.
Referenced by init(), and updateGui().
|
private |
Definition at line 246 of file qgsdatadefinedbutton.h.
Referenced by init(), and showExpressionDialog().