1 /* 2 SPDX-FileCopyrightText: 2012 Roney Gomes <roney477@gmail.com> 3 4 SPDX-License-Identifier: GPL-2.0-or-later 5 */ 6 7 #ifndef KGRVIEW_H 8 #define KGRVIEW_H 9 10 #include <QGraphicsView> 11 #include <QMouseEvent> 12 #include <QResizeEvent> 13 14 class KGrScene; 15 16 class KGrView : public QGraphicsView 17 { 18 Q_OBJECT 19 public: 20 explicit KGrView (QWidget * parent); 21 ~KGrView () override; 22 23 /* 24 * Get a pointer to the game scene. 25 */ gameScene()26 KGrScene * gameScene () const { return m_scene; } 27 28 Q_SIGNALS: 29 void mouseClick (int); 30 void mouseLetGo (int); 31 32 protected: 33 void resizeEvent (QResizeEvent *) override; 34 void mousePressEvent (QMouseEvent * mouseEvent) override; 35 void mouseDoubleClickEvent (QMouseEvent * mouseEvent) override; 36 void mouseReleaseEvent (QMouseEvent * mouseEvent) override; 37 38 private: 39 KGrScene * m_scene; 40 }; 41 42 #endif // KGRVIEW_H 43