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 #include "kgrview.h" 0008 #include "kgrscene.h" 0009 #include "kgrglobals.h" 0010 #include "kgrrenderer.h" 0011 0012 #include "kgoldrunner_debug.h" 0013 0014 KGrView::KGrView (QWidget * parent) 0015 : 0016 QGraphicsView (parent), 0017 m_scene (new KGrScene (this)) 0018 { 0019 setScene (m_scene); 0020 } 0021 0022 KGrView::~KGrView () 0023 { 0024 } 0025 0026 void KGrView::resizeEvent (QResizeEvent *) 0027 { 0028 if (scene() != nullptr) { 0029 m_scene->changeSize (); 0030 fitInView (scene()->sceneRect(), Qt::KeepAspectRatio); 0031 } 0032 } 0033 0034 void KGrView::mousePressEvent (QMouseEvent * mouseEvent) 0035 { 0036 Q_EMIT mouseClick (mouseEvent->button()); 0037 } 0038 0039 void KGrView::mouseDoubleClickEvent (QMouseEvent * mouseEvent) 0040 { 0041 Q_EMIT mouseClick (mouseEvent->button()); 0042 } 0043 0044 void KGrView::mouseReleaseEvent (QMouseEvent * mouseEvent) 0045 { 0046 Q_EMIT mouseLetGo (mouseEvent->button()); 0047 } 0048 0049 #include "moc_kgrview.cpp"