COPASI API  4.16.103
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
CQStyledGraphicsItem Class Reference

#include <CQStyledGraphicsItem.h>

Inheritance diagram for CQStyledGraphicsItem:
Inheritance graph
[legend]
Collaboration diagram for CQStyledGraphicsItem:
Collaboration graph
[legend]

Public Member Functions

 CQStyledGraphicsItem (const CLGraphicalObject *go, const CLRenderResolver *resolver=NULL)
 
virtual ~CQStyledGraphicsItem ()
 
- Public Member Functions inherited from CQCopasiGraphicsItem
 CQCopasiGraphicsItem (const CLRenderResolver *resolver, const CLStyle *style)
 
const CLRenderResolvergetResolver () const
 
const CLStylegetStyle () const
 
void setResolver (const CLRenderResolver *resolver)
 
void setStyle (const CLStyle *style)
 
virtual ~CQCopasiGraphicsItem ()
 

Protected Member Functions

virtual QVariant itemChange (GraphicsItemChange change, const QVariant &value)
 
void mouseReleaseEvent (QGraphicsSceneMouseEvent *event)
 

Protected Attributes

bool mWasMoved
 
- Protected Attributes inherited from CQCopasiGraphicsItem
const CLRenderResolvermpResolver
 
const CLStylempStyle
 

Detailed Description

Definition at line 17 of file CQStyledGraphicsItem.h.

Constructor & Destructor Documentation

CQStyledGraphicsItem::CQStyledGraphicsItem ( const CLGraphicalObject go,
const CLRenderResolver resolver = NULL 
)

Definition at line 15 of file CQStyledGraphicsItem.cpp.

References COPASI_LAYOUT_KEY, CQRenderConverter::fillGroupFromStyle(), CLGraphicalObject::getBoundingBox(), CLGraphicalObject::getKey(), CQCopasiGraphicsItem::mpResolver, and CQCopasiGraphicsItem::mpStyle.

16  : CQCopasiGraphicsItem(resolver, resolver != NULL ? resolver->resolveStyle(go) : NULL)
17  , mWasMoved(false)
18 {
19  setFlag(QGraphicsItem::ItemIsMovable);
20  setFlag(QGraphicsItem::ItemIsSelectable);
21  setFlag(QGraphicsItem::ItemSendsGeometryChanges);
22  setData(COPASI_LAYOUT_KEY, QString(go->getKey().c_str()));
24 }
#define COPASI_LAYOUT_KEY
const CLBoundingBox & getBoundingBox() const
const CLStyle * resolveStyle(const CLGraphicalObject *pObject) const
static void fillGroupFromStyle(QGraphicsItemGroup *group, const CLBoundingBox *bounds, const CLStyle *style, const CLRenderResolver *resolver)
virtual const std::string & getKey() const
const CLRenderResolver * mpResolver
CQCopasiGraphicsItem(const CLRenderResolver *resolver, const CLStyle *style)
CQStyledGraphicsItem::~CQStyledGraphicsItem ( )
virtual

Definition at line 26 of file CQStyledGraphicsItem.cpp.

27 {
28 }

Member Function Documentation

QVariant CQStyledGraphicsItem::itemChange ( GraphicsItemChange  change,
const QVariant &  value 
)
protectedvirtual

Definition at line 46 of file CQStyledGraphicsItem.cpp.

References mWasMoved.

47 {
48  CQLayoutScene * currentScene = dynamic_cast<CQLayoutScene *>(scene());
49 
50  if (change == ItemPositionHasChanged && currentScene)
51  {
52  mWasMoved = true;
53  }
54 
55  return QGraphicsItem::itemChange(change, value);
56 }
void CQStyledGraphicsItem::mouseReleaseEvent ( QGraphicsSceneMouseEvent *  event)
protected

Definition at line 30 of file CQStyledGraphicsItem.cpp.

References COPASI_LAYOUT_KEY, mWasMoved, and CQLayoutScene::updatePosition().

31 {
32  CQLayoutScene * currentScene = dynamic_cast<CQLayoutScene *>(scene());
33 
34  if (mWasMoved && currentScene)
35  {
36  QPointF currentPos = pos();
37  currentScene->updatePosition(data(COPASI_LAYOUT_KEY).toString(), currentPos);
38  mWasMoved = false;
39  }
40  else
41  {
42  QGraphicsItem::mouseReleaseEvent(event);
43  }
44 }
#define COPASI_LAYOUT_KEY
void updatePosition(const QString &key, const QPointF &newPos)

Member Data Documentation

bool CQStyledGraphicsItem::mWasMoved
protected

Definition at line 27 of file CQStyledGraphicsItem.h.

Referenced by itemChange(), and mouseReleaseEvent().


The documentation for this class was generated from the following files: