Skip to content
Permalink
Browse files

Fix icon size for constraint warning

  • Loading branch information
m-kuhn committed Oct 21, 2016
1 parent d5d3eee commit b4ff6683a65317205a8541a6e595a01d7c166bd8
Showing with 20 additions and 14 deletions.
  1. +19 −14 src/gui/qgsattributeform.cpp
  2. +1 −0 src/gui/qgsattributeform.h
@@ -47,6 +47,7 @@
#include <QSettings>
#include <QToolButton>
#include <QMenu>
#include <QSvgWidget>

int QgsAttributeForm::sFormCounter = 0;

@@ -188,20 +189,20 @@ void QgsAttributeForm::setMode( QgsAttributeForm::Mode mode )
case QgsAttributeForm::SingleEditMode:
setFeature( mFeature );
mSearchButtonBox->setVisible( false );
mInvalidConstraintMessage->show();
mTopMessageWidget->show();
break;

case QgsAttributeForm::AddFeatureMode:
synchronizeEnabledState();
mSearchButtonBox->setVisible( false );
mInvalidConstraintMessage->show();
mTopMessageWidget->show();
break;

case QgsAttributeForm::MultiEditMode:
resetMultiEdit( false );
synchronizeEnabledState();
mSearchButtonBox->setVisible( false );
mInvalidConstraintMessage->show();
mTopMessageWidget->show();
break;

case QgsAttributeForm::SearchMode:
@@ -214,7 +215,7 @@ void QgsAttributeForm::setMode( QgsAttributeForm::Mode mode )
}
else
{
mInvalidConstraintMessage->hide();
mTopMessageWidget->hide();
}
break;
}
@@ -781,9 +782,8 @@ bool QgsAttributeForm::currentFormFeature( QgsFeature &feature )

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

void QgsAttributeForm::displayInvalidConstraintMessage( const QStringList& f,
@@ -798,14 +798,10 @@ void QgsAttributeForm::displayInvalidConstraintMessage( const QStringList& f,
for ( int i = 0; i < size; i++ )
descriptions += QString( "<li>%1: <i>%2</i></li>" ).arg( f[i] ).arg( d[i] );

QString icPath = QgsApplication::iconPath( "/mIconWarning.svg" );
QString msg = QString( "<b>%1</b><ul>%2</ul>" ).arg( tr( "Invalid fields" ) ).arg( descriptions ) ;

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; }" );
mTopMessageWidget->show();
}

void QgsAttributeForm::registerContainerInformation( QgsAttributeForm::ContainerInformation* info )
@@ -1061,9 +1057,18 @@ void QgsAttributeForm::init()
mMessageBar->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Fixed );
vl->addWidget( mMessageBar );

mTopMessageWidget = new QWidget();
mTopMessageWidget->hide();
mTopMessageWidget->setLayout( new QHBoxLayout() );

QSvgWidget* warningIcon = new QSvgWidget( QgsApplication::iconPath( "/mIconWarning.svg" ) );
warningIcon->setFixedSize( 48, 48 );
mTopMessageWidget->layout()->addWidget( warningIcon );
mInvalidConstraintMessage = new QLabel( this );
mInvalidConstraintMessage->hide();
vl->addWidget( mInvalidConstraintMessage );
mTopMessageWidget->layout()->addWidget( mInvalidConstraintMessage );
mTopMessageWidget->hide();

vl->addWidget( mTopMessageWidget );

setLayout( vl );

@@ -314,6 +314,7 @@ class GUI_EXPORT QgsAttributeForm : public QWidget
QgsMessageBarItem* mMultiEditUnsavedMessageBarItem;
QgsMessageBarItem* mMultiEditMessageBarItem;
QLabel* mInvalidConstraintMessage;
QWidget* mTopMessageWidget;
QList<QgsWidgetWrapper*> mWidgets;
QgsAttributeEditorContext mContext;
QDialogButtonBox* mButtonBox;

0 comments on commit b4ff668

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