QGIS API Documentation  2.6.0-Brighton
 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

void changeAttribute (const QString &field, const QVariant &value)
 Call this to change the content of a given attribute.
void setFeature (const QgsFeature &feature)
 Update all editors to correspond to a different feature.
bool save ()
 Save all the values from the editors to the layer.
Q_DECL_DEPRECATED void accept ()
 Alias for save()
Q_DECL_DEPRECATED void reject ()
 Alias for resetValues()
void resetValues ()
 Sets all values to the values of the current 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(), QgsAttributeEditorContext context=QgsAttributeEditorContext(), QWidget *parent=0)
 ~QgsAttributeForm ()
const QgsFeaturefeature ()
void hideButtonBox ()
 Hides the button box (Ok/Cancel) and enables auto-commit.
void showButtonBox ()
 Shows the button box (Ok/Cancel) and disables auto-commit.
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.
void addInterface (QgsAttributeFormInterface *iface)
 Takes ownership.
QgsVectorLayerlayer ()
 Returns the layer for which this form is shown.
bool editable ()
 Returns if the form is currently in editable mode.
void setIsAddDialog (bool isAddDialog)
 Toggles the form mode between edit feature and add feature.
void setEditCommandMessage (const QString &message)
 Sets the edit command message (Undo) that will be used when the dialog is accepted.
bool eventFilter (QObject *object, QEvent *event)
 Intercepts keypress on custom form (escape should not close it)

Constructor & Destructor Documentation

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

Member Function Documentation

Q_DECL_DEPRECATED void QgsAttributeForm::accept ( )
inlineslot

Alias for save()

Deprecated:
void QgsAttributeForm::addInterface ( QgsAttributeFormInterface iface)

Takes ownership.

Parameters
iface
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
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.

bool QgsAttributeForm::editable ( )

Returns if the form is currently in editable mode.

Returns
Editable mode of this form
bool QgsAttributeForm::eventFilter ( QObject *  object,
QEvent *  event 
)

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)
const QgsFeature& QgsAttributeForm::feature ( )
inline
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.

QgsVectorLayer* QgsAttributeForm::layer ( )
inline

Returns the layer for which this form is shown.

Returns
Layer
Q_DECL_DEPRECATED void QgsAttributeForm::reject ( )
inlineslot
void QgsAttributeForm::resetValues ( )
slot

Sets all values to the values of the current feature.

bool QgsAttributeForm::save ( )
slot

Save all the values from the editors to the layer.

Returns
True if successful
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
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
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.
void QgsAttributeForm::showButtonBox ( )

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


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