Short Description: Accounting WS Qt4 Port: (1) Transfer Items, (2) Crash Fix Bug Number: n/a Release notes (y/n): no For Release Nums: 6.1 (1) Bifurcated SupplyGfxItem class, to TransferGfxItem. The latter has virtually the same implementation, but is instantiated and managed by client classes in the case of Transfer Supplies (as opposed to other types of Supplies). (2) General: In all of our QGraphicsItem subclasses, redefine the int type() method, to return a class-specific class ID defined in this new definition header file: QtUtils/RwGraphicsItemDefs.hpp. (3) Cause of "clear workspace" crash likely to be fixed by changes in QtUtils/WorkspaceGfxScene.cpp ... deletions of high level QGraphicsItems caused problem for iteration over automatically deleted child items. ---------------------- QtUtils/Make.package QtUtils/QtUtils.pro QtUtils/QtUtils.vcproj ---------------------- Added to build: RwGraphicsItemDefs.hpp TransferGfxItem.hpp TransferGfxItem.cpp -------------------------- QtUtils/AccountGfxItem.hpp QtUtils/AccountGfxItem.cpp -------------------------- Introduction of TransferGfxItem class: QMap _supplyItemMap; QMap _transferItemMap; <<< ADDED void addTransferItem (TransferGfxItem*); void removeTransferItem (TransferGfxItem*); Addressing a "clear workspace" crash: void prepareForDeletion(); void childDestroyed(); // Qt Slot void accountGfxItemDeleted (const AccountGfxItem*); // Qt Signal -------------------------- QtUtils/AcctRowGfxItem.hpp QtUtils/AcctRowGfxItem.cpp -------------------------- Addressing a "clear workspace" crash: void removeAccount (const Account*, bool deleteItemToo=true); // ADDED PARAM void removeAccountItem (const AccountGfxItem*); // NEW METHOD void accountGfxItemDeleted (const AccountGfxItem*); // Qt slot void childDestroyed(); // Qt slot ------------------------------ QtUtils/SimulationGfxScene.cpp ------------------------------ Provisions for TransferGfxItem (similar to SupplyGfxItem) added to methods: void SimulationGfxScene::reconfigureSupplyItems() QString SimulationGfxScene::toolTipString (QGraphicsSceneHelpEvent*) --------------------------- QtUtils/SupplyGfxItem.cpp QtUtils/TransferGfxItem.cpp --------------------------- Addressing a "clear workspace" crash: Don't explicitly delete the _arrowHeadItem. Instead, just drop the pointer once SupplyGfxItem deletion has started. Memory leaks of _arrowHeadItems was tested -- they are automatically deleted as needed. ----------------------------- QtUtils/WorkspaceGfxScene.hpp QtUtils/WorkspaceGfxScene.cpp ----------------------------- Added methods to support TransferGfxItem (similar to SupplyGfxItem): QMap getTransferMap() const; TransferGfxItem* getTransferItem (const Supply*) const; Provisions for TransferGfxItem (similar to SupplyGfxItem) added to methods: void WorkspaceGfxScene::addSupplyItem (Supply*) void WorkspaceGfxScene::deleteSupplyItem (Supply*) void WorkspaceGfxScene::setSupplyStyle (Supply*) void WorkspaceGfxScene::clearLinkAndSupplyItems() Addressing a "clear workspace" crash: Widespread use of checking the QGraphicsItem::type() virtual method value before doing any dynamic casting to our QGraphicsItem subclasses. *** THIS may be the specific fix to the "clear workspace" crashing: In methods: void WorkspaceGfxScene::clearSimObjItems() ... void WorkspaceGfxScene::clearLinkAndSupplyItems() ... ... Don't do any actual deletions WHILE iterating over the set of all QGraphicsItems. Probably, encountering pointers to certain child QGraphicsItems which were deleted from the deletion of a previously found SimObjGfxItem (or Supply or Transfer item) was causing a problem. ---------------------------- QtUtils/WorkspaceGfxView.cpp ---------------------------- Provisions for TransferGfxItem (similar to SupplyGfxItem) added to methods: QString WorkspaceGfxView::mouseStatusMessage (const QPoint& .. ---------------------------- QtUtils/ArrowHeadGfxItem.hpp QtUtils/ArrowHeadGfxItem.cpp QtUtils/LinkGfxItem.hpp QtUtils/MarkPointGfxItem.hpp QtUtils/RwGraphicsItem.hpp QtUtils/SimObjGfxItem.hpp QtUtils/SimpleSimObjGfxItem.hpp QtUtils/SupplyGfxItem.hpp QtUtils/TransferGfxItem.hpp ---------------------------- Minor: added QGraphicsItem int type() virtual method definition. See new header file: QtUtils/RwGraphicsItemDefs.hpp. ---