Skip to content

Commit

Permalink
replace "" by QString()
Browse files Browse the repository at this point in the history
  • Loading branch information
pblottiere committed May 31, 2016
1 parent 7d71c97 commit ea097be
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/core/qgseditformconfig.cpp
Expand Up @@ -121,10 +121,10 @@ bool QgsEditFormConfig::labelOnTop( int idx ) const

QString QgsEditFormConfig::expression( int idx ) const
{
QString expr = "";
QString expr;

if ( idx >= 0 && idx < mFields.count() )
expr = mConstraints.value( mFields.at( idx ).name(), "" );
expr = mConstraints.value( mFields.at( idx ).name(), QString() );

return expr;
}
Expand Down
2 changes: 1 addition & 1 deletion src/gui/editorwidgets/core/qgseditorwidgetregistry.cpp
Expand Up @@ -252,7 +252,7 @@ void QgsEditorWidgetRegistry::readMapLayer( QgsMapLayer* mapLayer, const QDomEle
vectorLayer->editFormConfig()->setReadOnly( idx, ewv2CfgElem.attribute( "fieldEditable", "1" ) != "1" );
vectorLayer->editFormConfig()->setLabelOnTop( idx, ewv2CfgElem.attribute( "labelOnTop", "0" ) == "1" );
vectorLayer->editFormConfig()->setNotNull( idx, ewv2CfgElem.attribute( "notNull", "0" ) == "1" );
vectorLayer->editFormConfig()->setExpression( idx, ewv2CfgElem.attribute( "constraint", "" ) );
vectorLayer->editFormConfig()->setExpression( idx, ewv2CfgElem.attribute( "constraint", QString() ) );

vectorLayer->editFormConfig()->setWidgetConfig( idx, cfg );
}
Expand Down
2 changes: 1 addition & 1 deletion src/gui/editorwidgets/core/qgseditorwidgetwrapper.cpp
Expand Up @@ -98,7 +98,7 @@ void QgsEditorWidgetWrapper::valueChanged()
void QgsEditorWidgetWrapper::updateConstraintWidgetStatus()
{
if ( mValidConstraint )
widget()->setStyleSheet( "" );
widget()->setStyleSheet( QString() );
else
widget()->setStyleSheet( "background-color: #dd7777;" );
}
Expand Down
4 changes: 2 additions & 2 deletions src/gui/editorwidgets/qgsexternalresourcewidgetwrapper.cpp
Expand Up @@ -193,8 +193,8 @@ void QgsExternalResourceWidgetWrapper::updateConstraintWidgetStatus()
if ( mLineEdit )
{
if ( mValidConstraint )
mLineEdit->setStyleSheet( "" );
mLineEdit->setStyleSheet( QString() );
else
mLineEdit->setStyleSheet( "QgsFilterLineEdit { background-color: #dd7777; }" );
}
}
}
2 changes: 1 addition & 1 deletion src/gui/editorwidgets/qgsfilenamewidgetwrapper.cpp
Expand Up @@ -157,7 +157,7 @@ void QgsFileNameWidgetWrapper::updateConstraintWidgetStatus()
if ( mLineEdit )
{
if ( mValidConstraint )
mLineEdit->setStyleSheet( "" );
mLineEdit->setStyleSheet( QString() );
else
{
mLineEdit->setStyleSheet( "QgsFilterLineEdit { background-color: #dd7777; }" );
Expand Down
2 changes: 1 addition & 1 deletion src/gui/editorwidgets/qgsphotowidgetwrapper.cpp
Expand Up @@ -272,7 +272,7 @@ void QgsPhotoWidgetWrapper::updateConstraintWidgetStatus()
if ( mLineEdit )
{
if ( mValidConstraint )
mLineEdit->setStyleSheet( "" );
mLineEdit->setStyleSheet( QString() );
else
{
mLineEdit->setStyleSheet( "QgsFilterLineEdit { background-color: #dd7777; }" );
Expand Down
4 changes: 2 additions & 2 deletions src/gui/editorwidgets/qgsrelationreferencewidgetwrapper.cpp
Expand Up @@ -145,8 +145,8 @@ void QgsRelationReferenceWidgetWrapper::updateConstraintWidgetStatus()
if ( mWidget )
{
if ( mValidConstraint )
mWidget->setStyleSheet( "" );
mWidget->setStyleSheet( QString() );
else
mWidget->setStyleSheet( ".QComboBox { background-color: #dd7777; }" );
}
}
}
4 changes: 2 additions & 2 deletions src/gui/editorwidgets/qgswebviewwidgetwrapper.cpp
Expand Up @@ -194,10 +194,10 @@ void QgsWebViewWidgetWrapper::updateConstraintWidgetStatus()
if ( mLineEdit )
{
if ( mValidConstraint )
mLineEdit->setStyleSheet( "" );
mLineEdit->setStyleSheet( QString() );
else
{
mLineEdit->setStyleSheet( "QgsFilterLineEdit { background-color: #dd7777; }" );
}
}
}
}
16 changes: 8 additions & 8 deletions tests/src/gui/testqgsattributeform.cpp
Expand Up @@ -81,7 +81,7 @@ void TestQgsAttributeForm::testFieldConstraint()
QString invalidLabel = "col0<font color=\"red\">*</font>";

// set constraint
layer->editFormConfig()->setExpression( 0, "" );
layer->editFormConfig()->setExpression( 0, QString() );

// get wrapper
QgsEditorWidgetWrapper *ww;
Expand Down Expand Up @@ -126,10 +126,10 @@ void TestQgsAttributeForm::testFieldMultiConstraints()
ft.setAttribute( "col3", 3 );

// set constraints for each field
layer->editFormConfig()->setExpression( 0, "" );
layer->editFormConfig()->setExpression( 1, "" );
layer->editFormConfig()->setExpression( 2, "" );
layer->editFormConfig()->setExpression( 3, "" );
layer->editFormConfig()->setExpression( 0, QString() );
layer->editFormConfig()->setExpression( 1, QString() );
layer->editFormConfig()->setExpression( 2, QString() );
layer->editFormConfig()->setExpression( 3, QString() );

// build a form for this feature
QgsAttributeForm form( layer );
Expand Down Expand Up @@ -161,8 +161,8 @@ void TestQgsAttributeForm::testFieldMultiConstraints()

// update constraint
layer->editFormConfig()->setExpression( 0, "col0 < (col1 * col2)" );
layer->editFormConfig()->setExpression( 1, "" );
layer->editFormConfig()->setExpression( 2, "" );
layer->editFormConfig()->setExpression( 1, QString() );
layer->editFormConfig()->setExpression( 2, QString() );
layer->editFormConfig()->setExpression( 3, "col0 = 2" );

// change value
Expand Down Expand Up @@ -212,7 +212,7 @@ void TestQgsAttributeForm::testOKButtonStatus()
QSignalSpy spy3( layer, SIGNAL( editingStopped() ) );

// set constraint
layer->editFormConfig()->setExpression( 0, "" );
layer->editFormConfig()->setExpression( 0, QString() );

// no constraint but layer not editable : OK button disabled
QCOMPARE( layer->isEditable(), false );
Expand Down

0 comments on commit ea097be

Please sign in to comment.