summaryrefslogtreecommitdiffstats
path: root/graphbarwidget.h
blob: af7c8bab2da9e9a165fd8fb1d489efbdce7f13d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
  This program is free software; you can redistribute it and/or
  modify it under the terms of the GNU General Public License
  as published by the Free Software Foundation; either version
  2 of the License, or (at your option) any later version.
*/

#ifndef GRAPHBARWIDGET_H
#define GRAPHBARWIDGET_H

#include <QWidget>
#include <QVariant>
#include <QSize>

class QPaintEvent;

class GraphBarWidget : public QWidget {
	Q_OBJECT
	Q_PROPERTY(int maxValue READ maxValue);
	Q_PROPERTY(QSize maxDescr READ maxDescr);
	Q_PROPERTY(QSize maxCount READ maxCount);
	Q_PROPERTY(QString caption READ caption WRITE setCaption);
	public:
		GraphBarWidget(const QList<QList<QVariant> > data, QWidget *parent = 0);
		~GraphBarWidget() {}
		QString caption() const { return mCaption; }
		void setCaption(const QString &caption) { mCaption = caption; }
		int maxValue() const;
		QSize maxDescr() const;
		QSize maxCount() const;
		virtual QSize sizeHint() const;

	protected:
		void paintEvent(QPaintEvent *);

	private:
		int mBarHeight;
		int mMargin;
		QString mCaption;
		QList<QList<QVariant> > mData;
		QList<QSize> mSizes;

};

#endif