#include <kdganttconstraintgraphicsitem.h>
Definition at line 35 of file kdganttconstraintgraphicsitem.h.
Public Types | |
enum | { Type = UserType + 43 } |
Public Member Functions | |
QRectF | boundingRect () const |
const Constraint & | constraint () const |
ConstraintGraphicsItem (const Constraint &c, QGraphicsItem *parent=0, GraphicsScene *scene=0) | |
QPointF | end () const |
QString | ganttToolTip () const |
void | paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0) |
Constraint | proxyConstraint () const |
GraphicsScene * | scene () const |
void | setEnd (const QPointF &end) |
void | setStart (const QPointF &start) |
QPointF | start () const |
int | type () const |
void | updateItem (const QPointF &start, const QPointF &end) |
virtual | ~ConstraintGraphicsItem () |
anonymous enum |
ConstraintGraphicsItem::ConstraintGraphicsItem | ( | const Constraint & | c, | |
QGraphicsItem * | parent = 0 , |
|||
GraphicsScene * | scene = 0 | |||
) | [explicit] |
Definition at line 40 of file kdganttconstraintgraphicsitem.cpp.
00041 : QGraphicsItem( parent, scene ), m_constraint( c ) 00042 { 00043 setPos( QPointF( 0., 0. ) ); 00044 setAcceptsHoverEvents( false ); 00045 setAcceptedMouseButtons( Qt::NoButton ); 00046 setZValue( 10. ); 00047 }
ConstraintGraphicsItem::~ConstraintGraphicsItem | ( | ) | [virtual] |
QRectF ConstraintGraphicsItem::boundingRect | ( | ) | const |
Definition at line 70 of file kdganttconstraintgraphicsitem.cpp.
References KDGantt::ItemDelegate::constraintBoundingRect(), KDGantt::GraphicsScene::itemDelegate(), and scene().
00071 { 00072 return scene()->itemDelegate()->constraintBoundingRect( m_start, m_end, m_constraint ); 00073 }
const Constraint& KDGantt::ConstraintGraphicsItem::constraint | ( | ) | const |
QPointF KDGantt::ConstraintGraphicsItem::end | ( | ) | const |
QString ConstraintGraphicsItem::ganttToolTip | ( | ) | const |
Definition at line 83 of file kdganttconstraintgraphicsitem.cpp.
References KDGantt::Constraint::data().
Referenced by KDGantt::GraphicsScene::helpEvent().
00084 { 00085 return m_constraint.data( Qt::ToolTipRole ).toString(); 00086 }
void ConstraintGraphicsItem::paint | ( | QPainter * | painter, | |
const QStyleOptionGraphicsItem * | option, | |||
QWidget * | widget = 0 | |||
) |
Definition at line 75 of file kdganttconstraintgraphicsitem.cpp.
References KDGantt::GraphicsScene::itemDelegate(), KDGantt::ItemDelegate::paintConstraintItem(), and scene().
00077 { 00078 Q_UNUSED( widget ); 00079 00080 scene()->itemDelegate()->paintConstraintItem( painter, *option, m_start, m_end, m_constraint ); 00081 }
Constraint ConstraintGraphicsItem::proxyConstraint | ( | ) | const |
Definition at line 63 of file kdganttconstraintgraphicsitem.cpp.
References KDGantt::Constraint::endIndex(), scene(), KDGantt::Constraint::startIndex(), KDGantt::GraphicsScene::summaryHandlingModel(), and KDGantt::Constraint::type().
00064 { 00065 return Constraint( scene()->summaryHandlingModel()->mapFromSource( m_constraint.startIndex() ), 00066 scene()->summaryHandlingModel()->mapFromSource( m_constraint.endIndex() ), 00067 m_constraint.type() ); 00068 }
GraphicsScene * ConstraintGraphicsItem::scene | ( | ) | const |
Definition at line 58 of file kdganttconstraintgraphicsitem.cpp.
Referenced by boundingRect(), paint(), and proxyConstraint().
00059 { 00060 return qobject_cast<GraphicsScene*>( QGraphicsItem::scene() ); 00061 }
void ConstraintGraphicsItem::setEnd | ( | const QPointF & | end | ) |
Definition at line 95 of file kdganttconstraintgraphicsitem.cpp.
Referenced by KDGantt::GraphicsItem::addEndConstraint(), and updateItem().
00096 { 00097 prepareGeometryChange(); 00098 m_end = end; 00099 update(); 00100 }
void ConstraintGraphicsItem::setStart | ( | const QPointF & | start | ) |
Definition at line 88 of file kdganttconstraintgraphicsitem.cpp.
Referenced by KDGantt::GraphicsItem::addStartConstraint(), and updateItem().
00089 { 00090 prepareGeometryChange(); 00091 m_start = start; 00092 update(); 00093 }
QPointF KDGantt::ConstraintGraphicsItem::start | ( | ) | const |
int ConstraintGraphicsItem::type | ( | ) | const |
Definition at line 53 of file kdganttconstraintgraphicsitem.cpp.
References Type.
00054 { 00055 return Type; 00056 }
void ConstraintGraphicsItem::updateItem | ( | const QPointF & | start, | |
const QPointF & | end | |||
) |
Definition at line 102 of file kdganttconstraintgraphicsitem.cpp.
References setEnd(), and setStart().