• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegames API Reference
  • KDE Home
  • Contact Us
 

kgoldrunner

  • sources
  • kde-4.14
  • kdegames
  • kgoldrunner
  • src
kgrview.cpp
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright 2012 Roney Gomes <roney477@gmail.com> *
3  * *
4  * This program is free software; you can redistribute it and/or *
5  * modify it under the terms of the GNU General Public License as *
6  * published by the Free Software Foundation; either version 2 of *
7  * the License, or (at your option) any later version. *
8  * *
9  * This program is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU General Public License *
15  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
16  ****************************************************************************/
17 
18 #include "kgrview.h"
19 #include "kgrscene.h"
20 #include "kgrglobals.h"
21 #include "kgrrenderer.h"
22 
23 #include <QDebug>
24 
25 KGrView::KGrView (QWidget * parent)
26  :
27  QGraphicsView (parent),
28  m_scene (new KGrScene (this))
29 {
30  setScene (m_scene);
31 }
32 
33 KGrView::~KGrView ()
34 {
35 }
36 
37 void KGrView::resizeEvent (QResizeEvent *)
38 {
39  if (scene() != 0) {
40  m_scene->changeSize ();
41  fitInView (scene()->sceneRect(), Qt::KeepAspectRatio);
42  }
43 }
44 
45 void KGrView::mousePressEvent (QMouseEvent * mouseEvent)
46 {
47  emit mouseClick (mouseEvent->button());
48 }
49 
50 void KGrView::mouseDoubleClickEvent (QMouseEvent * mouseEvent)
51 {
52  emit mouseClick (mouseEvent->button());
53 }
54 
55 void KGrView::mouseReleaseEvent (QMouseEvent * mouseEvent)
56 {
57  emit mouseLetGo (mouseEvent->button());
58 }
59 
60 #include "kgrview.moc"
KGrView::mouseLetGo
void mouseLetGo(int)
QResizeEvent
QWidget
kgrrenderer.h
QGraphicsView::sceneRect
QRectF sceneRect() const
QMouseEvent
QGraphicsView::scene
QGraphicsScene * scene() const
KGrView::mouseDoubleClickEvent
virtual void mouseDoubleClickEvent(QMouseEvent *mouseEvent)
Definition: kgrview.cpp:50
KGrView::mousePressEvent
virtual void mousePressEvent(QMouseEvent *mouseEvent)
Definition: kgrview.cpp:45
KGrView::KGrView
KGrView(QWidget *parent)
Definition: kgrview.cpp:25
QMouseEvent::button
Qt::MouseButton button() const
KGrView::~KGrView
~KGrView()
Definition: kgrview.cpp:33
QGraphicsView::setScene
void setScene(QGraphicsScene *scene)
KGrScene::changeSize
void changeSize()
Redraw the scene whenever the view widget is resized.
Definition: kgrscene.cpp:221
kgrscene.h
kgrview.h
KGrView::mouseReleaseEvent
virtual void mouseReleaseEvent(QMouseEvent *mouseEvent)
Definition: kgrview.cpp:55
kgrglobals.h
KGrView::mouseClick
void mouseClick(int)
KGrView::resizeEvent
virtual void resizeEvent(QResizeEvent *)
Definition: kgrview.cpp:37
KGrScene
The QGraphicsScene that represents KGoldrunner on the screen.
Definition: kgrscene.h:75
QGraphicsView
QGraphicsView::fitInView
void fitInView(const QRectF &rect, Qt::AspectRatioMode aspectRatioMode)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:24 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kgoldrunner

Skip menu "kgoldrunner"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdegames API Reference

Skip menu "kdegames API Reference"
  • granatier
  • kapman
  • kblackbox
  • kgoldrunner
  • kigo
  • kmahjongg
  • KShisen
  • ksquares
  • libkdegames
  •   highscore
  •   libkdegamesprivate
  •     kgame
  • libkmahjongg
  • palapeli
  •   libpala

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal