Skip to content
Permalink
Browse files

replace "" by QString()

  • Loading branch information
pblottiere committed May 19, 2016
1 parent 7d71c97 commit ea097becae1c0cedceab2596e61b7bfbbd839f92
@@ -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;
}
@@ -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 );
}
@@ -98,7 +98,7 @@ void QgsEditorWidgetWrapper::valueChanged()
void QgsEditorWidgetWrapper::updateConstraintWidgetStatus()
{
if ( mValidConstraint )
widget()->setStyleSheet( "" );
widget()->setStyleSheet( QString() );
else
widget()->setStyleSheet( "background-color: #dd7777;" );
}
@@ -193,8 +193,8 @@ void QgsExternalResourceWidgetWrapper::updateConstraintWidgetStatus()
if ( mLineEdit )
{
if ( mValidConstraint )
mLineEdit->setStyleSheet( "" );
mLineEdit->setStyleSheet( QString() );
else
mLineEdit->setStyleSheet( "QgsFilterLineEdit { background-color: #dd7777; }" );
}
}
}
@@ -157,7 +157,7 @@ void QgsFileNameWidgetWrapper::updateConstraintWidgetStatus()
if ( mLineEdit )
{
if ( mValidConstraint )
mLineEdit->setStyleSheet( "" );
mLineEdit->setStyleSheet( QString() );
else
{
mLineEdit->setStyleSheet( "QgsFilterLineEdit { background-color: #dd7777; }" );
@@ -272,7 +272,7 @@ void QgsPhotoWidgetWrapper::updateConstraintWidgetStatus()
if ( mLineEdit )
{
if ( mValidConstraint )
mLineEdit->setStyleSheet( "" );
mLineEdit->setStyleSheet( QString() );
else
{
mLineEdit->setStyleSheet( "QgsFilterLineEdit { background-color: #dd7777; }" );
@@ -145,8 +145,8 @@ void QgsRelationReferenceWidgetWrapper::updateConstraintWidgetStatus()
if ( mWidget )
{
if ( mValidConstraint )
mWidget->setStyleSheet( "" );
mWidget->setStyleSheet( QString() );
else
mWidget->setStyleSheet( ".QComboBox { background-color: #dd7777; }" );
}
}
}
@@ -194,10 +194,10 @@ void QgsWebViewWidgetWrapper::updateConstraintWidgetStatus()
if ( mLineEdit )
{
if ( mValidConstraint )
mLineEdit->setStyleSheet( "" );
mLineEdit->setStyleSheet( QString() );
else
{
mLineEdit->setStyleSheet( "QgsFilterLineEdit { background-color: #dd7777; }" );
}
}
}
}
@@ -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;
@@ -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 );
@@ -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
@@ -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 );

0 comments on commit ea097be

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