Skip to content
Permalink
Browse files
reintroduced field validators on line edits
  • Loading branch information
jef-n committed May 31, 2014
1 parent f4545d9 commit bbb75183b5ec7fed1f7e4cc66847d2042fd716fc
Showing with 5 additions and 1 deletion.
  1. +4 −0 src/gui/editorwidgets/qgstexteditwidget.cpp
  2. +1 −1 src/gui/qgsfieldvalidator.h
@@ -16,6 +16,7 @@
#include "qgstexteditwidget.h"

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

#include <QSettings>

@@ -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 )
@@ -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;

0 comments on commit bbb7518

Please sign in to comment.