Skip to content

Commit

Permalink
reintroduced field validators on line edits
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed May 31, 2014
1 parent f4545d9 commit bbb7518
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/gui/editorwidgets/qgstexteditwidget.cpp
Expand Up @@ -16,6 +16,7 @@
#include "qgstexteditwidget.h"

#include "qgsfield.h"
#include "qgsfieldvalidator.h"

#include <QSettings>

Expand Down Expand Up @@ -91,7 +92,10 @@ void QgsTextEditWidget::initWidget( QWidget* editor )
connect( mPlainTextEdit, SIGNAL( textChanged() ), this, SLOT( valueChanged() ) );

if ( mLineEdit )
{
mLineEdit->setValidator( new QgsFieldValidator( mLineEdit, field() ) );
connect( mLineEdit, SIGNAL( textChanged( QString ) ), this, SLOT( valueChanged( QString ) ) );
}
}

void QgsTextEditWidget::setValue( const QVariant& value )
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsfieldvalidator.h
Expand Up @@ -31,7 +31,7 @@ class GUI_EXPORT QgsFieldValidator : public QValidator
Q_OBJECT

public:
QgsFieldValidator( QObject *parent, const QgsField &field, QString dateFormat );
QgsFieldValidator( QObject *parent, const QgsField &field, QString dateFormat = "yyyy-MM-dd" );
~QgsFieldValidator();

virtual State validate( QString &, int & ) const;
Expand Down

0 comments on commit bbb7518

Please sign in to comment.