LiveFit
Track and plot projectiles for in-class demonstration
ProjectorDragCorner.hpp
1 /*
2  * LiveFit
3  * Copyright (C) 2016 The University of Georgia
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef PROJECTORDRAGCORNER_HPP
21 #define PROJECTORDRAGCORNER_HPP
22 
23 #include <QWidget>
24 
29 class ProjectorDragCorner : public QWidget
30 {
31  Q_OBJECT
32 
35 public:
37  explicit ProjectorDragCorner(QWidget *parent = 0);
38 
39 signals:
41  void moveCompleted(QPoint loc);
42 
43 public slots:
44 
45 protected:
47  void paintEvent(QPaintEvent* event);
48 
50  void mousePressEvent(QMouseEvent* event);
52  void mouseMoveEvent(QMouseEvent* event);
54  void mouseReleaseEvent(QMouseEvent* event);
55 private:
56 
58  QPoint dragStartPos;
60  bool selected = false;
62  bool dragging = false;
64  int radius;
65 };
66 
67 #endif // PROJECTORDRAGCORNER_HPP
void moveCompleted(QPoint loc)
Sent when a "move" action of this drag corner is finished.
void mouseReleaseEvent(QMouseEvent *event)
Called when a mouse release happens; consider drop after drag.
Definition: ProjectorDragCorner.cpp:83
QPoint dragStartPos
Where this drag was initiated.
Definition: ProjectorDragCorner.hpp:58
A draggable widget for managing where the projector corners lie in the video frame.
Definition: ProjectorDragCorner.hpp:29
int cornerIndex
The (extrinsic) index of this corner in [UL,BL,BR,UL].
Definition: ProjectorDragCorner.hpp:34
void paintEvent(QPaintEvent *event)
Paint this drag corner.
Definition: ProjectorDragCorner.cpp:35
void mousePressEvent(QMouseEvent *event)
Called when a mouse press happens; "select" and consider drag.
Definition: ProjectorDragCorner.cpp:56
ProjectorDragCorner(QWidget *parent=0)
Default constructor.
Definition: ProjectorDragCorner.cpp:26
bool dragging
Whether this corner is being dragged.
Definition: ProjectorDragCorner.hpp:62
void mouseMoveEvent(QMouseEvent *event)
Called when a mouse move happens; consider drag if selected and moved.
Definition: ProjectorDragCorner.cpp:71
bool selected
Whether this corner is selected.
Definition: ProjectorDragCorner.hpp:60
int radius
Display/click radius of this widget.
Definition: ProjectorDragCorner.hpp:64