本文整理汇总了C++中QRegExpValidator::validate方法的典型用法代码示例。如果您正苦于以下问题:C++ QRegExpValidator::validate方法的具体用法?C++ QRegExpValidator::validate怎么用?C++ QRegExpValidator::validate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QRegExpValidator
的用法示例。
在下文中一共展示了QRegExpValidator::validate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sipIsDerived
static PyObject *meth_QRegExpValidator_validate(PyObject *sipSelf, PyObject *sipArgs, PyObject *sipKwds)
{
PyObject *sipParseErr = NULL;
bool sipSelfWasArg = (!sipSelf || sipIsDerived((sipSimpleWrapper *)sipSelf));
if (sipIsAPIEnabled(sipName_QString, 2, 0))
{
QString * a0;
int a0State = 0;
int a1;
QRegExpValidator *sipCpp;
static const char *sipKwdList[] = {
sipName_input,
sipName_pos,
};
if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, sipKwdList, NULL, "BJ1i", &sipSelf, sipType_QRegExpValidator, &sipCpp, sipType_QString,&a0, &a0State, &a1))
{
QValidator::State sipRes;
PyObject *sipResult;
Py_BEGIN_ALLOW_THREADS
sipRes = (sipSelfWasArg ? sipCpp->QRegExpValidator::validate(*a0,a1) : sipCpp->validate(*a0,a1));
Py_END_ALLOW_THREADS
sipResult = sipBuildResult(0,"(FDi)",sipRes,sipType_QValidator_State,a0,sipType_QString,NULL,a1);
sipReleaseType(a0,sipType_QString,a0State);
return sipResult;
}
}
if (sipIsAPIEnabled(sipName_QString, 0, 2))
{
QString * a0;
int a1;
QRegExpValidator *sipCpp;
if (sipParseKwdArgs(&sipParseErr, sipArgs, sipKwds, NULL, NULL, "BJ9i", &sipSelf, sipType_QRegExpValidator, &sipCpp, sipType_QString,&a0, &a1))
{
QValidator::State sipRes;
Py_BEGIN_ALLOW_THREADS
sipRes = (sipSelfWasArg ? sipCpp->QRegExpValidator::validate(*a0,a1) : sipCpp->validate(*a0,a1));
Py_END_ALLOW_THREADS
return sipBuildResult(0,"(Fi)",sipRes,sipType_QValidator_State,a1);
}
示例2: validate
QValidator::State cwClinoValidator::validate ( QString & input, int & pos ) const {
if(input.isEmpty()) {
return QValidator::Acceptable;
}
QDoubleValidator doubleValidator;
doubleValidator.setTop(90);
doubleValidator.setBottom(-90);
doubleValidator.setNotation(QDoubleValidator::StandardNotation);
QValidator::State state = doubleValidator.validate(input, pos);
switch(state) {
case QValidator::Invalid: {
QRegExpValidator upDownValidator;
QRegExp regexp("up|down", Qt::CaseInsensitive);
upDownValidator.setRegExp(regexp);
return upDownValidator.validate(input, pos);
}
case QValidator::Acceptable: {
//Just make sure we can convert the input
bool okay;
double value = input.toDouble(&okay);
if(!okay || !check(value)) {
//The validator is dump ... this handle use case input="5,5"
return QValidator::Invalid;
}
break;
}
default:
break;
}
return state;
}