QGIS API Documentation  2.8.2-Wien
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Slots | Signals | Public Member Functions | List of all members
QgsAttributeForm Class Reference

#include <qgsattributeform.h>

Public Slots

Q_DECL_DEPRECATED void accept ()
 Alias for save()
void changeAttribute (const QString &field, const QVariant &value)
 Call this to change the content of a given attribute.
Q_DECL_DEPRECATED void reject ()
 Alias for resetValues()
void resetValues ()
 Sets all values to the values of the current feature.
bool save ()
 Save all the values from the editors to the layer.
void setFeature (const QgsFeature &feature)
 Update all editors to correspond to a different feature.

Signals

void attributeChanged (QString attribute, const QVariant &value)
 Notifies about changes of attributes.
void beforeSave (bool &ok)
 Will be emitted before the feature is saved.
void featureSaved (const QgsFeature &feature)
 Is emitted, when a feature is changed or added.

Public Member Functions

 QgsAttributeForm (QgsVectorLayer *vl, const QgsFeature &feature=QgsFeature(), const QgsAttributeEditorContext &context=QgsAttributeEditorContext(), QWidget *parent=0)
 ~QgsAttributeForm ()
void addInterface (QgsAttributeFormInterface *iface)
 Takes ownership.
void disconnectButtonBox ()
 Disconnects the button box (Ok/Cancel) from the accept/resetValues slots If this method is called, you have to create these connections from outside.
bool editable ()
 Returns if the form is currently in editable mode.
bool eventFilter (QObject *object, QEvent *event) override
 Intercepts keypress on custom form (escape should not close it)
const QgsFeaturefeature ()
void hideButtonBox ()
 Hides the button box (Ok/Cancel) and enables auto-commit.
QgsVectorLayerlayer ()
 Returns the layer for which this form is shown.
void setEditCommandMessage (const QString &message)
 Sets the edit command message (Undo) that will be used when the dialog is accepted.
void setIsAddDialog (bool isAddDialog)
 Toggles the form mode between edit feature and add feature.
void showButtonBox ()
 Shows the button box (Ok/Cancel) and disables auto-commit.

Detailed Description

Definition at line 29 of file qgsattributeform.h.

Constructor & Destructor Documentation

QgsAttributeForm::QgsAttributeForm ( QgsVectorLayer vl,
const QgsFeature feature = QgsFeature(),
const QgsAttributeEditorContext context = QgsAttributeEditorContext(),
QWidget *  parent = 0 
)
explicit

Definition at line 40 of file qgsattributeform.cpp.

QgsAttributeForm::~QgsAttributeForm ( )

Definition at line 58 of file qgsattributeform.cpp.

Member Function Documentation

Q_DECL_DEPRECATED void QgsAttributeForm::accept ( )
inlineslot

Alias for save()

Deprecated:

Definition at line 153 of file qgsattributeform.h.

void QgsAttributeForm::addInterface ( QgsAttributeFormInterface iface)

Takes ownership.

Parameters
iface

Definition at line 86 of file qgsattributeform.cpp.

void QgsAttributeForm::attributeChanged ( QString  attribute,
const QVariant &  value 
)
signal

Notifies about changes of attributes.

Parameters
attributeThe name of the attribute that changed.
valueThe new value of the attribute.
void QgsAttributeForm::beforeSave ( bool &  ok)
signal

Will be emitted before the feature is saved.

Use this signal to perform sanity checks. You can set the parameter ok to false to notify the form that you don't want it to be saved. If you want the form to be saved, leave the parameter untouched.

Parameters
okSet this parameter to false if you don't want the form to be saved
Note
not available in python bindings
void QgsAttributeForm::changeAttribute ( const QString &  field,
const QVariant &  value 
)
slot

Call this to change the content of a given attribute.

Will update the editor(s) related to this field.

Parameters
fieldThe field to change
valueThe new value

Definition at line 103 of file qgsattributeform.cpp.

void QgsAttributeForm::disconnectButtonBox ( )

Disconnects the button box (Ok/Cancel) from the accept/resetValues slots If this method is called, you have to create these connections from outside.

Definition at line 80 of file qgsattributeform.cpp.

bool QgsAttributeForm::editable ( )

Returns if the form is currently in editable mode.

Returns
Editable mode of this form

Definition at line 91 of file qgsattributeform.cpp.

bool QgsAttributeForm::eventFilter ( QObject *  object,
QEvent *  event 
)
override

Intercepts keypress on custom form (escape should not close it)

Parameters
objectThe object for which the event has been sent
eventThe event which is being filtered
Returns
true if the event has been handled (key was ESC)

Definition at line 764 of file qgsattributeform.cpp.

const QgsFeature& QgsAttributeForm::feature ( )
inline

Definition at line 37 of file qgsattributeform.h.

void QgsAttributeForm::featureSaved ( const QgsFeature feature)
signal

Is emitted, when a feature is changed or added.

void QgsAttributeForm::hideButtonBox ( )

Hides the button box (Ok/Cancel) and enables auto-commit.

Definition at line 64 of file qgsattributeform.cpp.

QgsVectorLayer* QgsAttributeForm::layer ( )
inline

Returns the layer for which this form is shown.

Returns
Layer

Definition at line 66 of file qgsattributeform.h.

Q_DECL_DEPRECATED void QgsAttributeForm::reject ( )
inlineslot

Alias for resetValues()

Deprecated:

Definition at line 160 of file qgsattributeform.h.

void QgsAttributeForm::resetValues ( )
slot

Sets all values to the values of the current feature.

Definition at line 257 of file qgsattributeform.cpp.

bool QgsAttributeForm::save ( )
slot

Save all the values from the editors to the layer.

Returns
True if successful

Definition at line 129 of file qgsattributeform.cpp.

void QgsAttributeForm::setEditCommandMessage ( const QString &  message)
inline

Sets the edit command message (Undo) that will be used when the dialog is accepted.

Parameters
messageThe message

Definition at line 89 of file qgsattributeform.h.

void QgsAttributeForm::setFeature ( const QgsFeature feature)
slot

Update all editors to correspond to a different feature.

Parameters
featureThe feature which will be represented by the form

Definition at line 115 of file qgsattributeform.cpp.

void QgsAttributeForm::setIsAddDialog ( bool  isAddDialog)

Toggles the form mode between edit feature and add feature.

If set to true, the dialog will be editable even with an invalid feature. If set to true, the dialog will add a new feature when the form is accepted.

Parameters
isAddDialogIf set to true, turn this dialog into an add feature dialog.

Definition at line 96 of file qgsattributeform.cpp.

void QgsAttributeForm::showButtonBox ( )

Shows the button box (Ok/Cancel) and disables auto-commit.

Definition at line 73 of file qgsattributeform.cpp.


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