QGIS/python/gui/editorwidgets/core/qgswidgetwrapper.sip

219 lines
6.5 KiB
Plaintext
Raw Normal View History

2017-05-08 08:36:06 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/editorwidgets/core/qgswidgetwrapper.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
// This is required for the ConvertToSubClassCode to work properly
// so RTTI for casting is available in the whole module.
%ModuleCode
#include "qgsrelationwidgetwrapper.h"
%End
class QgsWidgetWrapper : QObject
{
2017-05-08 08:36:06 +02:00
%Docstring
Manages an editor widget
Widget and wrapper share the same parent
A wrapper controls one attribute editor widget and is able to create a default
widget or use a pre-existent widget. It is able to set the widget to the value implied
by a field of a vector layer, or return the value it currently holds. Every time it is changed
it has to emit a valueChanged signal. If it fails to do so, there is no guarantee that the
changed status of the widget will be saved.
%End
%TypeHeaderCode
#include "qgswidgetwrapper.h"
%End
%ConvertToSubClassCode
2017-05-08 08:36:06 +02:00
if ( qobject_cast<QgsEditorWidgetWrapper *>( sipCpp ) )
sipType = sipType_QgsEditorWidgetWrapper;
else if ( qobject_cast<QgsRelationWidgetWrapper *>( sipCpp ) )
sipType = sipType_QgsRelationWidgetWrapper;
else
sipType = 0;
%End
public:
2017-05-08 08:36:06 +02:00
enum Property
{
2017-05-08 08:36:06 +02:00
RootPath,
};
2017-05-08 08:36:06 +02:00
static const QgsPropertiesDefinition &propertyDefinitions();
2017-05-08 08:36:06 +02:00
%Docstring
Returns the editor widget property definitions.
.. versionadded:: 3.0
:rtype: QgsPropertiesDefinition
%End
explicit QgsWidgetWrapper( QgsVectorLayer *vl, QWidget *editor = 0, QWidget *parent = 0 );
%Docstring
Create a new widget wrapper
\param vl The layer on which the field is
\param editor An editor widget. Can be NULL if one should be autogenerated.
\param parent A parent widget for this widget wrapper and the created widget.
%End
QWidget *widget();
2017-05-08 08:36:06 +02:00
%Docstring
Access the widget managed by this wrapper
:return: The widget
:rtype: QWidget
%End
void setConfig( const QVariantMap &config );
2017-05-08 08:36:06 +02:00
%Docstring
Will set the config of this wrapper to the specified config.
\param config The config for this wrapper
%End
void setContext( const QgsAttributeEditorContext &context );
2017-05-08 08:36:06 +02:00
%Docstring
Set the context in which this widget is shown
\param context context information
%End
QVariant config( const QString &key, const QVariant &defaultVal = QVariant() ) const;
2017-05-08 08:36:06 +02:00
%Docstring
Use this inside your overridden classes to access the configuration.
\param key The configuration option you want to load
\param defaultVal Default value
:return: the value assigned to this configuration option
:rtype: QVariant
%End
QVariantMap config() const;
2017-05-08 08:36:06 +02:00
%Docstring
Returns the whole config
:return: The configuration
:rtype: QVariantMap
%End
const QgsAttributeEditorContext &context() const;
2017-05-08 08:36:06 +02:00
%Docstring
Returns information about the context in which this widget is shown
:return: context information
:rtype: QgsAttributeEditorContext
%End
QgsVectorLayer *layer() const;
2017-05-08 08:36:06 +02:00
%Docstring
Access the QgsVectorLayer, you are working on
:return: The layer
.. seealso:: field()
:rtype: QgsVectorLayer
%End
static QgsWidgetWrapper *fromWidget( QWidget *widget );
2017-05-08 08:36:06 +02:00
%Docstring
Will return a wrapper for a given widget
\param widget The widget which was created by a wrapper
:return: The wrapper for the widget or NULL
:rtype: QgsWidgetWrapper
%End
2015-11-20 15:31:23 +01:00
virtual bool valid() const = 0;
2017-05-08 08:36:06 +02:00
%Docstring
Return true if the widget has been properly initialized.
This acts as hint for the calling party if this wrapper can be used
after initializing it.
If it cannot be used this is a hint to the caller that he may try to find
another suitable widget type instead.
:return: Validity status of this widget.
.. versionadded:: 2.12
:rtype: bool
%End
const QgsPropertyCollection &dataDefinedProperties() const;
2017-05-08 08:36:06 +02:00
%Docstring
Returns a reference to the editor widget's property collection, used for data defined overrides.
.. versionadded:: 3.0
.. seealso:: setDataDefinedProperties()
:rtype: QgsPropertyCollection
%End
void setDataDefinedProperties( const QgsPropertyCollection &collection );
2017-05-08 08:36:06 +02:00
%Docstring
Sets the editor widget's property collection, used for data defined overrides.
\param collection property collection. Existing properties will be replaced.
.. versionadded:: 3.0
.. seealso:: dataDefinedProperties()
%End
protected:
2017-05-08 08:36:06 +02:00
virtual QWidget *createWidget( QWidget *parent ) = 0;
2017-05-08 08:36:06 +02:00
%Docstring
This method should create a new widget with the provided parent. This will only be called
if the form did not already provide a widget, so it is not guaranteed to be called!
You should not do initialization stuff, which also has to be done for custom editor
widgets inside this method. Things like filling comboboxes and assigning other data which
will also be used to make widgets on forms created in the QtDesigner usable should be assigned
in initWidget().
\param parent You should set this parent on the created widget.
:return: A new widget
:rtype: QWidget
%End
virtual void initWidget( QWidget *editor );
2017-05-08 08:36:06 +02:00
%Docstring
This method should initialize the editor widget with runtime data. Fill your comboboxes here.
\param editor The widget which will represent this attribute editor in a form.
%End
public slots:
2017-05-08 08:36:06 +02:00
virtual void setFeature( const QgsFeature &feature ) = 0;
2017-05-08 08:36:06 +02:00
%Docstring
Is called, when the value of the widget needs to be changed. Update the widget representation
to reflect the new value.
\param feature The new feature
%End
virtual void setEnabled( bool enabled );
2017-05-08 08:36:06 +02:00
%Docstring
Is used to enable or disable the edit functionality of the managed widget.
By default this will not change the enabled state of the widget
\param enabled Enable or Disable?
%End
};
2017-05-08 08:36:06 +02:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/editorwidgets/core/qgswidgetwrapper.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/