Results 1 to 9 of 9

Thread: QDict

  1. #1
    Join Date
    Dec 2007
    Posts
    119
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default QDict

    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?

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QDict

    Could you show the relevant code?
    J-P Nurmi

  3. #3
    Join Date
    Dec 2007
    Posts
    119
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: QDict

    Quote Originally Posted by jpn View Post
    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:

    Qt Code:
    1. DtTMApplication::app()->ModelDataDict().setAutoDelete(false);
    2. QString izKey ("ImpactZone_");
    3.  
    4. DtVector izLocalPosition;
    5. DtGeodeticCoord geodIZPosition;
    6. geodIZPosition.setLat(lat);
    7. geodIZPosition.setLon(lon);
    8. geodIZPosition.setAlt(alt);
    9. myCoordinateSystem->geodeticToLocal(geodIZPosition, izLocalPosition);
    10. QPtrList<DtPoint> myPoints;
    11. DtPoint impactZonePoint(izLocalPosition.x(), izLocalPosition.y(), izLocalPosition.z());
    12. myPoints.append(&impactZonePoint);
    13. DtEnvironmentalModelData* impactZone = DtTMApplication::app()->createObject("Target Point", myPoints);
    14. DtTMApplication::app()->ModelDataDict().remove(impactZone->key().string());
    15. impactZone->setKey( izKey + QString::number(identifier));
    16. DtTMApplication::app()->ModelDataDict().insert(impactZone->key().string(),impactZone);
    17. impactZone->setCanEdit(false);
    18. impactZone->setLineWidth(1);
    19. impactZone->setColor(QColor(255,0,0));
    20. DtTMApplication::app()->ModelDataDict().setAutoDelete(true);
    To copy to clipboard, switch view to plain text mode 


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

    Qt Code:
    1. QString izKey ("ImpactZone_");
    2. DtTMApplication::app()->ModelDataDict().remove(izKey+QString::number(identifier));
    To copy to clipboard, switch view to plain text mode 
    Last edited by wysota; 25th February 2008 at 14:11. Reason: missing [code] tags

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QDict

    How do you "refresh" your gui?

  5. #5
    Join Date
    Dec 2007
    Posts
    119
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: QDict

    Quote Originally Posted by wysota View Post
    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!

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QDict

    Can we see the code used to perform the refresh?

  7. #7
    Join Date
    Dec 2007
    Posts
    119
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: QDict

    Quote Originally Posted by wysota View Post
    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

    May be a problem related to the QDict autodelete?

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QDict

    Quote Originally Posted by fruzzo View Post
    sorry but that libraries aren't open source...so I don't have too the code used to perform the refresh
    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.

  9. #9
    Join Date
    Dec 2007
    Posts
    119
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: QDict

    ok ... anyway thanks!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.