File: kgrview.cpp

package info (click to toggle)
kgoldrunner 4%3A25.12.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 40,292 kB
  • sloc: cpp: 8,947; xml: 516; sh: 54; makefile: 8
file content (49 lines) | stat: -rw-r--r-- 964 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/*
    SPDX-FileCopyrightText: 2012 Roney Gomes <roney477@gmail.com>

    SPDX-License-Identifier: GPL-2.0-or-later
*/

#include "kgrview.h"
#include "kgrscene.h"
#include "kgrglobals.h"
#include "kgrrenderer.h"

#include "kgoldrunner_debug.h"

KGrView::KGrView    (QWidget * parent)
    :
    QGraphicsView   (parent),
    m_scene         (new KGrScene   (this))
{
    setScene        (m_scene);
}

KGrView::~KGrView ()
{
}

void KGrView::resizeEvent (QResizeEvent *)
{
    if (scene() != nullptr) {
        m_scene->changeSize ();
        fitInView (scene()->sceneRect(), Qt::KeepAspectRatio);
    }
}

void KGrView::mousePressEvent (QMouseEvent * mouseEvent)
{
    Q_EMIT mouseClick (mouseEvent->button());
}

void KGrView::mouseDoubleClickEvent (QMouseEvent * mouseEvent)
{
    Q_EMIT mouseClick (mouseEvent->button());
}

void KGrView::mouseReleaseEvent (QMouseEvent * mouseEvent)
{
    Q_EMIT mouseLetGo (mouseEvent->button());
}

#include "moc_kgrview.cpp"