I am trying to use the cache to store/retrieve data but I cannot actually figure it out how?
I didn't made a dedicated example for it so I just tested it with a login form, trying to store the user inside the cache and retrieve it on QDialog::exec().
I made a class
Code:
class InfoUtil{ public: QString nUtil; const char* retUtil(); }; nUtil=a; } const char* InfoUtil::retUtil(){ return nUtil.toStdString().c_str(); }
Here is the block which checks if the login credentials are ok, and if they are it does emits some signals etc and cache the login user
Code:
if(util=="admin" && parola=="admin"){ QCache<const char*,InfoUtil> cache; iu->setUtil(util); cache.clear(); cache.insert(iu->retUtil(),iu); }
util is a string which gets it's data from QLineEdit.
When the connection dialog opens it should have the cached "admin" set to the QLineEdit, but I get symbols.
Here is how I try to retrieve the data and set it to QLineEdit inside the dialog's constructor.
Code:
QCache<const char*,InfoUtil> cache; const char* abc; cache.take(abc);
I know it's wrong but can someone send me to the right direction?
