You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
prodejna/core/emptystringvalidator.cpp

23 lines
461 B
C++

#include "emptystringvalidator.h"
#include <QMetaObject>
#include <QMetaProperty>
EmptyStringValidator::EmptyStringValidator(QWidget *widget, const QString &errMessage)
:IValidator(widget, errMessage)
{
}
bool EmptyStringValidator::validate()
{
QString data = m_widget->property(m_widget->metaObject()->userProperty().name()).toString();
if (data.isEmpty())
{
m_widget->setFocus();
return false;
}
return true;
}