Answer the question
In order to leave comments, you need to log in
Why is the class member missing?
In general, the thing is, there is a class
#ifndef QMAPVALIDATOR_H
#define QMAPVALIDATOR_H
#include <QObject>
#include <QStringList>
#include <QVariantMap>
class QMapValidator
{
private:
QStringList params;
QVariantMap *valider;
public:
QMapValidator();
QMapValidator( QStringList initial, QVariantMap *valider );
bool isValid();
protected:
bool addValid( const QString ¶m );
};
#endif // QMAPVALIDATOR_H
#include "qmapvalidator.h"
QMapValidator::QMapValidator()
{
}
QMapValidator::QMapValidator(QStringList initial, QVariantMap *valider)
{
params = initial;
this->valider = valider;
}
bool QMapValidator::isValid()
{
qDebug() << params ; //Тут объекта уже не существует. ???
if( params.isEmpty() )
{
qDebug() << "List is empty"; //Соответственно видим это..
return false;
}
foreach( QString param, params )
{
qDebug() << param;
if( ! valider->contains( param ) )
return false;
}
return true;
}
bool QMapValidator::addValid(const QString ¶m)
{
if( ! params.contains( param ) )
{
params.append( param ); //Тут все верно. И если после этого вывести param то видим что лист сохраняет строки.
return true;
}
return false;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question