Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
QmitkTextOverlay.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 QmitkTextOverlay_h
14 #define QmitkTextOverlay_h
15 
16 // MITK
17 #include <QmitkOverlay.h>
18 #include <mitkCommon.h>
19 #include <mitkPropertyList.h>
20 
21 // Qt
22 #include <QLabel>
23 
24 #include <MitkQtOverlaysExports.h>
25 
62 {
63 public:
68  QmitkTextOverlay(const char *id);
69 
71  ~QmitkTextOverlay() override;
72 
82  void GenerateData(mitk::PropertyList::Pointer pl) override;
83 
88  QSize GetNeededSize() override;
89 
90 protected:
99  void UpdateFontProperties(mitk::PropertyList::Pointer pl);
100 
105  void SetupCallback(mitk::BaseProperty::Pointer prop);
106 
114 
116  QLabel *m_Label;
117 
119  mitk::PropertyList::Pointer m_PropertyList;
120 
122  mitk::BaseProperty::Pointer m_ObservedProperty;
123 
125  unsigned long m_ObserverTag;
126 };
127 
128 #endif
#define MITKQTOVERLAYS_EXPORT
Abstract base class for all Qt-based overlay widgets in MITK.
Definition: QmitkOverlay.h:55
Overlay that displays a text string in a render window.
~QmitkTextOverlay() override
Destructor. Removes the property observer.
void UpdateFontProperties(mitk::PropertyList::Pointer pl)
Applies font-related properties from the PropertyList to the QLabel.
void SetupCallback(mitk::BaseProperty::Pointer prop)
Sets up an ITK observer on the given property to auto-update the text.
QSize GetNeededSize() override
Returns the minimum size needed to display the current text.
void UpdateDisplayedTextFromProperties()
Reads the current text from the property and updates the QLabel.
mitk::PropertyList::Pointer m_PropertyList
Cached PropertyList for property lookups.
void GenerateData(mitk::PropertyList::Pointer pl) override
Configures the text overlay from the given PropertyList.
QLabel * m_Label
QLabel internally representing the text overlay.
QmitkTextOverlay(const char *id)
Constructor. Creates the internal QLabel widget.
mitk::BaseProperty::Pointer m_ObservedProperty
The observed property for automatic text updates.
unsigned long m_ObserverTag
ITK observer tag for the property modification callback.