Aeon Engine c550894
AeonGames Open Source Game Engine
Loading...
Searching...
No Matches
NodeView.cpp
1/*
2Copyright (C) 2021,2022 Rodrigo Jose Hernandez Cordoba
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15*/
16
17#include <cmath>
18#include <QKeyEvent>
19#include <QPainter>
20#include <iostream>
21#include "NodeView.h"
22#include "NodeWindow.h"
23#include "WorldEditor.h"
24
25namespace AeonGames
26{
27 NodeView::NodeView ( QWidget *parent ) : QWidget ( parent )
28 {
29 //setMinimumSize ( QSize ( 400, 400 ) );
30 NodeWindow* nw = new NodeWindow ( this );
31 nw->show();
32 }
33 NodeView::~NodeView() = default;
34
35 void NodeView::paintEvent ( QPaintEvent *event )
36 {
37 QPainter painter ( this );
38 for ( auto &i : event->region() )
39 {
40 painter.fillRect ( i, Qt::gray );
41 }
42 }
43
44 void NodeView::keyPressEvent ( QKeyEvent *event )
45 {
46 switch ( event->key() )
47 {
48 case Qt::Key_Plus:
49 break;
50 case Qt::Key_Minus:
51 break;
52 default:
53 QWidget::keyPressEvent ( event );
54 }
55 }
56
57 void NodeView::mousePressEvent ( QMouseEvent *event )
58 {
59 if ( event->button() == Qt::LeftButton )
60 {
61 event->accept();
62 }
63 else
64 {
65 QWidget::mousePressEvent ( event );
66 }
67 }
68
69 void NodeView::mouseMoveEvent ( QMouseEvent *event )
70 {
71 QWidget::mouseMoveEvent ( event );
72 }
73
74 void NodeView::mouseReleaseEvent ( QMouseEvent *event )
75 {
76 QWidget::mouseReleaseEvent ( event );
77 }
78
79#if QT_CONFIG(wheelevent)
80 void NodeView::wheelEvent ( QWheelEvent *event )
81 {
82 QWidget::wheelEvent ( event );
83 }
84#endif
85}
void mouseReleaseEvent(QMouseEvent *event) override
Handle mouse release events.
Definition NodeView.cpp:74
NodeView(QWidget *parent=nullptr)
Construct the node view widget.
Definition NodeView.cpp:27
~NodeView()
Destructor.
void keyPressEvent(QKeyEvent *event) override
Handle key press events.
Definition NodeView.cpp:44
void mousePressEvent(QMouseEvent *event) override
Handle mouse press events.
Definition NodeView.cpp:57
void paintEvent(QPaintEvent *event) override
Handle paint events.
Definition NodeView.cpp:35
void mouseMoveEvent(QMouseEvent *event) override
Handle mouse move events.
Definition NodeView.cpp:69
Widget for displaying and editing node properties.
Definition NodeWindow.h:25
<- This is here just for the literals
Definition AABB.hpp:31