aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/profile/divetextitem.h
blob: 3991fe7f360acfac72ee673ec21b6b39786e2ceb (plain) (blame)
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
#ifndef DIVETEXTITEM_H
#define DIVETEXTITEM_H

#include <QObject>
#include <QGraphicsItemGroup>
#include "graphicsview-common.h"
#include <QBrush>

/* A Line Item that has animated-properties. */
class DiveTextItem : public QObject, public QGraphicsItemGroup {
	Q_OBJECT
	Q_PROPERTY(QPointF pos READ pos WRITE setPos)
	Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity)
public:
	DiveTextItem(QGraphicsItem *parent = 0);
	void setText(const QString &text);
	void setAlignment(int alignFlags);
	void setScale(double newscale);
	void setBrush(const QBrush &brush);
	const QString &text();
	void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);

private
slots:
	void fontPrintScaleUpdate(double scale);

private:
	void updateText();
	int internalAlignFlags;
	QGraphicsPathItem *textBackgroundItem;
	QGraphicsPathItem *textItem;
	QString internalText;
	double printScale;
	double scale;
	bool connected;
};

#endif // DIVETEXTITEM_H