Skip to content

Commit

Permalink
Address bugs with new featurres and validation
Browse files Browse the repository at this point in the history
  • Loading branch information
stev-0 committed Dec 6, 2019
1 parent 80b2882 commit e379b03
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/gui/editorwidgets/qgstexteditwrapper.cpp
Expand Up @@ -90,7 +90,12 @@ QVariant QgsTextEditWrapper::value() const
else
// return null value if json is invalid
{
mInvalidJSON = true;
if ( field().length() > 0 )
{
mInvalidJSON = true;
} else {
mInvalidJSON = false;
}
return QVariant();
}
}
Expand Down Expand Up @@ -203,7 +208,7 @@ void QgsTextEditWrapper::setFeature( const QgsFeature &feature )
{
// Do nothing if the value has not changed
if ( mInvalidJSON )
mForm->displayWarning( tr( "Your JSON is invalid and will be reverted back to the last valid edit or the original data" ) );
mForm->displayWarning( tr( "Your JSON was invalid and has been reverted back to the last valid edit or the original data" ) );
{
mInvalidJSON = false;
}
Expand Down
3 changes: 3 additions & 0 deletions src/gui/qgsfieldvalidator.cpp
Expand Up @@ -154,6 +154,9 @@ QValidator::State QgsFieldValidator::validate( QString &s, int &i ) const
{
return QDate::fromString( s, mDateFormat ).isValid() ? Acceptable : Intermediate;
}
else if ( mField.type() == QVariant::Map) {
return Acceptable;
}
else
{
QgsDebugMsg( QStringLiteral( "unsupported type %1 for validation" ).arg( mField.type() ) );
Expand Down

0 comments on commit e379b03

Please sign in to comment.