Skip to content
Permalink
Browse files

Hide invalid constraints label when it's unused

Fix #15452
  • Loading branch information
m-kuhn committed Aug 19, 2016
1 parent c467671 commit 48445e7484b29f0088b42e8789e8fd80554df9be
Showing with 13 additions and 10 deletions.
  1. +7 −4 src/gui/qgsattributeform.cpp
  2. +6 −6 src/gui/qgsattributeform.h
@@ -783,12 +783,13 @@ bool QgsAttributeForm::currentFormFeature( QgsFeature &feature )

void QgsAttributeForm::clearInvalidConstraintsMessage()
{
mInvalidConstraintMessage->hide();
mInvalidConstraintMessage->clear();
mInvalidConstraintMessage->setStyleSheet( QString() );
}

void QgsAttributeForm::displayInvalidConstraintMessage( const QStringList &f,
const QStringList &d )
void QgsAttributeForm::displayInvalidConstraintMessage( const QStringList& f,
const QStringList& d )
{
clearInvalidConstraintsMessage();

@@ -804,6 +805,7 @@ void QgsAttributeForm::displayInvalidConstraintMessage( const QStringList &f,
QString title = QString( "<img src=\"%1\"> <b>%2:" ).arg( icPath ).arg( tr( "Invalid fields" ) );
QString msg = QString( "%1</b><ul>%2</ul>" ).arg( title ).arg( descriptions ) ;

mInvalidConstraintMessage->show();
mInvalidConstraintMessage->setText( msg );
mInvalidConstraintMessage->setStyleSheet( "QLabel { background-color : #ffc800; }" );
}
@@ -922,8 +924,8 @@ void QgsAttributeForm::onConstraintStatusChanged( const QString& constraint,
}
}

void QgsAttributeForm::constraintDependencies( QgsEditorWidgetWrapper *w,
QList<QgsEditorWidgetWrapper*> &wDeps )
void QgsAttributeForm::constraintDependencies( QgsEditorWidgetWrapper* w,
QList<QgsEditorWidgetWrapper*>& wDeps )
{
QString name = w->field().name();

@@ -1051,6 +1053,7 @@ void QgsAttributeForm::init()
vl->addWidget( mMessageBar );

mInvalidConstraintMessage = new QLabel( this );
mInvalidConstraintMessage->hide();
vl->addWidget( mInvalidConstraintMessage );

setLayout( vl );
@@ -320,13 +320,13 @@ class GUI_EXPORT QgsAttributeForm : public QWidget

//! constraints management
void updateAllConstaints();
void updateConstraints( QgsEditorWidgetWrapper *w );
bool currentFormFeature( QgsFeature &feature );
bool currentFormValidConstraints( QStringList &invalidFields, QStringList &descriptions );
void constraintDependencies( QgsEditorWidgetWrapper *w, QList<QgsEditorWidgetWrapper*> &wDeps );
void updateConstraints( QgsEditorWidgetWrapper* w );
bool currentFormFeature( QgsFeature& feature );
bool currentFormValidConstraints( QStringList& invalidFields, QStringList& descriptions );
void constraintDependencies( QgsEditorWidgetWrapper* w, QList<QgsEditorWidgetWrapper*>& wDeps );
void clearInvalidConstraintsMessage();
void displayInvalidConstraintMessage( const QStringList &invalidFields,
const QStringList &description );
void displayInvalidConstraintMessage( const QStringList& invalidFields,
const QStringList& description );

QgsVectorLayer* mLayer;
QgsFeature mFeature;

0 comments on commit 48445e7

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