mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-02 03:23:56 -07:00
Arrows
This commit is contained in:
parent
fd4b388975
commit
867a27ecd4
14 changed files with 249 additions and 36 deletions
33
cockatrice/src/arrowitem.h
Normal file
33
cockatrice/src/arrowitem.h
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#ifndef ARROWITEM_H
|
||||
#define ARROWITEM_H
|
||||
|
||||
#include <QGraphicsItem>
|
||||
|
||||
class CardItem;
|
||||
class QGraphicsSceneMouseEvent;
|
||||
|
||||
class ArrowItem : public QObject, public QGraphicsItem {
|
||||
Q_OBJECT
|
||||
private:
|
||||
QPainterPath path;
|
||||
protected:
|
||||
QColor color;
|
||||
CardItem *startItem, *targetItem;
|
||||
public:
|
||||
ArrowItem(CardItem *_startItem = 0, CardItem *_targetItem = 0);
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
|
||||
QRectF boundingRect() const { return path.boundingRect(); }
|
||||
void updatePath();
|
||||
void updatePath(const QPointF &endPoint);
|
||||
};
|
||||
|
||||
class ArrowDragItem : public ArrowItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ArrowDragItem(CardItem *_startItem);
|
||||
protected:
|
||||
void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
|
||||
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
|
||||
};
|
||||
|
||||
#endif // ARROWITEM_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue