2015-10-12 01:12:12 +02:00
|
|
|
#ifndef INFOITEM_H
|
|
|
|
#define INFOITEM_H
|
|
|
|
|
|
|
|
#include <QGraphicsItem>
|
2015-10-13 00:27:49 +02:00
|
|
|
#include <QList>
|
2018-09-30 12:16:41 +02:00
|
|
|
#include "common/kv.h"
|
2015-10-12 01:12:12 +02:00
|
|
|
|
|
|
|
class InfoItem : public QGraphicsItem
|
|
|
|
{
|
|
|
|
public:
|
2015-10-17 01:33:02 +02:00
|
|
|
InfoItem(QGraphicsItem *parent = 0);
|
2015-10-12 01:12:12 +02:00
|
|
|
|
2016-02-02 20:12:56 +01:00
|
|
|
QRectF boundingRect() const {return _boundingRect;}
|
2015-10-12 01:12:12 +02:00
|
|
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
|
|
|
QWidget *widget);
|
|
|
|
|
2019-08-01 08:36:58 +02:00
|
|
|
const QList<KV<QString, QString> > &info() const {return _list;}
|
2018-07-21 16:13:18 +02:00
|
|
|
|
2015-10-12 01:12:12 +02:00
|
|
|
void insert(const QString &key, const QString &value);
|
2016-02-02 20:12:56 +01:00
|
|
|
void clear();
|
2016-05-21 16:10:24 +02:00
|
|
|
bool isEmpty() {return _list.isEmpty();}
|
2015-10-12 01:12:12 +02:00
|
|
|
|
|
|
|
private:
|
2016-02-02 20:12:56 +01:00
|
|
|
void updateBoundingRect();
|
2021-08-04 08:57:42 +02:00
|
|
|
int indexOf(const QString &key) const;
|
2016-02-02 20:12:56 +01:00
|
|
|
|
2019-08-01 08:36:58 +02:00
|
|
|
QList<KV<QString, QString> > _list;
|
2016-02-02 20:12:56 +01:00
|
|
|
QRectF _boundingRect;
|
2018-05-18 01:38:33 +02:00
|
|
|
QFont _font;
|
2015-10-12 01:12:12 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // INFOITEM_H
|