Medical Imaging Interaction Toolkit  2016.11.0
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,
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 
30 {
31  QPoint p = QCursor::pos();
32 
33  lastX = p.x();
34  lastY = p.y();
35 
36  emit SignalDeltaMove(0, 0);
37 }
38 
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 
55 {
56 }
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