2018-10-29 00:11:23 +01:00
|
|
|
#ifndef TEXT_H
|
|
|
|
#define TEXT_H
|
|
|
|
|
2018-11-11 14:10:38 +01:00
|
|
|
#include "textitem.h"
|
2018-10-29 00:11:23 +01:00
|
|
|
|
2018-11-11 14:10:38 +01:00
|
|
|
class Text
|
2018-10-29 00:11:23 +01:00
|
|
|
{
|
|
|
|
public:
|
2018-11-11 14:10:38 +01:00
|
|
|
Text(int size) : _sceneRect(QRectF(0, 0, size, size)) {}
|
|
|
|
~Text();
|
|
|
|
|
|
|
|
void render(QPainter *painter);
|
2018-10-29 00:11:23 +01:00
|
|
|
|
|
|
|
void addLabel(const QString &text, const QPointF &pos, const QFont &font,
|
|
|
|
const QPen &pen, qreal maxTextWidth);
|
|
|
|
void addLabel(const QString &text, const QPainterPath &path,
|
2018-11-04 23:54:34 +01:00
|
|
|
const QFont &font, const QPen &pen, qreal maxAngle);
|
2018-11-11 14:10:38 +01:00
|
|
|
|
|
|
|
private:
|
|
|
|
void addItem(TextItem *item) {_items.append(item);}
|
|
|
|
QList<TextItem *> collidingItems(const TextItem *item) const;
|
|
|
|
|
|
|
|
QRectF _sceneRect;
|
|
|
|
QList<TextItem *> _items;
|
2018-10-29 00:11:23 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // TEXT_H
|