Skip to content

Commit

Permalink
[sip] fix editor widget bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Nov 20, 2015
1 parent 182dd8a commit bbbf8a5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 45 deletions.
45 changes: 5 additions & 40 deletions python/gui/editorwidgets/core/qgseditorwidgetwrapper.sip
Expand Up @@ -13,7 +13,7 @@
* *
***************************************************************************/

class QgsEditorWidgetWrapper : QObject
class QgsEditorWidgetWrapper : QgsWidgetWrapper
{
%TypeHeaderCode
#include <qgseditorwidgetwrapper.h>
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -77,7 +48,7 @@ class QgsEditorWidgetWrapper : QObject
*
* @see layer()
*/
int fieldIdx();
int fieldIdx() const;

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

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

/**
* Will return a wrapper for a given widget
Expand All @@ -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.
Expand Down
10 changes: 5 additions & 5 deletions python/gui/editorwidgets/core/qgswidgetwrapper.sip
Expand Up @@ -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
Expand All @@ -102,7 +102,7 @@ class QgsWidgetWrapper : QObject
*
* @see field()
*/
QgsVectorLayer* layer();
QgsVectorLayer* layer() const;

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

protected:
/**
Expand Down

0 comments on commit bbbf8a5

Please sign in to comment.