barpresenterbase_p.h
72 lines
| 1.9 KiB
| text/x-c
|
CLexer
sauimone
|
r217 | #ifndef BARPRESENTERBASE_H | ||
#define BARPRESENTERBASE_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; | ||
class BarLabel; | ||||
class Separator; | ||||
sauimone
|
r263 | class BarValue; | ||
sauimone
|
r256 | |||
// Common implemantation of different presenters. Not to be instantiated. | ||||
sauimone
|
r282 | // TODO: combine this with BarPresenter and derive other presenters from it? | ||
sauimone
|
r216 | class BarPresenterBase : public QObject, public ChartItem | ||
sauimone
|
r126 | { | ||
Michal Klocek
|
r139 | Q_OBJECT | ||
sauimone
|
r126 | public: | ||
sauimone
|
r338 | BarPresenterBase(QBarSeries *series, QGraphicsItem *parent = 0); | ||
sauimone
|
r288 | ~BarPresenterBase(); | ||
sauimone
|
r126 | |||
sauimone
|
r175 | public: | ||
sauimone
|
r126 | // From QGraphicsItem | ||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); | ||||
QRectF boundingRect() const; | ||||
// TODO: these may change with layout awarness. | ||||
void setBarWidth( int w ); | ||||
sauimone
|
r183 | |||
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 | ||
virtual void layoutChanged() = 0; // layout has changed -> need to recalculate bar sizes | ||||
Michal Klocek
|
r139 | protected slots: | ||
void handleModelChanged(int index); | ||||
void handleDomainChanged(const Domain& domain); | ||||
void handleGeometryChanged(const QRectF& size); | ||||
sauimone
|
r288 | // Internal slots | ||
void showToolTip(QPoint pos, QString tip); // shows tooltip (if enabled) | ||||
sauimone
|
r296 | void enableSeparators(bool enabled); | ||
sauimone
|
r280 | |||
sauimone
|
r126 | protected: | ||
sauimone
|
r159 | // TODO: consider these. | ||
sauimone
|
r126 | int mHeight; // Layout spesific | ||
int mWidth; | ||||
int mBarDefaultWidth; | ||||
bool mLayoutSet; // True, if component has been laid out. | ||||
bool mLayoutDirty; | ||||
sauimone
|
r288 | bool mSeparatorsEnabled; | ||
// Owned | ||||
sauimone
|
r338 | QBarSeries* mSeries; | ||
sauimone
|
r159 | |||
sauimone
|
r256 | // Not owned. | ||
QList<Bar*> mBars; | ||||
QList<BarLabel*> mLabels; | ||||
QList<Separator*> mSeparators; | ||||
sauimone
|
r263 | QList<BarValue*> mFloatingValues; | ||
sauimone
|
r288 | |||
sauimone
|
r126 | }; | ||
QTCOMMERCIALCHART_END_NAMESPACE | ||||
sauimone
|
r217 | #endif // BARPRESENTERBASE_H | ||