File indexing completed on 2024-12-15 03:48:50
0001 /* 0002 This file is part of Knights, a chess board for KDE SC 4. 0003 SPDX-FileCopyrightText: 2009, 2010, 2011 Miha Čančula <miha@noughmad.eu> 0004 0005 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0006 */ 0007 0008 #ifndef KNIGHTS_ITEM_H 0009 #define KNIGHTS_ITEM_H 0010 0011 #include "pos.h" 0012 0013 #include <KGameRenderedGraphicsObject> 0014 0015 namespace Knights { 0016 0017 class Item : public KGameRenderedGraphicsObject { 0018 Q_OBJECT 0019 Q_PROPERTY ( Pos boardPos READ boardPos WRITE setBoardPos ) 0020 Q_PROPERTY ( QSize renderSize READ renderSize WRITE setRenderSize ) 0021 0022 public: 0023 Item ( KGameGraphicsViewRenderer* renderer, const QString& key, QGraphicsScene* scene, Pos boardPos, QGraphicsItem* parentItem = nullptr ); 0024 ~Item() override; 0025 0026 void setBoardPos ( const Pos& pos ); 0027 Pos boardPos() const; 0028 0029 void move ( const QPointF& pos, qreal tileSize, bool animated = true ); 0030 void resize ( const QSize& size, bool animated = true ); 0031 void moveAndResize ( const QPointF& pos, qreal tileSize, const QSize& size, bool animated = true ); 0032 0033 private: 0034 Pos m_pos; 0035 }; 0036 } 0037 #endif // KNIGHTS_ITEM_H