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