[SOLVED]Qvector Problem instansiate Thanks ALL
-
I think that any file sharing hosting will be suitable. For example try http://rghost.net/
-
look for a file hoster (e.g. gitorious.org, but you need a logon) or any other
-
-
Try again with this code
I had comment the problem spots in the last code.
The new one is here
"Vectorproblems":http://rghost.net/31386231pls
-
in my testcase i do like this in my constructor
@GlobalParams::GlobalParams()
{
testRunning(false);qDebug() << presetVector.isEmpty(); qDebug() << presetVector.size() << " vectorsize and kapacitet =" << presetVector.capacity(); //Create a tempobject for test ClPresetLoadsTestValues p(10,10,10); qDebug() << "create object "; presetVector.append(p); qDebug() << "appendat obj"; qDebug() << presetVector.size() << " vectorsize and kapacitet =" << presetVector.capacity();
}@
and I got this text in my consol
true
0 vectorsize and kapacitet = 0
create ClPresetLoadsTestValues
create object
delete ClPresetLoadsTestValues
appendat obj
1 vectorsize and kapacitet = 1
delete ClPresetLoadsTestValuesAnd later when I try to add a ClPresetLoadsTestValues my program crashes and NO i don't delete the object.
here is my object
@@ClPresetLoadsTestValues::ClPresetLoadsTestValues()
{
qDebug() << "create ClPresetLoadsTestValues";
}ClPresetLoadsTestValues::ClPresetLoadsTestValues(int k, int m, int s)
{
this->kw = k;
this->min = m;
this->sec = s;
qDebug() << "create ClPresetLoadsTestValues";
}ClPresetLoadsTestValues::~ClPresetLoadsTestValues()
{
qDebug() << "delete ClPresetLoadsTestValues";
}//set and getters
@and my func to add the obj
@void GlobalParams::addValuesToLoadsTestTemp(int kw, int min, int sec)
{
ClPresetLoadsTestValues p(kw,min,sec);qDebug() << "try to append"; qDebug() << this->presetVector.size() << " vektorstorlek"; //IT crashes here if (this->presetVector.isEmpty()) qDebug() << "Empty"; else qDebug() << "SIZE " << presetVector.size() ; presetVector.append(p); qDebug() << "appendad";
}
@
-
Here it is
the two files with this problem
"myFiles":http://rghost.net/31396481 -
Please provide a
- complete
- compilable
- minimal
test case.
leave out
- intermediate object file (*.o)
- autogenerated stuff from moc and uic (moc_.cpp, ui_.h)
- Qt Creator user data (*.pro.user)
- the final executable
You're more likely to get an answer if the fellows trying to help here in the forums do not need to guess how to set up a correct test case and a project file.
-
Here is a full tested version with compiling.
I uploaded a small ex earlier
"MyApp":http://rghost.net/31409351