Medical Imaging Interaction Toolkit
2016.11.0
Medical Imaging Interaction Toolkit
Home
Manual
API Reference
Download
Bugzilla
Groups
Namespace List
Class List
File List
Examples
File List
File Members
QmitkCrossWidget.cpp
Go to the documentation of this file.
1
/*===================================================================
2
3
The Medical Imaging Interaction Toolkit (MITK)
4
5
Copyright (c) German Cancer Research Center,
6
Division of Medical and Biological Informatics.
7
All rights reserved.
8
9
This software is distributed WITHOUT ANY WARRANTY; without
10
even the implied warranty of MERCHANTABILITY or FITNESS FOR
11
A PARTICULAR PURPOSE.
12
13
See LICENSE.txt or http://www.mitk.org for details.
14
15
===================================================================*/
16
17
#include "
QmitkCrossWidget.h
"
18
19
#include <QCursor>
20
#include <QMouseEvent>
21
22
QmitkCrossWidget::QmitkCrossWidget
(QWidget *parent, Qt::WindowFlags f) : QLabel(parent, f)
23
{
24
setEnabled(
true
);
25
setVisible(
true
);
26
setFocusPolicy(Qt::ClickFocus);
27
}
28
29
void
QmitkCrossWidget::mousePressEvent
(QMouseEvent *)
30
{
31
QPoint p = QCursor::pos();
32
33
lastX
= p.x();
34
lastY
= p.y();
35
36
emit
SignalDeltaMove
(0, 0);
37
}
38
39
void
QmitkCrossWidget::mouseMoveEvent
(QMouseEvent *)
40
{
41
QPoint p = QCursor::pos();
42
43
int
newX = p.x();
44
int
newY = p.y();
45
46
int
deltaX = newX -
lastX
;
47
int
deltaY = newY -
lastY
;
48
49
this->
ResetMousePosition
(lastX, lastY);
50
51
emit
SignalDeltaMove
(deltaX, deltaY);
52
}
53
54
void
QmitkCrossWidget::mouseReleaseEvent
(QMouseEvent *)
55
{
56
}
QmitkCrossWidget::lastX
int lastX
Definition:
QmitkCrossWidget.h:45
QmitkCrossWidget::ResetMousePosition
void ResetMousePosition(int xpos, int ypos)
Definition:
QmitkCrossWidget.h:45
QmitkCrossWidget::mouseReleaseEvent
void mouseReleaseEvent(QMouseEvent *mouseEvent) override
Definition:
QmitkCrossWidget.cpp:54
QmitkCrossWidget.h
QmitkCrossWidget::SignalDeltaMove
void SignalDeltaMove(int, int)
QmitkCrossWidget::QmitkCrossWidget
QmitkCrossWidget(QWidget *parent=nullptr, Qt::WindowFlags f=nullptr)
Definition:
QmitkCrossWidget.cpp:22
QmitkCrossWidget::mousePressEvent
void mousePressEvent(QMouseEvent *mouseEvent) override
Definition:
QmitkCrossWidget.cpp:29
QmitkCrossWidget::lastY
int lastY
Definition:
QmitkCrossWidget.h:45
QmitkCrossWidget::mouseMoveEvent
void mouseMoveEvent(QMouseEvent *mouseEvent) override
Definition:
QmitkCrossWidget.cpp:39
git
MITK
Modules
QtWidgetsExt
src
QmitkCrossWidget.cpp
Generated on Fri Feb 3 2017 20:52:12 for Medical Imaging Interaction Toolkit by
1.8.9.1