2014-01-14 17:23:57 +00:00
|
|
|
#ifndef DIVETEXTITEM_H
|
|
|
|
#define DIVETEXTITEM_H
|
|
|
|
|
|
|
|
#include <QObject>
|
2014-01-19 18:16:04 +00:00
|
|
|
#include <QGraphicsItemGroup>
|
|
|
|
#include "graphicsview-common.h"
|
|
|
|
#include <QBrush>
|
2014-01-14 17:23:57 +00:00
|
|
|
|
|
|
|
/* A Line Item that has animated-properties. */
|
2014-01-19 18:16:04 +00:00
|
|
|
class DiveTextItem :public QObject, public QGraphicsItemGroup{
|
2014-01-14 17:23:57 +00:00
|
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(QPointF pos READ pos WRITE setPos)
|
|
|
|
Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity)
|
|
|
|
public:
|
|
|
|
DiveTextItem(QGraphicsItem* parent = 0);
|
2014-01-19 18:16:04 +00:00
|
|
|
void setText(const QString& text);
|
2014-01-14 17:23:57 +00:00
|
|
|
void setAlignment(int alignFlags);
|
2014-01-19 18:16:04 +00:00
|
|
|
void setBrush(const QBrush& brush);
|
2014-01-14 17:23:57 +00:00
|
|
|
void animatedHide();
|
|
|
|
void animateMoveTo(qreal x, qreal y);
|
2014-01-21 12:48:26 +00:00
|
|
|
const QString& text();
|
2014-01-14 17:23:57 +00:00
|
|
|
private:
|
2014-01-19 18:16:04 +00:00
|
|
|
void updateText();
|
2014-01-14 17:23:57 +00:00
|
|
|
int internalAlignFlags;
|
2014-01-19 18:16:04 +00:00
|
|
|
QGraphicsPathItem *textBackgroundItem;
|
|
|
|
QGraphicsPathItem *textItem;
|
2014-01-21 12:48:26 +00:00
|
|
|
QString internalText;
|
2014-01-19 18:16:04 +00:00
|
|
|
color_indice_t colorIndex;
|
|
|
|
QBrush brush;
|
2014-01-14 17:23:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|