[sip] fix editor widget bindings

This commit is contained in:
Matthias Kuhn 2015-11-20 15:31:23 +01:00
parent 182dd8a369
commit bbbf8a5a27
2 changed files with 10 additions and 45 deletions

View File

@ -13,7 +13,7 @@
* * * *
***************************************************************************/ ***************************************************************************/
class QgsEditorWidgetWrapper : QObject class QgsEditorWidgetWrapper : QgsWidgetWrapper
{ {
%TypeHeaderCode %TypeHeaderCode
#include <qgseditorwidgetwrapper.h> #include <qgseditorwidgetwrapper.h>
@ -30,35 +30,6 @@ class QgsEditorWidgetWrapper : QObject
*/ */
explicit QgsEditorWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor = 0, QWidget* parent /TransferThis/ = 0 ); explicit QgsEditorWidgetWrapper( QgsVectorLayer* vl, int fieldIdx, QWidget* editor = 0, QWidget* parent /TransferThis/ = 0 );
QWidget* widget();
virtual void setConfig( QMap<QString, QVariant> config );
/**
* Use this 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
*/
const QVariant config( const QString& key, const QVariant& defaultVal = QVariant() );
/**
* Returns the whole config
*
* @return The configuration
*/
const QgsEditorWidgetConfig config();
/**
* Access the QgsVectorLayer, you are working on
*
* @return The layer
*
* @see field()
*/
QgsVectorLayer* layer();
/** /**
* Will be used to access the widget's value. Read the value from the widget and * Will be used to access the widget's value. Read the value from the widget and
* return it properly formatted to be saved in the attribute. * return it properly formatted to be saved in the attribute.
@ -68,7 +39,7 @@ class QgsEditorWidgetWrapper : QObject
* *
* @return The current value the widget represents * @return The current value the widget represents
*/ */
virtual QVariant value() = 0; virtual QVariant value() const = 0;
/** /**
* Access the field index. * Access the field index.
@ -77,7 +48,7 @@ class QgsEditorWidgetWrapper : QObject
* *
* @see layer() * @see layer()
*/ */
int fieldIdx(); int fieldIdx() const;
/** /**
* Access the field. * Access the field.
@ -86,7 +57,7 @@ class QgsEditorWidgetWrapper : QObject
* *
* @see layer() * @see layer()
*/ */
QgsField field(); QgsField field() const;
/** /**
* Access the default value of the field. * Access the default value of the field.
@ -95,7 +66,7 @@ class QgsEditorWidgetWrapper : QObject
* *
* @see layer() * @see layer()
*/ */
QVariant defaultValue(); QVariant defaultValue() const;
/** /**
* Will return a wrapper for a given widget * Will return a wrapper for a given widget
@ -112,12 +83,6 @@ class QgsEditorWidgetWrapper : QObject
*/ */
void setEnabled( bool enabled ); void setEnabled( bool enabled );
virtual bool valid() = 0;
protected:
virtual QWidget* createWidget( QWidget* parent ) = 0;
virtual void initWidget( QWidget* editor );
signals: signals:
/** /**
* Emit this signal, whenever the value changed. * Emit this signal, whenever the value changed.

View File

@ -79,21 +79,21 @@ class QgsWidgetWrapper : QObject
* *
* @return the value assigned to this configuration option * @return the value assigned to this configuration option
*/ */
QVariant config( const QString& key, const QVariant& defaultVal = QVariant() ); QVariant config( const QString& key, const QVariant& defaultVal = QVariant() ) const;
/** /**
* Returns the whole config * Returns the whole config
* *
* @return The configuration * @return The configuration
*/ */
const QgsEditorWidgetConfig config(); QgsEditorWidgetConfig config() const;
/** /**
* Returns information about the context in which this widget is shown * Returns information about the context in which this widget is shown
* *
* @return context information * @return context information
*/ */
const QgsAttributeEditorContext& context(); const QgsAttributeEditorContext& context() const;
/** /**
* Access the QgsVectorLayer, you are working on * Access the QgsVectorLayer, you are working on
@ -102,7 +102,7 @@ class QgsWidgetWrapper : QObject
* *
* @see field() * @see field()
*/ */
QgsVectorLayer* layer(); QgsVectorLayer* layer() const;
/** /**
* Will return a wrapper for a given widget * Will return a wrapper for a given widget
@ -120,7 +120,7 @@ class QgsWidgetWrapper : QObject
* *
* @return Validity status of this widget. * @return Validity status of this widget.
*/ */
virtual bool valid() = 0; virtual bool valid() const = 0;
protected: protected:
/** /**