##// END OF EJS Templates
Fix crash when removing pie series from chart...
Fix crash when removing pie series from chart Connections cleanup in PieChartItem destructor didn't account for the possibility of series already having been destroyed. Changed m_series to QPointer so that it'll notice when series gets destroyed, and also added cleaning of slices to series destructor. Task-number: QTRD-1946 Change-Id: I651347bfcfbe7cd78dd26220a811fea5c8071fce Reviewed-by: Mika Salmela Reviewed-by: Mika Salmela <mika.salmela@digia.com>

File last commit:

r2432:53927f716a3d
r2475:9e35a3a169ed
Show More
piesliceitem_p.h
90 lines | 2.6 KiB | text/x-c | CLexer
Jani Honkonen
Add license headers
r794 /****************************************************************************
**
Miikka Heikkinen
Fixed the copyright year 2012 -> 2013
r2432 ** Copyright (C) 2013 Digia Plc
Jani Honkonen
Add license headers
r794 ** All rights reserved.
** For any questions to Digia, please use contact form at http://qt.digia.com
**
** This file is part of the Qt Commercial Charts Add-on.
**
** $QT_BEGIN_LICENSE$
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia.
**
** If you have questions regarding the use of this file, please use
** contact form at http://qt.digia.com
** $QT_END_LICENSE$
**
****************************************************************************/
unknown
Added missing warning about private implementation
r1366 // W A R N I N G
// -------------
//
// This file is not part of the QtCommercial Chart API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
Jani Honkonen
rename PieSlice -> PieSliceItem
r673 #ifndef PIESLICEITEM_H
#define PIESLICEITEM_H
Tero Ahola
Integrated draft version of pie series
r51
#include "qchartglobal.h"
Tero Ahola
Refactored themes; now enabled for line, scatter and pies...
r103 #include "charttheme_p.h"
Jani Honkonen
Use signals from pieseries, visible hover and exploding slices
r157 #include "qpieseries.h"
Jani Honkonen
Refactoring QPieSlice private implementation. Removes the useless QPieSlicePrivate layer and uses PieSliceData directly.
r818 #include "pieslicedata_p.h"
Tero Ahola
Integrated draft version of pie series
r51 #include <QGraphicsItem>
#include <QRectF>
#include <QColor>
Jani Honkonen
Use signals from pieseries, visible hover and exploding slices
r157 #include <QPen>
Tero Ahola
Integrated draft version of pie series
r51
Jani Honkonen
Pie now actually withs the given rectangle and does not go over
r413 #define PIESLICE_LABEL_GAP 5
Tero Ahola
Integrated draft version of pie series
r51 QTCOMMERCIALCHART_BEGIN_NAMESPACE
Jani Honkonen
Rename piepresenter -> piechartitem
r568 class PieChartItem;
Jani Honkonen
Refactoring piechart API (and internals)
r174 class PieSliceLabel;
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 class QPieSlice;
Tero Ahola
Integrated draft version of pie series
r51
Jani Honkonen
rename PieSlice -> PieSliceItem
r673 class PieSliceItem : public QGraphicsObject
Tero Ahola
Integrated draft version of pie series
r51 {
Jani Honkonen
Refactoring piechart API (and internals)
r174 Q_OBJECT
Tero Ahola
Integrated draft version of pie series
r51 public:
Jani Honkonen
more coding style fixes for src-folder...
r2104 PieSliceItem(QGraphicsItem *parent = 0);
Jani Honkonen
rename PieSlice -> PieSliceItem
r673 ~PieSliceItem();
Tero Ahola
Integrated draft version of pie series
r51
Jani Honkonen
Refactor graphical side of pie to simplify the implementation.
r1074 // from QGraphicsItem
Tero Ahola
Integrated draft version of pie series
r51 QRectF boundingRect() const;
QPainterPath shape() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
Jani Honkonen
Pie chart refactoring
r142 void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
Jani Honkonen
Use signals from pieseries, visible hover and exploding slices
r157 void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
Jani Honkonen
Pie chart refactoring
r142 void mousePressEvent(QGraphicsSceneMouseEvent *event);
Tero Ahola
Integrated draft version of pie series
r51
Jani Honkonen
Refactor graphical side of pie to simplify the implementation.
r1074 void setLayout(const PieSliceData &sliceData);
static QPointF sliceCenter(QPointF point, qreal radius, QPieSlice *slice);
Jani Honkonen
Refactoring piechart API (and internals)
r174 Q_SIGNALS:
Jani Honkonen
Add mousebuttons to pie clicked signals
r707 void clicked(Qt::MouseButtons buttons);
Jani Honkonen
API review changes for pie
r1009 void hovered(bool state);
Jani Honkonen
Use signals from pieseries, visible hover and exploding slices
r157
Jani Honkonen
Refactor graphical side of pie to simplify the implementation.
r1074 private:
Jani Honkonen
Refactor pie (again). QPieSlice's now emit signals and no id's anymore. Just pointers in the interface.
r203 void updateGeometry();
Jani Honkonen
Prevent slice label pointing straight down (because it looks bad).
r972 QPainterPath slicePath(QPointF center, qreal radius, qreal startAngle, qreal angleSpan, qreal *centerAngle, QPointF *armStart);
QPainterPath labelArmPath(QPointF start, qreal angle, qreal length, qreal textWidth, QPointF *textStart);
Jani Honkonen
Make pie fit better inside its given rectangle. Label texts still go outside. Needs a bit more work...
r289
Jani Honkonen
Pie chart refactoring
r142 private:
Jani Honkonen
Rename PieSliceLayout -> PieSliceData. A "layout" is a bad name for this.
r668 PieSliceData m_data;
Jani Honkonen
Refactoring pie series and animations.
r621 QRectF m_boundingRect;
Jani Honkonen
Added a pie chart customization example and refactoring the pie interface.
r437 QPainterPath m_slicePath;
QPainterPath m_labelArmPath;
QRectF m_labelTextRect;
Jani Honkonen
Emit hover leave signal from PieSliceItem when it gets destroyed....
r1083 bool m_hovered;
Jani Honkonen
Fix pie animation chrash
r2321
friend class PieSliceAnimation;
Tero Ahola
Integrated draft version of pie series
r51 };
QTCOMMERCIALCHART_END_NAMESPACE
Jani Honkonen
rename PieSlice -> PieSliceItem
r673 #endif // PIESLICEITEM_H