Debian Codegraph @

tests/manual/chartviewer/view.cpp

raw
1 // Copyright (C) 2016 The Qt Company Ltd.
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4 #include "view.h"
5 #include <QtWidgets/QGraphicsWidget>
6 #include <QtGui/QResizeEvent>
7 #include <QtCore/QDebug>
8
9 View::View(QGraphicsScene *scene, QGraphicsWidget *form , QWidget *parent)
10 : QGraphicsView(scene, parent),
11 m_form(form)
12 {
13 setDragMode(QGraphicsView::NoDrag);
14 setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
15 setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
16 }
17
18 void View::resizeEvent(QResizeEvent *event)
19 {
20 if (scene())
21 scene()->setSceneRect(QRect(QPoint(0, 0), event->size()));
22 if (m_form)
23 m_form->resize(QSizeF(event->size()));
24 QGraphicsView::resizeEvent(event);
25 }
26
27 void View::mouseMoveEvent(QMouseEvent *event)
28 {
29 //BugFix somehow view always eats the mouse move event;
30 QGraphicsView::mouseMoveEvent(event);
31 event->setAccepted(false);
32 }
33
34 void View::mouseReleaseEvent(QMouseEvent *event)
35 {
36 QGraphicsView::mouseReleaseEvent(event);
37 //BugFix somehow view always eats the mouse release event;
38 event->setAccepted(false);
39 }