PDA

View Full Version : With QString create a QString&



avis_phoenix
21st April 2010, 21:54
Hi..

In the next code used the validate function:


if( HX->validator()->validate(HX->text(), p) == QValidator::Acceptable)
{
...
}

When I compile this code mark this error:

error: no matching function for call to `QValidator::validate(QString, int&) const'
note: candidates are: virtual QValidator::State QValidator::validate(QString&, int&) const

Then I need give a QString&, but I don't have a clue...

Please help

I Use Qt4.1

Lykurg
21st April 2010, 22:05
Use:
QString str = HX->text();
if( HX->validator()->validate(str, p) == QValidator::Acceptable)
{
...
}
And see also QLineEdit::acceptableInput