Skip to content

Commit ecec1f0

Browse files
committedAug 19, 2016
Hide invalid constraints label when it's unused
Fix #15452
1 parent 8fdfbd0 commit ecec1f0

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed
 

‎src/gui/qgsattributeform.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -780,12 +780,13 @@ bool QgsAttributeForm::currentFormFeature( QgsFeature &feature )
780780

781781
void QgsAttributeForm::clearInvalidConstraintsMessage()
782782
{
783+
mInvalidConstraintMessage->hide();
783784
mInvalidConstraintMessage->clear();
784785
mInvalidConstraintMessage->setStyleSheet( QString() );
785786
}
786787

787-
void QgsAttributeForm::displayInvalidConstraintMessage( const QStringList &f,
788-
const QStringList &d )
788+
void QgsAttributeForm::displayInvalidConstraintMessage( const QStringList& f,
789+
const QStringList& d )
789790
{
790791
clearInvalidConstraintsMessage();
791792

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

805+
mInvalidConstraintMessage->show();
804806
mInvalidConstraintMessage->setText( msg );
805807
mInvalidConstraintMessage->setStyleSheet( "QLabel { background-color : #ffc800; }" );
806808
}
@@ -919,8 +921,8 @@ void QgsAttributeForm::onConstraintStatusChanged( const QString& constraint,
919921
}
920922
}
921923

922-
void QgsAttributeForm::constraintDependencies( QgsEditorWidgetWrapper *w,
923-
QList<QgsEditorWidgetWrapper*> &wDeps )
924+
void QgsAttributeForm::constraintDependencies( QgsEditorWidgetWrapper* w,
925+
QList<QgsEditorWidgetWrapper*>& wDeps )
924926
{
925927
QString name = w->field().name();
926928

@@ -1048,6 +1050,7 @@ void QgsAttributeForm::init()
10481050
vl->addWidget( mMessageBar );
10491051

10501052
mInvalidConstraintMessage = new QLabel( this );
1053+
mInvalidConstraintMessage->hide();
10511054
vl->addWidget( mInvalidConstraintMessage );
10521055

10531056
setLayout( vl );

‎src/gui/qgsattributeform.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -321,13 +321,13 @@ class GUI_EXPORT QgsAttributeForm : public QWidget
321321

322322
//! constraints management
323323
void updateAllConstaints();
324-
void updateConstraints( QgsEditorWidgetWrapper *w );
325-
bool currentFormFeature( QgsFeature &feature );
326-
bool currentFormValidConstraints( QStringList &invalidFields, QStringList &descriptions );
327-
void constraintDependencies( QgsEditorWidgetWrapper *w, QList<QgsEditorWidgetWrapper*> &wDeps );
324+
void updateConstraints( QgsEditorWidgetWrapper* w );
325+
bool currentFormFeature( QgsFeature& feature );
326+
bool currentFormValidConstraints( QStringList& invalidFields, QStringList& descriptions );
327+
void constraintDependencies( QgsEditorWidgetWrapper* w, QList<QgsEditorWidgetWrapper*>& wDeps );
328328
void clearInvalidConstraintsMessage();
329-
void displayInvalidConstraintMessage( const QStringList &invalidFields,
330-
const QStringList &description );
329+
void displayInvalidConstraintMessage( const QStringList& invalidFields,
330+
const QStringList& description );
331331

332332
QgsVectorLayer* mLayer;
333333
QgsFeature mFeature;

0 commit comments

Comments
 (0)