Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 8a706d3e

Von Christian Ehringfeld vor mehr als 9 Jahren hinzugefügt

  • ID 8a706d3ec698d5db38fb78de46803e3872f6eeae
  • Vorgänger 34233707
  • Nachfolger 519b2fe3

...

Unterschiede anzeigen:

src/validators/comparevalidator.cpp
#include "comparevalidator.h"
using namespace CuteEntityManager;
CompareValidator::CompareValidator() : Validator() {
}
ErrorMsg CompareValidator::validateParam(QVariant value, Param param) const {
if (param.getName().isEmpty()) {
return ErrorMsg("", "No operator set.");
}
if (param.getName() == "==" && value != param.getValue()) {
return ErrorMsg(param.getName(), "<property> must be repeated exactly.");
} else if (param.getName() == "!=" && value == param.getValue()) {
......
"<property> must be greater than " + param.getValue().toString() + ".");
} else if (param.getName() == "<" && value >= param.getValue()) {
return ErrorMsg(param.getName(),
"<property> must be greater than or equal to " + param.getValue().toString() + ".");
"<property> must be greater than or equal to " + param.getValue().toString() +
".");
} else if (param.getName() == ">=" && value < param.getValue()) {
return ErrorMsg(param.getName(),
"<property> must be less than " + param.getValue().toString() + ".");
} else if (param.getName() == "<=" && value > param.getValue()) {
return ErrorMsg(param.getName(),
"<property> must be less than or equal to " + param.getValue().toString() + ".");
"<property> must be less than or equal to " + param.getValue().toString() +
".");
}
return ErrorMsg();
}
QString CompareValidator::getDefaultOperator() const {
return defaultOperator;
}
void CompareValidator::setDefaultOperator(const QString &value) {
defaultOperator = value;
}
src/validators/comparevalidator.h
public:
CompareValidator();
ErrorMsg validateParam(QVariant value, Param param) const final override;
QString getDefaultOperator() const;
void setDefaultOperator(const QString &value);
protected:
QString defaultOperator = QStringLiteral("==");
};
}

Auch abrufbar als: Unified diff