File indexing completed on 2024-10-13 03:43:43
0001 /* 0002 SPDX-FileCopyrightText: 2012 Roney Gomes <roney477@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef KGRVIEW_H 0008 #define KGRVIEW_H 0009 0010 #include <QGraphicsView> 0011 #include <QMouseEvent> 0012 #include <QResizeEvent> 0013 0014 class KGrScene; 0015 0016 class KGrView : public QGraphicsView 0017 { 0018 Q_OBJECT 0019 public: 0020 explicit KGrView (QWidget * parent); 0021 ~KGrView () override; 0022 0023 /* 0024 * Get a pointer to the game scene. 0025 */ 0026 KGrScene * gameScene () const { return m_scene; } 0027 0028 Q_SIGNALS: 0029 void mouseClick (int); 0030 void mouseLetGo (int); 0031 0032 protected: 0033 void resizeEvent (QResizeEvent *) override; 0034 void mousePressEvent (QMouseEvent * mouseEvent) override; 0035 void mouseDoubleClickEvent (QMouseEvent * mouseEvent) override; 0036 void mouseReleaseEvent (QMouseEvent * mouseEvent) override; 0037 0038 private: 0039 KGrScene * m_scene; 0040 }; 0041 0042 #endif // KGRVIEW_H