barchartitem_p.h
79 lines
| 2.1 KiB
| text/x-c
|
CLexer
sauimone
|
r666 | #ifndef BARCHARTITEM_H | ||
#define BARCHARTITEM_H | ||||
sauimone
|
r126 | |||
#include "chartitem_p.h" | ||||
sauimone
|
r338 | #include "qbarseries.h" | ||
sauimone
|
r183 | #include <QPen> | ||
#include <QBrush> | ||||
sauimone
|
r126 | #include <QGraphicsItem> | ||
QTCOMMERCIALCHART_BEGIN_NAMESPACE | ||||
sauimone
|
r256 | class Bar; | ||
sauimone
|
r263 | class BarValue; | ||
sauimone
|
r487 | class QChartAxisCategories; | ||
class QChart; | ||||
sauimone
|
r256 | |||
sauimone
|
r681 | //typedef QVector<QRectF> BarLayout; | ||
sauimone
|
r671 | |||
Michal Klocek
|
r679 | class BarChartItem : public ChartItem | ||
sauimone
|
r126 | { | ||
Michal Klocek
|
r139 | Q_OBJECT | ||
sauimone
|
r126 | public: | ||
Michal Klocek
|
r677 | BarChartItem(QBarSeries *series, ChartPresenter *presenter); | ||
sauimone
|
r666 | virtual ~BarChartItem(); | ||
sauimone
|
r126 | |||
Michal Klocek
|
r677 | // Common implemantation of different presenters. Not to be instantiated. | ||
// TODO: combine this with BarPresenter and derive other presenters from it? | ||||
sauimone
|
r175 | public: | ||
sauimone
|
r126 | // From QGraphicsItem | ||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); | ||||
QRectF boundingRect() const; | ||||
sauimone
|
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 | ||
sauimone
|
r126 | virtual void dataChanged(); // data of series has changed -> need to recalculate bar sizes | ||
Marek Rosa
|
r655 | private slots: | ||
sauimone
|
r681 | //virtual void layoutChanged(); // layout has changed -> need to recalculate bar sizes | ||
sauimone
|
r126 | |||
sauimone
|
r671 | public: | ||
sauimone
|
r681 | QVector<QRectF> calculateLayout(); | ||
void applyLayout(const QVector<QRectF> &layout); | ||||
void setLayout(const QVector<QRectF> &layout); | ||||
void updateLayout(const QVector<QRectF> &layout); | ||||
sauimone
|
r671 | |||
Michal Klocek
|
r679 | QRectF geometry() const { return m_rect;} | ||
sauimone
|
r487 | protected: | ||
void initAxisLabels(); | ||||
Michal Klocek
|
r389 | public slots: | ||
Michal Klocek
|
r139 | void handleModelChanged(int index); | ||
Tero Ahola
|
r611 | void handleDomainChanged(qreal minX, qreal maxX, qreal minY, qreal maxY); | ||
Michal Klocek
|
r139 | void handleGeometryChanged(const QRectF& size); | ||
sauimone
|
r671 | void handleLayoutChanged(); | ||
Michal Klocek
|
r139 | |||
sauimone
|
r288 | // Internal slots | ||
void showToolTip(QPoint pos, QString tip); // shows tooltip (if enabled) | ||||
sauimone
|
r280 | |||
sauimone
|
r126 | protected: | ||
sauimone
|
r159 | // TODO: consider these. | ||
sauimone
|
r674 | qreal mDomainMinX; | ||
qreal mDomainMaxX; | ||||
qreal mDomainMinY; | ||||
qreal mDomainMaxY; | ||||
Michal Klocek
|
r679 | QRectF m_rect; | ||
sauimone
|
r126 | bool mLayoutSet; // True, if component has been laid out. | ||
sauimone
|
r681 | QVector<QRectF> mLayout; | ||
sauimone
|
r288 | |||
sauimone
|
r256 | // Not owned. | ||
sauimone
|
r473 | QBarSeries* mSeries; | ||
sauimone
|
r256 | QList<Bar*> mBars; | ||
sauimone
|
r263 | QList<BarValue*> mFloatingValues; | ||
sauimone
|
r126 | }; | ||
QTCOMMERCIALCHART_END_NAMESPACE | ||||
sauimone
|
r666 | #endif // BARCHARTITEM_H | ||