File indexing completed on 2025-03-16 06:57:22
0001 /******************************************************************* 0002 * 0003 * This file is part of the KDE project "Bovo" 0004 * 0005 * Bovo is free software; you can redistribute it and/or modify 0006 * it under the terms of the GNU General Public License as published by 0007 * the Free Software Foundation; either version 2, or (at your option) 0008 * any later version. 0009 * 0010 * Bovo is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 * GNU General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU General Public License 0016 * along with Bovo; see the file COPYING. If not, write to 0017 * the Free Software Foundation, 51 Franklin Street, Fifth Floor, 0018 * Boston, MA 02110-1301, USA. 0019 * 0020 ********************************************************************/ 0021 0022 #ifndef BOVO_HINTITEM_H 0023 #define BOVO_HINTITEM_H 0024 0025 #include <QGraphicsSvgItem> 0026 0027 class QTimer; 0028 0029 namespace bovo 0030 { 0031 class Move; 0032 } 0033 0034 using namespace bovo; 0035 0036 namespace gui 0037 { 0038 0039 class Scene; 0040 0041 class HintItem : public QGraphicsSvgItem 0042 { 0043 Q_OBJECT 0044 public: 0045 HintItem(Scene *scene, const Move &move, bool animate = true, qreal fill = 0.75); 0046 ~HintItem() override; 0047 void killAnimation(); 0048 void kill(); 0049 void setFill(qreal fill); 0050 QRectF boundingRect() const override; 0051 0052 public Q_SLOTS: 0053 void tick(); 0054 void killTick(); 0055 0056 Q_SIGNALS: 0057 void killed(); 0058 0059 protected: 0060 void paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *widget = nullptr) override; 0061 0062 private: 0063 Scene *m_scene; 0064 int m_row; 0065 int m_col; 0066 int m_tick; 0067 bool m_animate; 0068 qreal m_opacity; 0069 bool m_tickUp; 0070 qreal m_fill; 0071 QTimer *m_ticker; 0072 }; 0073 0074 } /* namespace gui */ 0075 0076 #endif // BOVO_HINTITEM_H