Medical Imaging Interaction Toolkit
2026.06.00
Medical Imaging Interaction Toolkit
QmitkCrossWidget.h
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
#ifndef QmitkCrossWidget_h
14
#define QmitkCrossWidget_h
15
16
#include <
MitkQtWidgetsExtExports.h
>
17
#include <QLabel>
18
19
#include <
mitkCommon.h
>
20
31
class
MITKQTWIDGETSEXT_EXPORT
QmitkCrossWidget
:
public
QLabel
32
{
33
Q_OBJECT
34
35
public
:
41
QmitkCrossWidget
(QWidget *parent =
nullptr
, Qt::WindowFlags f = {});
42
44
void
mousePressEvent
(QMouseEvent *mouseEvent)
override
;
45
47
void
mouseMoveEvent
(QMouseEvent *mouseEvent)
override
;
48
50
void
mouseReleaseEvent
(QMouseEvent *mouseEvent)
override
;
51
52
signals:
58
void
SignalDeltaMove
(
int
deltaX,
int
deltaY);
59
60
protected
:
61
// fix for bug 3378 - setPos() causes an app crash on macOS
62
#ifdef __APPLE__
63
void
ResetMousePosition(
int
,
int
){};
64
#else
65
void
ResetMousePosition
(
int
xpos,
int
ypos) { QCursor::setPos(xpos, ypos); };
66
#endif
67
68
int
lastX
, lastY;
69
};
70
71
#endif
MitkQtWidgetsExtExports.h
MITKQTWIDGETSEXT_EXPORT
#define MITKQTWIDGETSEXT_EXPORT
Definition:
MitkQtWidgetsExtExports.h:15
QmitkCrossWidget
A crosshair label widget that reports mouse drag deltas.
Definition:
QmitkCrossWidget.h:32
QmitkCrossWidget::SignalDeltaMove
void SignalDeltaMove(int deltaX, int deltaY)
Emitted during mouse drag with the delta movement.
QmitkCrossWidget::mouseReleaseEvent
void mouseReleaseEvent(QMouseEvent *mouseEvent) override
Handle mouse release (no-op).
QmitkCrossWidget::mousePressEvent
void mousePressEvent(QMouseEvent *mouseEvent) override
Handle mouse press: record initial position and emit zero delta.
QmitkCrossWidget::ResetMousePosition
void ResetMousePosition(int xpos, int ypos)
Definition:
QmitkCrossWidget.h:65
QmitkCrossWidget::mouseMoveEvent
void mouseMoveEvent(QMouseEvent *mouseEvent) override
Handle mouse move: compute delta from last position and emit it.
QmitkCrossWidget::lastX
int lastX
Definition:
QmitkCrossWidget.h:65
QmitkCrossWidget::QmitkCrossWidget
QmitkCrossWidget(QWidget *parent=nullptr, Qt::WindowFlags f={})
Construct the cross widget.
mitkCommon.h
src
MITK
Modules
QtWidgetsExt
include
QmitkCrossWidget.h
Generated by
1.9.1