Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Const fixes for QgsSearchWidgetWrapper
- Loading branch information
|
@@ -145,7 +145,7 @@ class QgsSearchWidgetWrapper : QgsWidgetWrapper |
|
|
:rtype: FilterFlags |
|
|
%End |
|
|
|
|
|
virtual QString expression() = 0; |
|
|
virtual QString expression() const = 0; |
|
|
%Docstring |
|
|
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. |
|
@@ -206,7 +206,7 @@ class QgsSearchWidgetWrapper : QgsWidgetWrapper |
|
|
|
|
|
protected slots: |
|
|
|
|
|
virtual void setExpression( QString value ) = 0; |
|
|
virtual void setExpression( const QString &value ) = 0; |
|
|
virtual void setFeature( const QgsFeature &feature ); |
|
|
|
|
|
|
|
|
|
@@ -44,7 +44,7 @@ class QgsCheckboxSearchWidgetWrapper : QgsSearchWidgetWrapper |
|
|
|
|
|
virtual bool applyDirectly(); |
|
|
|
|
|
virtual QString expression(); |
|
|
virtual QString expression() const; |
|
|
|
|
|
virtual bool valid() const; |
|
|
|
|
@@ -66,7 +66,7 @@ class QgsCheckboxSearchWidgetWrapper : QgsSearchWidgetWrapper |
|
|
|
|
|
|
|
|
protected slots: |
|
|
virtual void setExpression( QString exp ); |
|
|
virtual void setExpression( const QString &expression ); |
|
|
|
|
|
|
|
|
}; |
|
|
|
@@ -40,7 +40,7 @@ class QgsDateTimeSearchWidgetWrapper : QgsSearchWidgetWrapper |
|
|
|
|
|
virtual bool applyDirectly(); |
|
|
|
|
|
virtual QString expression(); |
|
|
virtual QString expression() const; |
|
|
|
|
|
virtual bool valid() const; |
|
|
|
|
@@ -62,7 +62,7 @@ class QgsDateTimeSearchWidgetWrapper : QgsSearchWidgetWrapper |
|
|
|
|
|
|
|
|
protected slots: |
|
|
virtual void setExpression( QString exp ); |
|
|
virtual void setExpression( const QString &exp ); |
|
|
|
|
|
|
|
|
}; |
|
|
|
@@ -23,7 +23,7 @@ class QgsDefaultSearchWidgetWrapper : QgsSearchWidgetWrapper |
|
|
explicit QgsDefaultSearchWidgetWrapper( QgsVectorLayer *vl, int fieldIdx, QWidget *parent /TransferThis/ = 0 ); |
|
|
|
|
|
public: |
|
|
virtual QString expression(); |
|
|
virtual QString expression() const; |
|
|
|
|
|
virtual bool applyDirectly(); |
|
|
|
|
@@ -40,7 +40,7 @@ class QgsDefaultSearchWidgetWrapper : QgsSearchWidgetWrapper |
|
|
virtual void setEnabled( bool enabled ); |
|
|
|
|
|
protected slots: |
|
|
virtual void setExpression( QString exp ); |
|
|
virtual void setExpression( const QString &exp ); |
|
|
|
|
|
|
|
|
protected: |
|
|
|
@@ -40,7 +40,7 @@ class QgsRelationReferenceSearchWidgetWrapper : QgsSearchWidgetWrapper |
|
|
|
|
|
virtual bool applyDirectly(); |
|
|
|
|
|
virtual QString expression(); |
|
|
virtual QString expression() const; |
|
|
|
|
|
virtual bool valid() const; |
|
|
|
|
@@ -69,7 +69,7 @@ Called when current value of search widget changes |
|
|
%End |
|
|
|
|
|
protected slots: |
|
|
virtual void setExpression( QString exp ); |
|
|
virtual void setExpression( const QString &exp ); |
|
|
|
|
|
|
|
|
}; |
|
|
|
@@ -24,7 +24,7 @@ class QgsValueMapSearchWidgetWrapper : QgsSearchWidgetWrapper |
|
|
explicit QgsValueMapSearchWidgetWrapper( QgsVectorLayer *vl, int fieldIdx, QWidget *parent /TransferThis/ = 0 ); |
|
|
virtual bool applyDirectly(); |
|
|
|
|
|
virtual QString expression(); |
|
|
virtual QString expression() const; |
|
|
|
|
|
virtual bool valid() const; |
|
|
|
|
@@ -46,7 +46,7 @@ class QgsValueMapSearchWidgetWrapper : QgsSearchWidgetWrapper |
|
|
|
|
|
|
|
|
protected slots: |
|
|
virtual void setExpression( QString exp ); |
|
|
virtual void setExpression( const QString &exp ); |
|
|
|
|
|
|
|
|
}; |
|
|
|
@@ -26,7 +26,7 @@ class QgsValueRelationSearchWidgetWrapper : QgsSearchWidgetWrapper |
|
|
explicit QgsValueRelationSearchWidgetWrapper( QgsVectorLayer *vl, int fieldIdx, QWidget *parent /TransferThis/ = 0 ); |
|
|
virtual bool applyDirectly(); |
|
|
|
|
|
virtual QString expression(); |
|
|
virtual QString expression() const; |
|
|
|
|
|
virtual bool valid() const; |
|
|
|
|
@@ -56,7 +56,7 @@ class QgsValueRelationSearchWidgetWrapper : QgsSearchWidgetWrapper |
|
|
Called when current value of search widget changes |
|
|
%End |
|
|
|
|
|
virtual void setExpression( QString exp ); |
|
|
virtual void setExpression( const QString &exp ); |
|
|
|
|
|
|
|
|
}; |
|
|
|
@@ -100,7 +100,6 @@ QgsSearchWidgetWrapper::FilterFlags QgsSearchWidgetWrapper::defaultFlags() const |
|
|
return FilterFlags(); |
|
|
} |
|
|
|
|
|
|
|
|
void QgsSearchWidgetWrapper::setFeature( const QgsFeature &feature ) |
|
|
{ |
|
|
Q_UNUSED( feature ) |
|
|
|
@@ -170,7 +170,7 @@ class GUI_EXPORT QgsSearchWidgetWrapper : public QgsWidgetWrapper |
|
|
* |
|
|
* \returns The current value the widget represents |
|
|
*/ |
|
|
virtual QString expression() = 0; |
|
|
virtual QString expression() const = 0; |
|
|
|
|
|
/** |
|
|
* If this is true, then this search widget should take effect directly |
|
@@ -225,7 +225,7 @@ class GUI_EXPORT QgsSearchWidgetWrapper : public QgsWidgetWrapper |
|
|
|
|
|
protected slots: |
|
|
|
|
|
virtual void setExpression( QString value ) = 0; |
|
|
virtual void setExpression( const QString &value ) = 0; |
|
|
void setFeature( const QgsFeature &feature ) override; |
|
|
|
|
|
protected: |
|
|
|
@@ -33,7 +33,7 @@ bool QgsCheckboxSearchWidgetWrapper::applyDirectly() |
|
|
return true; |
|
|
} |
|
|
|
|
|
QString QgsCheckboxSearchWidgetWrapper::expression() |
|
|
QString QgsCheckboxSearchWidgetWrapper::expression() const |
|
|
{ |
|
|
return mExpression; |
|
|
} |
|
@@ -124,8 +124,9 @@ bool QgsCheckboxSearchWidgetWrapper::valid() const |
|
|
return true; |
|
|
} |
|
|
|
|
|
void QgsCheckboxSearchWidgetWrapper::setExpression( QString exp ) |
|
|
void QgsCheckboxSearchWidgetWrapper::setExpression( const QString &expression ) |
|
|
{ |
|
|
QString exp = expression; |
|
|
QString fieldName = layer()->fields().at( mFieldIdx ).name(); |
|
|
|
|
|
QString str = QStringLiteral( "%1 = '%3'" ) |
|
|
|
@@ -57,7 +57,7 @@ class GUI_EXPORT QgsCheckboxSearchWidgetWrapper : public QgsSearchWidgetWrapper |
|
|
QVariant value() const; |
|
|
|
|
|
bool applyDirectly() override; |
|
|
QString expression() override; |
|
|
QString expression() const override; |
|
|
bool valid() const override; |
|
|
QgsSearchWidgetWrapper::FilterFlags supportedFlags() const override; |
|
|
QgsSearchWidgetWrapper::FilterFlags defaultFlags() const override; |
|
@@ -73,7 +73,7 @@ class GUI_EXPORT QgsCheckboxSearchWidgetWrapper : public QgsSearchWidgetWrapper |
|
|
void initWidget( QWidget *editor ) override; |
|
|
|
|
|
protected slots: |
|
|
void setExpression( QString exp ) override; |
|
|
void setExpression( const QString &expression ) override; |
|
|
|
|
|
private slots: |
|
|
void stateChanged( int state ); |
|
|
|
@@ -36,7 +36,7 @@ bool QgsDateTimeSearchWidgetWrapper::applyDirectly() |
|
|
return true; |
|
|
} |
|
|
|
|
|
QString QgsDateTimeSearchWidgetWrapper::expression() |
|
|
QString QgsDateTimeSearchWidgetWrapper::expression() const |
|
|
{ |
|
|
return mExpression; |
|
|
} |
|
@@ -112,8 +112,9 @@ bool QgsDateTimeSearchWidgetWrapper::valid() const |
|
|
return true; |
|
|
} |
|
|
|
|
|
void QgsDateTimeSearchWidgetWrapper::setExpression( QString exp ) |
|
|
void QgsDateTimeSearchWidgetWrapper::setExpression( const QString &expression ) |
|
|
{ |
|
|
QString exp = expression; |
|
|
QString fieldName = layer()->fields().at( mFieldIdx ).name(); |
|
|
|
|
|
QString str = QStringLiteral( "%1 = '%3'" ) |
|
|
|
@@ -55,7 +55,7 @@ class GUI_EXPORT QgsDateTimeSearchWidgetWrapper : public QgsSearchWidgetWrapper |
|
|
QVariant value() const; |
|
|
|
|
|
bool applyDirectly() override; |
|
|
QString expression() override; |
|
|
QString expression() const override; |
|
|
bool valid() const override; |
|
|
QgsSearchWidgetWrapper::FilterFlags supportedFlags() const override; |
|
|
QgsSearchWidgetWrapper::FilterFlags defaultFlags() const override; |
|
@@ -71,7 +71,7 @@ class GUI_EXPORT QgsDateTimeSearchWidgetWrapper : public QgsSearchWidgetWrapper |
|
|
void initWidget( QWidget *editor ) override; |
|
|
|
|
|
protected slots: |
|
|
void setExpression( QString exp ) override; |
|
|
void setExpression( const QString &exp ) override; |
|
|
|
|
|
private slots: |
|
|
void dateTimeChanged( const QDateTime &date ); |
|
|
|
@@ -29,7 +29,7 @@ QgsDefaultSearchWidgetWrapper::QgsDefaultSearchWidgetWrapper( QgsVectorLayer *vl |
|
|
{ |
|
|
} |
|
|
|
|
|
QString QgsDefaultSearchWidgetWrapper::expression() |
|
|
QString QgsDefaultSearchWidgetWrapper::expression() const |
|
|
{ |
|
|
return mExpression; |
|
|
} |
|
@@ -51,12 +51,12 @@ void QgsDefaultSearchWidgetWrapper::setCaseString( int caseSensitiveCheckState ) |
|
|
emit expressionChanged( mExpression ); |
|
|
} |
|
|
|
|
|
void QgsDefaultSearchWidgetWrapper::setExpression( QString exp ) |
|
|
void QgsDefaultSearchWidgetWrapper::setExpression( const QString &expression ) |
|
|
{ |
|
|
QVariant::Type fldType = layer()->fields().at( mFieldIdx ).type(); |
|
|
bool numeric = ( fldType == QVariant::Int || fldType == QVariant::Double || fldType == QVariant::LongLong ); |
|
|
|
|
|
QgsSettings settings; |
|
|
QString exp = expression; |
|
|
QString nullValue = QgsApplication::nullRepresentation(); |
|
|
QString fieldName = layer()->fields().at( mFieldIdx ).name(); |
|
|
QString str; |
|
|
|
@@ -36,7 +36,7 @@ class GUI_EXPORT QgsDefaultSearchWidgetWrapper : public QgsSearchWidgetWrapper |
|
|
|
|
|
// QgsSearchWidgetWrapper interface |
|
|
public: |
|
|
QString expression() override; |
|
|
QString expression() const override; |
|
|
bool applyDirectly() override; |
|
|
QgsSearchWidgetWrapper::FilterFlags supportedFlags() const override; |
|
|
QgsSearchWidgetWrapper::FilterFlags defaultFlags() const override; |
|
@@ -49,7 +49,7 @@ class GUI_EXPORT QgsDefaultSearchWidgetWrapper : public QgsSearchWidgetWrapper |
|
|
virtual void setEnabled( bool enabled ) override; |
|
|
|
|
|
protected slots: |
|
|
void setExpression( QString exp ) override; |
|
|
void setExpression( const QString &exp ) override; |
|
|
|
|
|
private slots: |
|
|
void setCaseString( int caseSensitiveCheckState ); |
|
|
|
@@ -37,7 +37,7 @@ bool QgsRelationReferenceSearchWidgetWrapper::applyDirectly() |
|
|
return true; |
|
|
} |
|
|
|
|
|
QString QgsRelationReferenceSearchWidgetWrapper::expression() |
|
|
QString QgsRelationReferenceSearchWidgetWrapper::expression() const |
|
|
{ |
|
|
return mExpression; |
|
|
} |
|
@@ -141,9 +141,9 @@ void QgsRelationReferenceSearchWidgetWrapper::onValueChanged( const QVariant &va |
|
|
emit expressionChanged( mExpression ); |
|
|
} |
|
|
|
|
|
void QgsRelationReferenceSearchWidgetWrapper::setExpression( QString exp ) |
|
|
void QgsRelationReferenceSearchWidgetWrapper::setExpression( const QString &expression ) |
|
|
{ |
|
|
QgsSettings settings; |
|
|
QString exp = expression; |
|
|
QString nullValue = QgsApplication::nullRepresentation(); |
|
|
QString fieldName = layer()->fields().at( mFieldIdx ).name(); |
|
|
|
|
|
|
@@ -55,7 +55,7 @@ class GUI_EXPORT QgsRelationReferenceSearchWidgetWrapper : public QgsSearchWidge |
|
|
QVariant value() const; |
|
|
|
|
|
bool applyDirectly() override; |
|
|
QString expression() override; |
|
|
QString expression() const override; |
|
|
bool valid() const override; |
|
|
QgsSearchWidgetWrapper::FilterFlags supportedFlags() const override; |
|
|
QgsSearchWidgetWrapper::FilterFlags defaultFlags() const override; |
|
@@ -76,7 +76,7 @@ class GUI_EXPORT QgsRelationReferenceSearchWidgetWrapper : public QgsSearchWidge |
|
|
void onValueChanged( const QVariant &value ); |
|
|
|
|
|
protected slots: |
|
|
void setExpression( QString exp ) override; |
|
|
void setExpression( const QString &exp ) override; |
|
|
|
|
|
private: |
|
|
|
|
|
|
@@ -58,7 +58,7 @@ bool QgsValueMapSearchWidgetWrapper::applyDirectly() |
|
|
return true; |
|
|
} |
|
|
|
|
|
QString QgsValueMapSearchWidgetWrapper::expression() |
|
|
QString QgsValueMapSearchWidgetWrapper::expression() const |
|
|
{ |
|
|
return mExpression; |
|
|
} |
|
@@ -143,7 +143,7 @@ void QgsValueMapSearchWidgetWrapper::initWidget( QWidget *editor ) |
|
|
{ |
|
|
const QVariantMap cfg = config(); |
|
|
QVariantMap::ConstIterator it = cfg.constBegin(); |
|
|
mComboBox->addItem( tr( "Please select" ), "" ); |
|
|
mComboBox->addItem( tr( "Please select" ), QString() ); |
|
|
|
|
|
while ( it != cfg.constEnd() ) |
|
|
{ |
|
@@ -155,8 +155,9 @@ void QgsValueMapSearchWidgetWrapper::initWidget( QWidget *editor ) |
|
|
} |
|
|
} |
|
|
|
|
|
void QgsValueMapSearchWidgetWrapper::setExpression( QString exp ) |
|
|
void QgsValueMapSearchWidgetWrapper::setExpression( const QString &expression ) |
|
|
{ |
|
|
QString exp = expression; |
|
|
QString fieldName = layer()->fields().at( mFieldIdx ).name(); |
|
|
QString str; |
|
|
|
|
|
|
@@ -34,7 +34,7 @@ class GUI_EXPORT QgsValueMapSearchWidgetWrapper : public QgsSearchWidgetWrapper |
|
|
public: |
|
|
explicit QgsValueMapSearchWidgetWrapper( QgsVectorLayer *vl, int fieldIdx, QWidget *parent SIP_TRANSFERTHIS = 0 ); |
|
|
bool applyDirectly() override; |
|
|
QString expression() override; |
|
|
QString expression() const override; |
|
|
bool valid() const override; |
|
|
QgsSearchWidgetWrapper::FilterFlags supportedFlags() const override; |
|
|
QgsSearchWidgetWrapper::FilterFlags defaultFlags() const override; |
|
@@ -50,7 +50,7 @@ class GUI_EXPORT QgsValueMapSearchWidgetWrapper : public QgsSearchWidgetWrapper |
|
|
void initWidget( QWidget *editor ) override; |
|
|
|
|
|
protected slots: |
|
|
void setExpression( QString exp ) override; |
|
|
void setExpression( const QString &exp ) override; |
|
|
|
|
|
private slots: |
|
|
void comboBoxIndexChanged( int idx ); |
|
|
|
@@ -36,7 +36,7 @@ bool QgsValueRelationSearchWidgetWrapper::applyDirectly() |
|
|
return !mLineEdit; |
|
|
} |
|
|
|
|
|
QString QgsValueRelationSearchWidgetWrapper::expression() |
|
|
QString QgsValueRelationSearchWidgetWrapper::expression() const |
|
|
{ |
|
|
return mExpression; |
|
|
} |
|
@@ -189,9 +189,9 @@ void QgsValueRelationSearchWidgetWrapper::onValueChanged() |
|
|
emit expressionChanged( mExpression ); |
|
|
} |
|
|
|
|
|
void QgsValueRelationSearchWidgetWrapper::setExpression( QString exp ) |
|
|
void QgsValueRelationSearchWidgetWrapper::setExpression( const QString &expression ) |
|
|
{ |
|
|
QgsSettings settings; |
|
|
QString exp = expression; |
|
|
QString nullValue = QgsApplication::nullRepresentation(); |
|
|
QString fieldName = layer()->fields().at( mFieldIdx ).name(); |
|
|
|
|
|
|
@@ -40,7 +40,7 @@ class GUI_EXPORT QgsValueRelationSearchWidgetWrapper : public QgsSearchWidgetWra |
|
|
public: |
|
|
explicit QgsValueRelationSearchWidgetWrapper( QgsVectorLayer *vl, int fieldIdx, QWidget *parent SIP_TRANSFERTHIS = 0 ); |
|
|
bool applyDirectly() override; |
|
|
QString expression() override; |
|
|
QString expression() const override; |
|
|
bool valid() const override; |
|
|
QVariant value() const; |
|
|
QgsSearchWidgetWrapper::FilterFlags supportedFlags() const override; |
|
@@ -59,7 +59,7 @@ class GUI_EXPORT QgsValueRelationSearchWidgetWrapper : public QgsSearchWidgetWra |
|
|
//! Called when current value of search widget changes |
|
|
void onValueChanged(); |
|
|
|
|
|
void setExpression( QString exp ) override; |
|
|
void setExpression( const QString &exp ) override; |
|
|
|
|
|
private: |
|
|
QComboBox *mComboBox = nullptr; |
|
|