File indexing completed on 2024-11-10 03:47:00

0001 /*
0002     SPDX-FileCopyrightText: 1999-2006 Éric Bischoff <ebischoff@nerim.net>
0003     SPDX-FileCopyrightText: 2007 Albert Astals Cid <aacid@kde.org>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 /* Object to draw on the game board */
0009 
0010 #ifndef _TODRAW_H_
0011 #define _TODRAW_H_
0012 
0013 #include <QGraphicsSvgItem>
0014 
0015 class ToDraw : public QGraphicsSvgItem
0016 {
0017   public:
0018     ToDraw();
0019     
0020     void save(QDataStream &stream) const;
0021     bool load(QDataStream &stream);
0022 
0023     bool contains(const QPointF &point) const override;
0024 
0025     enum { Type = UserType + 1 };
0026     int type() const override;
0027 
0028     QRectF boundingRect() const override;
0029     QRectF unclippedRect() const;
0030 
0031     void setBeingDragged(bool dragged);
0032 
0033   protected:
0034     QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
0035   
0036   private:
0037     QRectF clippedRectAt(const QPointF &somePos) const;
0038 
0039     bool m_beingDragged;
0040 };
0041 
0042 #endif