Skip to content
Permalink
Browse files

[sip] fix editor widget bindings

  • Loading branch information
m-kuhn committed Nov 20, 2015
1 parent 182dd8a commit bbbf8a5a27a07b9230f191ed6f291b614f86a9c2
@@ -13,7 +13,7 @@
* *
***************************************************************************/

class QgsEditorWidgetWrapper : QObject
class QgsEditorWidgetWrapper : QgsWidgetWrapper
{
%TypeHeaderCode
#include <qgseditorwidgetwrapper.h>
@@ -30,35 +30,6 @@ class QgsEditorWidgetWrapper : QObject
*/
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();

This comment has been minimized.

Copy link
@elpaso

elpaso Nov 20, 2015

Contributor

Why did you remove config getters?

This comment has been minimized.

Copy link
@m-kuhn

m-kuhn Nov 20, 2015

Author Member

They are properly inherited from QgsWidgetWrapper now

/**
* 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.
@@ -68,7 +39,7 @@ class QgsEditorWidgetWrapper : QObject
*
* @return The current value the widget represents
*/
virtual QVariant value() = 0;
virtual QVariant value() const = 0;

/**
* Access the field index.
@@ -77,7 +48,7 @@ class QgsEditorWidgetWrapper : QObject
*
* @see layer()
*/
int fieldIdx();
int fieldIdx() const;

/**
* Access the field.
@@ -86,7 +57,7 @@ class QgsEditorWidgetWrapper : QObject
*
* @see layer()
*/
QgsField field();
QgsField field() const;

/**
* Access the default value of the field.
@@ -95,7 +66,7 @@ class QgsEditorWidgetWrapper : QObject
*
* @see layer()
*/
QVariant defaultValue();
QVariant defaultValue() const;

/**
* Will return a wrapper for a given widget
@@ -112,12 +83,6 @@ class QgsEditorWidgetWrapper : QObject
*/
void setEnabled( bool enabled );

virtual bool valid() = 0;
protected:
virtual QWidget* createWidget( QWidget* parent ) = 0;

virtual void initWidget( QWidget* editor );

signals:
/**
* Emit this signal, whenever the value changed.
@@ -79,21 +79,21 @@ class QgsWidgetWrapper : QObject
*
* @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
*
* @return The configuration
*/
const QgsEditorWidgetConfig config();
QgsEditorWidgetConfig config() const;

/**
* Returns information about the context in which this widget is shown
*
* @return context information
*/
const QgsAttributeEditorContext& context();
const QgsAttributeEditorContext& context() const;

/**
* Access the QgsVectorLayer, you are working on
@@ -102,7 +102,7 @@ class QgsWidgetWrapper : QObject
*
* @see field()
*/
QgsVectorLayer* layer();
QgsVectorLayer* layer() const;

/**
* Will return a wrapper for a given widget
@@ -120,7 +120,7 @@ class QgsWidgetWrapper : QObject
*
* @return Validity status of this widget.
*/
virtual bool valid() = 0;
virtual bool valid() const = 0;

protected:
/**

0 comments on commit bbbf8a5

Please sign in to comment.
You can’t perform that action at this time.