barchartitem_p.h
75 lines
| 2.0 KiB
| text/x-c
|
CLexer
|
r666 | #ifndef BARCHARTITEM_H | ||
#define BARCHARTITEM_H | ||||
|
r126 | |||
#include "chartitem_p.h" | ||||
|
r338 | #include "qbarseries.h" | ||
|
r183 | #include <QPen> | ||
#include <QBrush> | ||||
|
r126 | #include <QGraphicsItem> | ||
QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||||
|
r256 | class Bar; | ||
|
r263 | class BarValue; | ||
|
r487 | class QChartAxisCategories; | ||
class QChart; | ||||
|
r256 | |||
|
r681 | //typedef QVector<QRectF> BarLayout; | ||
|
r671 | |||
|
r679 | class BarChartItem : public ChartItem | ||
|
r126 | { | ||
|
r139 | Q_OBJECT | ||
|
r126 | public: | ||
|
r677 | BarChartItem(QBarSeries *series, ChartPresenter *presenter); | ||
|
r666 | virtual ~BarChartItem(); | ||
|
r126 | |||
|
r677 | // Common implemantation of different presenters. Not to be instantiated. | ||
// TODO: combine this with BarPresenter and derive other presenters from it? | ||||
|
r175 | public: | ||
|
r126 | // From QGraphicsItem | ||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); | ||||
QRectF boundingRect() const; | ||||
|
r167 | // TODO: Consider the domain for layoutChanged. May be use case, may not be. If it is, then the derived classes need to implement it | ||
|
r126 | virtual void dataChanged(); // data of series has changed -> need to recalculate bar sizes | ||
|
r655 | private slots: | ||
|
r126 | |||
|
r671 | public: | ||
|
r694 | virtual QVector<QRectF> calculateLayout(); | ||
|
r681 | void applyLayout(const QVector<QRectF> &layout); | ||
void setLayout(const QVector<QRectF> &layout); | ||||
void updateLayout(const QVector<QRectF> &layout); | ||||
|
r671 | |||
|
r679 | QRectF geometry() const { return m_rect;} | ||
|
r389 | public slots: | ||
|
r139 | void handleModelChanged(int index); | ||
|
r611 | void handleDomainChanged(qreal minX, qreal maxX, qreal minY, qreal maxY); | ||
|
r737 | void handleGeometryChanged(const QRectF &size); | ||
|
r671 | void handleLayoutChanged(); | ||
|
r139 | |||
|
r288 | // Internal slots | ||
void showToolTip(QPoint pos, QString tip); // shows tooltip (if enabled) | ||||
|
r280 | |||
|
r126 | protected: | ||
|
r159 | // TODO: consider these. | ||
|
r763 | qreal m_domainMinX; | ||
qreal m_domainMaxX; | ||||
qreal m_domainMinY; | ||||
qreal m_domainMaxY; | ||||
|
r674 | |||
|
r679 | QRectF m_rect; | ||
|
r763 | bool m_layoutSet; // True, if component has been laid out. | ||
QVector<QRectF> m_layout; | ||||
|
r288 | |||
|
r256 | // Not owned. | ||
|
r763 | QBarSeries *m_series; | ||
QList<Bar *> m_bars; | ||||
QList<BarValue *> m_floatingValues; | ||||
|
r126 | }; | ||
QTCOMMERCIALCHART_END_NAMESPACE | ||||
|
r666 | #endif // BARCHARTITEM_H | ||