PDA

View Full Version : QDict



fruzzo
22nd February 2008, 16:01
HI...I have a problem with the management of a QDict.... in my gui i have to print some objects collected inside a QDict. All work fine until I try to remove one of the objects from the dictionary. I call myDictionary.remove(mykey) and the object was removed well from the gui but when I make a refresh of the gui, the same object that I've just removed reappear...why?

jpn
22nd February 2008, 16:39
Could you show the relevant code?

fruzzo
25th February 2008, 13:58
Could you show the relevant code?

Ok...sorry, this one is the part of code about insert the symbol on a map and it works fine:


DtTMApplication::app()->ModelDataDict().setAutoDelete(false);
QString izKey ("ImpactZone_");

DtVector izLocalPosition;
DtGeodeticCoord geodIZPosition;
geodIZPosition.setLat(lat);
geodIZPosition.setLon(lon);
geodIZPosition.setAlt(alt);
myCoordinateSystem->geodeticToLocal(geodIZPosition, izLocalPosition);
QPtrList<DtPoint> myPoints;
DtPoint impactZonePoint(izLocalPosition.x(), izLocalPosition.y(), izLocalPosition.z());
myPoints.append(&impactZonePoint);
DtEnvironmentalModelData* impactZone = DtTMApplication::app()->createObject("Target Point", myPoints);
DtTMApplication::app()->ModelDataDict().remove(impactZone->key().string());
impactZone->setKey( izKey + QString::number(identifier));
DtTMApplication::app()->ModelDataDict().insert(impactZone->key().string(),impactZone);
impactZone->setCanEdit(false);
impactZone->setLineWidth(1);
impactZone->setColor(QColor(255,0,0));
DtTMApplication::app()->ModelDataDict().setAutoDelete(true);


instead this one is the part about remove the symbol from the map:


QString izKey ("ImpactZone_");
DtTMApplication::app()->ModelDataDict().remove(izKey+QString::number(ident ifier));

wysota
25th February 2008, 14:12
How do you "refresh" your gui?

fruzzo
25th February 2008, 16:23
How do you "refresh" your gui?

the library for the map do it automatically, so when a remove the symbol from dictionary it disappear automatically from the map too...when i zoom in/out or pan the map it reappear, and I don't want this behavior! :confused:

wysota
25th February 2008, 16:30
Can we see the code used to perform the refresh?

fruzzo
26th February 2008, 09:27
Can we see the code used to perform the refresh?

sorry but that libraries aren't open source...so I don't have too the code used to perform the refresh :o

May be a problem related to the QDict autodelete?

wysota
26th February 2008, 11:33
sorry but that libraries aren't open source...so I don't have too the code used to perform the refresh :o
We can't help you then.


May be a problem related to the QDict autodelete?
No idea. I don't think this is a Qt related problem. I suggest you ask your closed source solution provider for help, we can't debug code we don't have access to.

fruzzo
26th February 2008, 18:50
ok ... anyway thanks! :)