1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236
|
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/editorwidgets/core/qgswidgetwrapper.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
// This is required for the ConvertToSubClassCode to work properly
// so RTTI for casting is available in the whole module.
%ModuleCode
#include "qgsrelationwidgetwrapper.h"
#include "qgsqmlwidgetwrapper.h"
#include "qgshtmlwidgetwrapper.h"
%End
class QgsWidgetWrapper : QObject
{
%Docstring(signature="appended")
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
if ( qobject_cast<QgsEditorWidgetWrapper *>( sipCpp ) )
sipType = sipType_QgsEditorWidgetWrapper;
else if ( qobject_cast<QgsRelationWidgetWrapper *>( sipCpp ) )
sipType = sipType_QgsRelationWidgetWrapper;
else if ( qobject_cast<QgsQmlWidgetWrapper *>( sipCpp ) )
sipType = sipType_QgsQmlWidgetWrapper;
else if ( qobject_cast<QgsHtmlWidgetWrapper *>( sipCpp ) )
sipType = sipType_QgsHtmlWidgetWrapper;
else
sipType = 0;
%End
public:
enum class Property
{
RootPath,
DocumentViewerContent,
StorageUrl
};
static const QgsPropertiesDefinition &propertyDefinitions();
%Docstring
Returns the editor widget property definitions.
%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 ``None`` if one should be
autogenerated.
:param parent: A parent widget for this widget wrapper and the created
widget.
%End
QWidget *widget();
%Docstring
Access the widget managed by this wrapper
:return: The widget
%End
void setConfig( const QVariantMap &config );
%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 );
%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;
%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
%End
QVariantMap config() const;
%Docstring
Returns the whole config
%End
const QgsAttributeEditorContext &context() const;
%Docstring
Returns information about the context in which this widget is shown
%End
QgsVectorLayer *layer() const;
%Docstring
Returns the vector layer associated with the widget.
%End
static QgsWidgetWrapper *fromWidget( QWidget *widget );
%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 ``None``
%End
virtual bool valid() const = 0;
%Docstring
Returns ``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.
%End
const QgsPropertyCollection &dataDefinedProperties() const;
%Docstring
Returns a reference to the editor widget's property collection, used for
data defined overrides.
.. seealso:: :py:func:`setDataDefinedProperties`
.. seealso:: Property
%End
void setDataDefinedProperties( const QgsPropertyCollection &collection );
%Docstring
Sets the editor widget's property collection, used for data defined
overrides.
:param collection: property collection. Existing properties will be
replaced.
.. seealso:: :py:func:`dataDefinedProperties`
.. seealso:: Property
%End
void notifyAboutToSave();
%Docstring
Notify this widget, that the containing form is about to save and that
any pending changes should be pushed to the edit buffer or they might be
lost.
.. versionadded:: 3.2
%End
signals:
void contextChanged();
%Docstring
Signal when :py:class:`QgsAttributeEditorContext` mContext changed
.. versionadded:: 3.4
%End
protected:
virtual QWidget *createWidget( QWidget *parent ) = 0;
%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 :py:func:`~QgsWidgetWrapper.initWidget`.
:param parent: You should set this parent on the created widget.
:return: A new widget
%End
virtual void initWidget( QWidget *editor );
%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:
virtual void setFeature( const QgsFeature &feature ) = 0;
%Docstring
Is called when the value of the widget needs to be changed. Updates the
widget representation to reflect the new value.
:param feature: The new feature
%End
virtual void setEnabled( bool enabled );
%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
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/gui/editorwidgets/core/qgswidgetwrapper.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
|