Skip to content

Commit

Permalink
Constification
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Nov 20, 2015
1 parent 4180c1e commit 182dd8a
Show file tree
Hide file tree
Showing 44 changed files with 88 additions and 88 deletions.
6 changes: 3 additions & 3 deletions src/gui/editorwidgets/core/qgseditorwidgetwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,20 @@ QgsEditorWidgetWrapper::QgsEditorWidgetWrapper( QgsVectorLayer* vl, int fieldIdx
{
}

int QgsEditorWidgetWrapper::fieldIdx()
int QgsEditorWidgetWrapper::fieldIdx() const
{
return mFieldIdx;
}

QgsField QgsEditorWidgetWrapper::field()
QgsField QgsEditorWidgetWrapper::field() const
{
if ( mFieldIdx < layer()->fields().count() )
return layer()->fields().at( mFieldIdx );
else
return QgsField();
}

QVariant QgsEditorWidgetWrapper::defaultValue()
QVariant QgsEditorWidgetWrapper::defaultValue() const
{
return layer()->dataProvider()->defaultValue( mFieldIdx );
}
Expand Down
8 changes: 4 additions & 4 deletions src/gui/editorwidgets/core/qgseditorwidgetwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class GUI_EXPORT QgsEditorWidgetWrapper : public QgsWidgetWrapper
*
* @return The current value the widget represents
*/
virtual QVariant value() = 0;
virtual QVariant value() const = 0;

/**
* Access the field index.
Expand All @@ -70,7 +70,7 @@ class GUI_EXPORT QgsEditorWidgetWrapper : public QgsWidgetWrapper
*
* @see layer()
*/
int fieldIdx();
int fieldIdx() const;

/**
* Access the field.
Expand All @@ -79,7 +79,7 @@ class GUI_EXPORT QgsEditorWidgetWrapper : public QgsWidgetWrapper
*
* @see layer()
*/
QgsField field();
QgsField field() const;

/**
* Access the default value of the field.
Expand All @@ -88,7 +88,7 @@ class GUI_EXPORT QgsEditorWidgetWrapper : public QgsWidgetWrapper
*
* @see layer()
*/
QVariant defaultValue();
QVariant defaultValue() const;

/**
* Will return a wrapper for a given widget
Expand Down
8 changes: 4 additions & 4 deletions src/gui/editorwidgets/core/qgswidgetwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void QgsWidgetWrapper::setContext( const QgsAttributeEditorContext &context )
mContext = context;
}

const QVariant QgsWidgetWrapper::config( const QString& key, const QVariant& defaultVal )
QVariant QgsWidgetWrapper::config( const QString& key, const QVariant& defaultVal ) const
{
if ( mConfig.contains( key ) )
{
Expand All @@ -61,17 +61,17 @@ const QVariant QgsWidgetWrapper::config( const QString& key, const QVariant& def
return defaultVal;
}

const QgsEditorWidgetConfig QgsWidgetWrapper::config()
QgsEditorWidgetConfig QgsWidgetWrapper::config() const
{
return mConfig;
}

const QgsAttributeEditorContext& QgsWidgetWrapper::context()
const QgsAttributeEditorContext& QgsWidgetWrapper::context() const
{
return mContext;
}

QgsVectorLayer* QgsWidgetWrapper::layer()
QgsVectorLayer* QgsWidgetWrapper::layer() const
{
return mLayer;
}
Expand Down
10 changes: 5 additions & 5 deletions src/gui/editorwidgets/core/qgswidgetwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,21 +87,21 @@ class GUI_EXPORT QgsWidgetWrapper : public QObject
*
* @return the value assigned to this configuration option
*/
const 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 @@ -110,7 +110,7 @@ class GUI_EXPORT QgsWidgetWrapper : public QObject
*
* @see field()
*/
QgsVectorLayer* layer();
QgsVectorLayer* layer() const;

/**
* Will return a wrapper for a given widget
Expand All @@ -130,7 +130,7 @@ class GUI_EXPORT QgsWidgetWrapper : public QObject
*
* @note Added in 2.12
*/
virtual bool valid() = 0;
virtual bool valid() const = 0;

protected:
/**
Expand Down
4 changes: 2 additions & 2 deletions src/gui/editorwidgets/qgscheckboxwidgetwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ QgsCheckboxWidgetWrapper::QgsCheckboxWidgetWrapper( QgsVectorLayer* vl, int fiel
}


QVariant QgsCheckboxWidgetWrapper::value()
QVariant QgsCheckboxWidgetWrapper::value() const
{
QVariant v;

Expand Down Expand Up @@ -53,7 +53,7 @@ void QgsCheckboxWidgetWrapper::initWidget( QWidget* editor )
connect( mGroupBox, SIGNAL( toggled( bool ) ), this, SLOT( valueChanged( bool ) ) );
}

bool QgsCheckboxWidgetWrapper::valid()
bool QgsCheckboxWidgetWrapper::valid() const
{
return mCheckBox || mGroupBox;
}
Expand Down
4 changes: 2 additions & 2 deletions src/gui/editorwidgets/qgscheckboxwidgetwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ class GUI_EXPORT QgsCheckboxWidgetWrapper : public QgsEditorWidgetWrapper

// QgsEditorWidgetWrapper interface
public:
QVariant value() override;
QVariant value() const override;

protected:
QWidget* createWidget( QWidget* parent ) override;
void initWidget( QWidget* editor ) override;
bool valid() override;
bool valid() const override;

public slots:
void setValue( const QVariant& value ) override;
Expand Down
4 changes: 2 additions & 2 deletions src/gui/editorwidgets/qgsclassificationwidgetwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ QgsClassificationWidgetWrapper::QgsClassificationWidgetWrapper( QgsVectorLayer*
{
}

QVariant QgsClassificationWidgetWrapper::value()
QVariant QgsClassificationWidgetWrapper::value() const
{
return mComboBox->itemData( mComboBox->currentIndex() );
}
Expand Down Expand Up @@ -59,7 +59,7 @@ void QgsClassificationWidgetWrapper::initWidget( QWidget* editor )
}
}

bool QgsClassificationWidgetWrapper::valid()
bool QgsClassificationWidgetWrapper::valid() const
{
return mComboBox;
}
Expand Down
4 changes: 2 additions & 2 deletions src/gui/editorwidgets/qgsclassificationwidgetwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ class GUI_EXPORT QgsClassificationWidgetWrapper : public QgsEditorWidgetWrapper

// QgsEditorWidgetWrapper interface
public:
QVariant value() override;
QVariant value() const override;

protected:
QWidget*createWidget( QWidget* parent ) override;
void initWidget( QWidget* editor ) override;
bool valid() override;
bool valid() const override;

public slots:
void setValue( const QVariant& value ) override;
Expand Down
4 changes: 2 additions & 2 deletions src/gui/editorwidgets/qgscolorwidgetwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ QgsColorWidgetWrapper::QgsColorWidgetWrapper( QgsVectorLayer* vl, int fieldIdx,
}


QVariant QgsColorWidgetWrapper::value()
QVariant QgsColorWidgetWrapper::value() const
{
QVariant v;

Expand All @@ -46,7 +46,7 @@ void QgsColorWidgetWrapper::initWidget( QWidget* editor )
connect( mColorButton, SIGNAL( colorChanged( QColor ) ), this, SLOT( valueChanged() ) );
}

bool QgsColorWidgetWrapper::valid()
bool QgsColorWidgetWrapper::valid() const
{
return mColorButton;
}
Expand Down
4 changes: 2 additions & 2 deletions src/gui/editorwidgets/qgscolorwidgetwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ class GUI_EXPORT QgsColorWidgetWrapper : public QgsEditorWidgetWrapper

// QgsEditorWidgetWrapper interface
public:
QVariant value() override;
QVariant value() const override;

protected:
QWidget* createWidget( QWidget* parent ) override;
void initWidget( QWidget* editor ) override;
bool valid() override;
bool valid() const override;

public slots:
void setValue( const QVariant& value ) override;
Expand Down
4 changes: 2 additions & 2 deletions src/gui/editorwidgets/qgsdatetimeeditwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ void QgsDateTimeEditWrapper::initWidget( QWidget *editor )
}
}

bool QgsDateTimeEditWrapper::valid()
bool QgsDateTimeEditWrapper::valid() const
{
return mQgsDateTimeEdit || mQDateTimeEdit;
}
Expand All @@ -101,7 +101,7 @@ void QgsDateTimeEditWrapper::dateTimeChanged( const QDateTime& dateTime )
emit valueChanged( dateTime.toString( fieldFormat ) );
}

QVariant QgsDateTimeEditWrapper::value()
QVariant QgsDateTimeEditWrapper::value() const
{
if ( !mQDateTimeEdit )
return QVariant( field().type() );
Expand Down
4 changes: 2 additions & 2 deletions src/gui/editorwidgets/qgsdatetimeeditwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ class GUI_EXPORT QgsDateTimeEditWrapper : public QgsEditorWidgetWrapper

// QgsEditorWidgetWrapper interface
public:
QVariant value() override;
QVariant value() const override;
QWidget *createWidget( QWidget *parent ) override;
void initWidget( QWidget *editor ) override;
bool valid() override;
bool valid() const override;

public slots:
void setValue( const QVariant &value ) override;
Expand Down
2 changes: 1 addition & 1 deletion src/gui/editorwidgets/qgsdefaultsearchwidgetwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void QgsDefaultSearchWidgetWrapper::initWidget( QWidget* widget )
mCaseString = "ILIKE";
}

bool QgsDefaultSearchWidgetWrapper::valid()
bool QgsDefaultSearchWidgetWrapper::valid() const
{
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/gui/editorwidgets/qgsdefaultsearchwidgetwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class GUI_EXPORT QgsDefaultSearchWidgetWrapper : public QgsSearchWidgetWrapper
protected:
QWidget* createWidget( QWidget* parent ) override;
void initWidget( QWidget* editor ) override;
bool valid() override;
bool valid() const override;

private:
QgsFilterLineEdit* mLineEdit;
Expand Down
4 changes: 2 additions & 2 deletions src/gui/editorwidgets/qgsenumerationwidgetwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ QgsEnumerationWidgetWrapper::QgsEnumerationWidgetWrapper( QgsVectorLayer* vl, in
}


QVariant QgsEnumerationWidgetWrapper::value()
QVariant QgsEnumerationWidgetWrapper::value() const
{
QVariant value;

Expand Down Expand Up @@ -57,7 +57,7 @@ void QgsEnumerationWidgetWrapper::initWidget( QWidget* editor )
}
}

bool QgsEnumerationWidgetWrapper::valid()
bool QgsEnumerationWidgetWrapper::valid() const
{
return mComboBox;
}
Expand Down
4 changes: 2 additions & 2 deletions src/gui/editorwidgets/qgsenumerationwidgetwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ class GUI_EXPORT QgsEnumerationWidgetWrapper : public QgsEditorWidgetWrapper

// QgsEditorWidgetWrapper interface
public:
QVariant value() override;
QVariant value() const override;

protected:
QWidget* createWidget( QWidget* parent ) override;
void initWidget( QWidget* editor ) override;
bool valid() override;
bool valid() const override;

public slots:
void setValue( const QVariant& value ) override;
Expand Down
4 changes: 2 additions & 2 deletions src/gui/editorwidgets/qgsfilenamewidgetwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ QgsFileNameWidgetWrapper::QgsFileNameWidgetWrapper( QgsVectorLayer* vl, int fiel
{
}

QVariant QgsFileNameWidgetWrapper::value()
QVariant QgsFileNameWidgetWrapper::value() const
{
QVariant value;

Expand All @@ -48,7 +48,7 @@ QVariant QgsFileNameWidgetWrapper::value()
return value;
}

bool QgsFileNameWidgetWrapper::valid()
bool QgsFileNameWidgetWrapper::valid() const
{
return mLineEdit || mLabel;
}
Expand Down
4 changes: 2 additions & 2 deletions src/gui/editorwidgets/qgsfilenamewidgetwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ class GUI_EXPORT QgsFileNameWidgetWrapper : public QgsEditorWidgetWrapper

// QgsEditorWidgetWrapper interface
public:
QVariant value() override;
bool valid() override;
QVariant value() const override;
bool valid() const override;

protected:
QWidget* createWidget( QWidget* parent ) override;
Expand Down
4 changes: 2 additions & 2 deletions src/gui/editorwidgets/qgshiddenwidgetwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ QgsHiddenWidgetWrapper::QgsHiddenWidgetWrapper( QgsVectorLayer* vl, int fieldIdx
}


QVariant QgsHiddenWidgetWrapper::value()
QVariant QgsHiddenWidgetWrapper::value() const
{
return mValue;
}
Expand All @@ -40,7 +40,7 @@ void QgsHiddenWidgetWrapper::initWidget( QWidget* editor )
editor->setVisible( false );
}

bool QgsHiddenWidgetWrapper::valid()
bool QgsHiddenWidgetWrapper::valid() const
{
return true;
}
Expand Down
4 changes: 2 additions & 2 deletions src/gui/editorwidgets/qgshiddenwidgetwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ class GUI_EXPORT QgsHiddenWidgetWrapper : public QgsEditorWidgetWrapper

// QgsEditorWidgetWrapper interface
public:
QVariant value() override;
QVariant value() const override;

protected:
QWidget* createWidget( QWidget* parent ) override;
void initWidget( QWidget* editor ) override;
bool valid() override;
bool valid() const override;

public slots:
void setValue( const QVariant& value ) override;
Expand Down
4 changes: 2 additions & 2 deletions src/gui/editorwidgets/qgsphotowidgetwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void QgsPhotoWidgetWrapper::loadPixmap( const QString& fileName )
}
}

QVariant QgsPhotoWidgetWrapper::value()
QVariant QgsPhotoWidgetWrapper::value() const
{
QVariant v;

Expand Down Expand Up @@ -186,7 +186,7 @@ void QgsPhotoWidgetWrapper::initWidget( QWidget* editor )
}
}

bool QgsPhotoWidgetWrapper::valid()
bool QgsPhotoWidgetWrapper::valid() const
{
#ifdef WITH_QTWEBKIT
return mPhotoLabel || mLineEdit || mButton || mWebView;
Expand Down

0 comments on commit 182dd8a

Please sign in to comment.