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/samestringvalidator.cpp

22 lines
587 B
C++

#include "samestringvalidator.h"
#include <QMetaProperty>
SameStringValidator::SameStringValidator(QWidget *widget_1, QWidget * widget_2, const QString & errorMessage)
:IValidator(widget_1,errorMessage)
{
m_widget_2 = widget_2;
}
bool SameStringValidator::validate()
{
QString data = m_widget->property(m_widget->metaObject()->userProperty().name()).toString();
QString data_2 = m_widget_2->property(m_widget_2->metaObject()->userProperty().name()).toString();
if (data != data_2)
{
m_widget->setFocus();
return false;
}
return true;
}