I have a beginner problem with my QHash @QHash<pi_int32, SpecialObject> myQHash;@
I built a controller, which handles my QHash. This Controller has got a method:
@void DataController::addNewData(qint32 tID, QString tName, qint32 tCat, qint32 tCon)
SpecialObject tPI (tID, tName, tCat, tCon); // tPI is set correctly
this->myQHash.insert(tID, tPI); // wrong values inserted into myQHash
The object tPI is correctly; all its attributes are correctly set.
The error is in the next line, where the key-SpecialObject-value pair (tID, tPI) should be inserted to myQHash. It is not real error, but rather an incorrect insertion.
For testing purposes, I have elsewhere:
@pDataController.addNewData(2511, tr("Home"), 20481, 1272923);@
But according to my debugger following values are stored
(1, BadPtr, 262148, 17) instead of
(2511, tr("Home"), 20481, 1272923)
Does anybody know which mistake I have done? I am thankful for any advise.