mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
72b5bbce6e
Removed the plotText function and replaced it with the DiveTextItem class - this way there's just one way to add text on screen, and it also makes it easy to fix positioning of stuff there. Which is what I'll try to fix on the next commit. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
31 lines
786 B
C++
31 lines
786 B
C++
#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 setBrush(const QBrush& brush);
|
|
void animatedHide();
|
|
void animateMoveTo(qreal x, qreal y);
|
|
private:
|
|
void updateText();
|
|
int internalAlignFlags;
|
|
QGraphicsPathItem *textBackgroundItem;
|
|
QGraphicsPathItem *textItem;
|
|
QString text;
|
|
color_indice_t colorIndex;
|
|
QBrush brush;
|
|
};
|
|
|
|
#endif
|