##// END OF EJS Templates
tuning theme colors
tuning theme colors

File last commit:

r119:9025093c4c9d
r125:d693628c68fb
Show More
stackedbargroup.h
69 lines | 1.8 KiB | text/x-c | CLexer
#ifndef STACKEDBARGROUP_H
#define STACKEDBARGROUP_H
#include "charttheme_p.h"
#include "chartitem_p.h"
#include "barlabel_p.h"
#include "bar_p.h"
#include "stackedbarchartseries.h"
#include <QGraphicsItem>
QTCOMMERCIALCHART_BEGIN_NAMESPACE
// TODO: derive this from ChartObjectInterface, when setSize is back in ChartItem
class StackedBarGroup : public ChartItem, public ChartThemeObserver
{
public:
StackedBarGroup(StackedBarChartSeries& series, QGraphicsItem *parent = 0);
// Bar chart spesific
void setSeparatorsVisible(bool visible = true);
public: // From ChartItem
void setSize(const QSizeF &size);
void setPlotDomain(const PlotDomain& data);
// From ChartThemeObserver
void themeChanged(ChartTheme *theme);
public: // Layout "api"
void setPos(qreal x, qreal y);
void setBarWidth( int w ); // Default width for each bar
int addColor( QColor color );
void resetColors();
// From QGraphicsItem
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
QRectF boundingRect() const;
private:
void dataChanged(); // data of series has changed -> need to recalculate bar sizes
void layoutChanged(); // layout has changed -> need to recalculate bar sizes
private:
// Data
StackedBarChartSeries& mSeries;
int mMin; // Min and max values of data. (updated when data is changed, used when drawing)
int mMax;
int mHeight; // Layout spesific
int mWidth;
int mBarDefaultWidth;
bool mLayoutSet; // True, if component has been laid out.
bool mLayoutDirty;
QList<QColor> mColors; // List of colors for series for now
ChartTheme* mTheme;
bool mSeparatorsVisible;
QList<qreal> mSeparatorPositions;
};
QTCOMMERCIALCHART_END_NAMESPACE
#endif // STACKEDBARGROUP_H