2019-05-24 18:37:15 +02:00
|
|
|
#ifndef PATHTICKITEM_H
|
|
|
|
#define PATHTICKITEM_H
|
|
|
|
|
|
|
|
#include <QFont>
|
|
|
|
#include <QGraphicsItem>
|
2019-10-15 23:59:15 +02:00
|
|
|
#include "graphicsscene.h"
|
2019-05-24 18:37:15 +02:00
|
|
|
|
2019-10-15 23:59:15 +02:00
|
|
|
class PathTickItem : public GraphicsItem
|
2019-05-24 18:37:15 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
PathTickItem(const QRectF &tickRect, int value, QGraphicsItem *parent = 0);
|
|
|
|
|
|
|
|
QRectF boundingRect() const;
|
|
|
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
|
|
|
QWidget *widget);
|
|
|
|
|
2019-05-28 07:24:39 +02:00
|
|
|
void setPos(const QPointF &pos);
|
2019-05-24 18:37:15 +02:00
|
|
|
void setColor(const QColor &color) {_brush = QBrush(color);}
|
|
|
|
|
2019-10-15 23:59:15 +02:00
|
|
|
int type() const {return parentItem()->type();}
|
|
|
|
QString info() const {return static_cast<GraphicsItem*>(parentItem())->info();}
|
|
|
|
|
2019-05-28 07:24:39 +02:00
|
|
|
static QRect tickRect(int value);
|
2019-05-24 18:37:15 +02:00
|
|
|
|
2019-10-13 20:20:32 +02:00
|
|
|
protected:
|
|
|
|
void mousePressEvent(QGraphicsSceneMouseEvent *event);
|
|
|
|
|
2019-05-24 18:37:15 +02:00
|
|
|
private:
|
|
|
|
QRectF _tickRect;
|
|
|
|
QString _text;
|
|
|
|
QBrush _brush;
|
|
|
|
|
|
|
|
static QFont _font;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // PATHTICKITEM_H
|