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

#include <qgsattributeform.h>

Inheritance diagram for QgsAttributeForm:
Inheritance graph
[legend]

Public Slots

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

Signals

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

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. More...
 
void showButtonBox ()
 Shows the button box (Ok/Cancel) and disables auto-commit. More...
 
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. More...
 
void addInterface (QgsAttributeFormInterface *iface)
 Takes ownership. More...
 
QgsVectorLayerlayer ()
 Returns the layer for which this form is shown. More...
 
bool editable ()
 Returns if the form is currently in editable mode. More...
 
void setIsAddDialog (bool isAddDialog)
 Toggles the form mode between edit feature and add feature. More...
 
void setEditCommandMessage (const QString &message)
 Sets the edit command message (Undo) that will be used when the dialog is accepted. More...
 
bool eventFilter (QObject *object, QEvent *event)
 Intercepts keypress on custom form (escape should not close it) More...
 

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: