2017-04-27 20:26:36 +02:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2014-01-14 15:23:57 -02:00
|
|
|
#ifndef DIVETEXTITEM_H
|
|
|
|
#define DIVETEXTITEM_H
|
|
|
|
|
|
|
|
#include <QObject>
|
2014-01-19 16:16:04 -02:00
|
|
|
#include <QGraphicsItemGroup>
|
2015-09-03 14:20:19 -03:00
|
|
|
|
|
|
|
class QBrush;
|
2014-01-14 15:23:57 -02:00
|
|
|
|
|
|
|
/* A Line Item that has animated-properties. */
|
2014-02-27 20:09:57 -08:00
|
|
|
class DiveTextItem : public QObject, public QGraphicsItemGroup {
|
2014-01-14 15:23:57 -02:00
|
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(QPointF pos READ pos WRITE setPos)
|
|
|
|
Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity)
|
|
|
|
public:
|
2014-02-27 20:09:57 -08:00
|
|
|
DiveTextItem(QGraphicsItem *parent = 0);
|
|
|
|
void setText(const QString &text);
|
2014-01-14 15:23:57 -02:00
|
|
|
void setAlignment(int alignFlags);
|
2014-02-15 07:03:41 -08:00
|
|
|
void setScale(double newscale);
|
2014-02-27 20:09:57 -08:00
|
|
|
void setBrush(const QBrush &brush);
|
|
|
|
const QString &text();
|
2015-07-29 10:57:05 -07:00
|
|
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
2014-02-27 20:09:57 -08:00
|
|
|
|
2015-07-29 12:21:27 -07:00
|
|
|
private
|
|
|
|
slots:
|
|
|
|
void fontPrintScaleUpdate(double scale);
|
|
|
|
|
2014-01-14 15:23:57 -02:00
|
|
|
private:
|
2014-01-19 16:16:04 -02:00
|
|
|
void updateText();
|
2014-01-14 15:23:57 -02:00
|
|
|
int internalAlignFlags;
|
2014-01-19 16:16:04 -02:00
|
|
|
QGraphicsPathItem *textBackgroundItem;
|
|
|
|
QGraphicsPathItem *textItem;
|
2014-01-21 10:48:26 -02:00
|
|
|
QString internalText;
|
2015-07-29 12:21:27 -07:00
|
|
|
double printScale;
|
2014-02-15 07:03:41 -08:00
|
|
|
double scale;
|
2015-07-29 12:21:27 -07:00
|
|
|
bool connected;
|
2014-01-14 15:23:57 -02:00
|
|
|
};
|
|
|
|
|
2014-02-11 19:14:46 +01:00
|
|
|
#endif // DIVETEXTITEM_H
|