Short Description: TransferGfxItems now implemented as beziar curves (arcs) Bug Number: n/a Release notes (y/n): no For Release Nums: 6.1 Implemented TransferGfxItem shape as a bezier curve (arc), and resolved resulting problems with ToolTips and Context Menus. The TransferGfxItem class was changed from a QGraphicsLineItem subclass (with the original SupplyGfxItem implementation) to a regular QGraphicsItem subclass with custom shape(), boundingRect() and paint() methods. Today's initial bezier curve implementation resulted in ALL coordinates under (within) the curve being regarded as INSIDE the TransferGfxItem shape. That caused problems for both ToolTips and Context Menus. So, for the shape() function, a full enclosed 2D shape was created from a pair of nested bezier curves -- one slightly smaller and one slightly larger than the single line bezier curve. However, the single line bezier curve is used in the TransferGfxItem paint() method. There were additional problems with TransferGfxItems interfering with context menus on Simulation Objects and Accounts. The initial implementation for having TransferGfxItems defer the context menu request was causing that request to go only the Scene, and not other QGraphicsItems at the clicked point (e.g. SimObjs and Accounts). --------------------------- QtUtils/TransferGfxItem.hpp QtUtils/TransferGfxItem.cpp --------------------------- Some of the new data members (_pen, _fromPnt, _toPnt) are introduced to replace values which had been provided by the old base class (QGraphicsLineItem). Others were added to represent the computed bezier curve and the dependent QPainterPaths (which are effectively "cached" instead of computed on the fly for each use). New data members: QPen _pen; QPointF _fromPnt; QPointF _toPnt; QVector _bezierControlPoints; // [0..3] QPainterPath _simpleBezierPath; QPainterPath _thickBezierPath; QRectF _boundRect; Geometric computations are performed in this method: void TransferGfxItem::updateEndPoints(); Additional geometry computation changes in: void TransferGfxItem::updateArrowHead(); New methods for to support the base class change: // virtual from QGraphicsItem virtual QPainterPath shape() const; virtual QRectF boundingRect() const; New methods to resolve context menu and tooltip problems: SimObjGfxItem* simObjGfxItem1() const; SimObjGfxItem* simObjGfxItem2() const; // Note: It is necessary to override the QGraphicsTextItem // implementations of these QGraphicsItem virtual methods and // explicitly 'ignore' these context menu and mouse events in // order for the QGraphicsScene to receive them. // // virtual from QGraphicsItem virtual void contextMenuEvent (QGraphicsSceneContextMenuEvent*); virtual void mouseDoubleClickEvent (QGraphicsSceneMouseEvent*); virtual void mouseMoveEvent (QGraphicsSceneMouseEvent*); virtual void mousePressEvent (QGraphicsSceneMouseEvent*); virtual void mouseReleaseEvent (QGraphicsSceneMouseEvent*); ------------------------- QtUtils/SupplyGfxItem.hpp QtUtils/SupplyGfxItem.cpp ------------------------- Added similar support for SupplyGfxItems (see above). ------------------------------ QtUtils/AccountGfxItem.hpp QtUtils/AccountGfxItem.cpp QtUtils/AcctRowGfxItem.hpp QtUtils/SimObjGfxItem.hpp QtUtils/RwGraphicsItemDefs.hpp ------------------------------ (1) Added methods to retrieve the related, or containing SimObjGfxItem: SimObjGfxItem* AccountGfxItem::simObjGfxItem() const; SimObjGfxItem* AcctRowGfxItem::simObjGfxItem() const; (2) Added type ID's for internal child items: #define UserType_AccountGfxItem_Label (QGraphicsItem::UserType + ..) #define UserType_SimObjGfxItem_Icon (QGraphicsItem::UserType + ..) #define UserType_SimObjGfxItem_Label (QGraphicsItem::UserType + ..) ----------------------------- QtUtils/WorkspaceGfxScene.hpp QtUtils/WorkspaceGfxScene.cpp ----------------------------- Broke out processing of Context Menu (request) Events into a distinct public method, callable from TransferGfxItem and SupplyGfxItem: // Returns indication that the event was processed. Otherwise, call // base class method: RwGraphicsScene::contextMenuEvent (evt); bool processContextMenuEvent ( RwGraphicsView*, const QPointF& scenePnt, const QPoint& screenPnt); Rewrote these two methods to examine ALL QGraphicsItems whose "shape" hits the specified "Scene" coordinates -- instead of just the single item returned from QGraphicsScene::itemAt(). SimObjGfxItem* getSimObjItemAtScenePos (const QPointF&) const; AccountGfxItem* getAcctItemAtScenePos (const QPointF&) const; ---