##// END OF EJS Templates
Emit hover leave signal from PieSliceItem when it gets destroyed....
Jani Honkonen -
r1083:b264b1ddc4c8
parent child
Show More
@@ -57,6 +57,7 void DrilldownSlice::updateLabel()
57 57 void DrilldownSlice::showHighlight(bool show)
58 58 {
59 59 setLabelVisible(show);
60 setExploded(show);
60 61 }
61 62
62 63 #include "moc_drilldownslice.cpp"
@@ -40,7 +40,8 QPointF offset(qreal angle, qreal length)
40 40 }
41 41
42 42 PieSliceItem::PieSliceItem(QGraphicsItem* parent)
43 :QGraphicsObject(parent)
43 :QGraphicsObject(parent),
44 m_hovered(false)
44 45 {
45 46 setAcceptHoverEvents(true);
46 47 setAcceptedMouseButtons(Qt::MouseButtonMask);
@@ -49,7 +50,10 PieSliceItem::PieSliceItem(QGraphicsItem* parent)
49 50
50 51 PieSliceItem::~PieSliceItem()
51 52 {
52
53 // If user is hovering over the slice and it gets destroyed we do
54 // not get a hover leave event. So we must emit the signal here.
55 if (m_hovered)
56 emit hovered(false);
53 57 }
54 58
55 59 QRectF PieSliceItem::boundingRect() const
@@ -85,11 +89,13 void PieSliceItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* /*op
85 89
86 90 void PieSliceItem::hoverEnterEvent(QGraphicsSceneHoverEvent* /*event*/)
87 91 {
92 m_hovered = true;
88 93 emit hovered(true);
89 94 }
90 95
91 96 void PieSliceItem::hoverLeaveEvent(QGraphicsSceneHoverEvent* /*event*/)
92 97 {
98 m_hovered = false;
93 99 emit hovered(false);
94 100 }
95 101
@@ -72,6 +72,7 private:
72 72 QPainterPath m_slicePath;
73 73 QPainterPath m_labelArmPath;
74 74 QRectF m_labelTextRect;
75 bool m_hovered;
75 76 };
76 77
77 78 QTCOMMERCIALCHART_END_NAMESPACE
General Comments 0
You need to be logged in to leave comments. Login now