Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
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 (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #include "QmitkCrossWidget.h"
14 
15 #include <QCursor>
16 #include <QMouseEvent>
17 
18 QmitkCrossWidget::QmitkCrossWidget(QWidget *parent, Qt::WindowFlags f) : QLabel(parent, f)
19 {
20  setEnabled(true);
21  setVisible(true);
22  setFocusPolicy(Qt::ClickFocus);
23 }
24 
26 {
27  QPoint p = QCursor::pos();
28 
29  lastX = p.x();
30  lastY = p.y();
31 
32  emit SignalDeltaMove(0, 0);
33 }
34 
36 {
37  QPoint p = QCursor::pos();
38 
39  int newX = p.x();
40  int newY = p.y();
41 
42  int deltaX = newX - lastX;
43  int deltaY = newY - lastY;
44 
45  this->ResetMousePosition(lastX, lastY);
46 
47  emit SignalDeltaMove(deltaX, deltaY);
48 }
49 
51 {
52 }
void ResetMousePosition(int xpos, int ypos)
void mouseReleaseEvent(QMouseEvent *mouseEvent) override
void SignalDeltaMove(int, int)
QmitkCrossWidget(QWidget *parent=nullptr, Qt::WindowFlags f=nullptr)
void mousePressEvent(QMouseEvent *mouseEvent) override
void mouseMoveEvent(QMouseEvent *mouseEvent) override