Skip to content

Commit bbb7518

Browse files
committedMay 31, 2014
reintroduced field validators on line edits
1 parent f4545d9 commit bbb7518

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed
 

‎src/gui/editorwidgets/qgstexteditwidget.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "qgstexteditwidget.h"
1717

1818
#include "qgsfield.h"
19+
#include "qgsfieldvalidator.h"
1920

2021
#include <QSettings>
2122

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

9394
if ( mLineEdit )
95+
{
96+
mLineEdit->setValidator( new QgsFieldValidator( mLineEdit, field() ) );
9497
connect( mLineEdit, SIGNAL( textChanged( QString ) ), this, SLOT( valueChanged( QString ) ) );
98+
}
9599
}
96100

97101
void QgsTextEditWidget::setValue( const QVariant& value )

‎src/gui/qgsfieldvalidator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class GUI_EXPORT QgsFieldValidator : public QValidator
3131
Q_OBJECT
3232

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

3737
virtual State validate( QString &, int & ) const;

0 commit comments

Comments
 (0)
Please sign in to comment.