|
Medical Imaging Interaction Toolkit
2026.06.00
Medical Imaging Interaction Toolkit
|
Overlay that displays a text string in a render window. More...
#include <QmitkTextOverlay.h>


Public Member Functions | |
| QmitkTextOverlay (const char *id) | |
| Constructor. Creates the internal QLabel widget. More... | |
| ~QmitkTextOverlay () override | |
| Destructor. Removes the property observer. More... | |
| void | GenerateData (mitk::PropertyList::Pointer pl) override |
| Configures the text overlay from the given PropertyList. More... | |
| QSize | GetNeededSize () override |
| Returns the minimum size needed to display the current text. More... | |
Public Member Functions inherited from QmitkOverlay | |
| QmitkOverlay (const char *id) | |
| Constructor. More... | |
| ~QmitkOverlay () override | |
| Destructor. Deletes the internal widget unless it was set externally. More... | |
| virtual void | SetPosition (DisplayPosition pos) |
| Sets the display position of this overlay. More... | |
| virtual DisplayPosition | GetPosition () |
| Returns the current display position. More... | |
| virtual void | SetLayer (unsigned int layer) |
| Sets the stacking layer of this overlay. More... | |
| virtual unsigned int | GetLayer () |
| Returns the current stacking layer. More... | |
| virtual QWidget * | GetWidget () |
| Returns the internal QWidget representing this overlay. More... | |
Protected Member Functions | |
| void | UpdateFontProperties (mitk::PropertyList::Pointer pl) |
| Applies font-related properties from the PropertyList to the QLabel. More... | |
| void | SetupCallback (mitk::BaseProperty::Pointer prop) |
| Sets up an ITK observer on the given property to auto-update the text. More... | |
| void | UpdateDisplayedTextFromProperties () |
| Reads the current text from the property and updates the QLabel. More... | |
Protected Member Functions inherited from QmitkOverlay | |
| void | AddDropShadow (QWidget *widget) |
| Adds a drop shadow graphics effect to the given widget. More... | |
Protected Attributes | |
| QLabel * | m_Label |
| QLabel internally representing the text overlay. More... | |
| mitk::PropertyList::Pointer | m_PropertyList |
| Cached PropertyList for property lookups. More... | |
| mitk::BaseProperty::Pointer | m_ObservedProperty |
| The observed property for automatic text updates. More... | |
| unsigned long | m_ObserverTag |
| ITK observer tag for the property modification callback. More... | |
Protected Attributes inherited from QmitkOverlay | |
| const char * | m_Id |
| ID of the overlay, used as property key for lookups. More... | |
| DisplayPosition | m_Position |
| Current display position of the overlay. More... | |
| unsigned int | m_Layer |
| Stacking layer of the overlay. More... | |
| QWidget * | m_Widget |
| Internal QWidget representing the overlay content. More... | |
| bool | m_WidgetIsCustom |
| Flag indicating whether the widget was set externally (custom overlay). More... | |
Additional Inherited Members | |
Public Types inherited from QmitkOverlay | |
| enum | DisplayPosition { top_Left , top_Center , top_Right , middle_Left , middle_Right , bottom_Left , bottom_Center , bottom_Right } |
| Enumeration of all possible display positions in a render window. More... | |
Overlay that displays a text string in a render window.
A QmitkTextOverlay is a text-specific implementation of QmitkOverlay. It can be used whenever a simple text is to be rendered as an overlay in a QmitkRenderWindow.
Instead of a generic QWidget (as in QmitkOverlay), a QmitkTextOverlay is internally represented by a QLabel. You can access it via GetWidget().
Calling GenerateData(mitk::PropertyList::Pointer) will set up the text overlay. This includes setting the actual text (which must be stored as a StringProperty whose name matches the overlay's ID).
Example:
The following additional properties customize the appearance:
The overlay registers an observer on the text property so that the displayed text updates automatically when the property value changes.
Definition at line 61 of file QmitkTextOverlay.h.
| QmitkTextOverlay::QmitkTextOverlay | ( | const char * | id | ) |
Constructor. Creates the internal QLabel widget.
| [in] | id | String identifier used to look up the text property by name. |
|
override |
Destructor. Removes the property observer.
|
overridevirtual |
Configures the text overlay from the given PropertyList.
Reads font properties and the text string from the PropertyList. Sets up an observer for automatic text updates when the property changes.
| [in] | pl | The PropertyList containing overlay configuration properties. |
Reimplemented from QmitkOverlay.
|
overridevirtual |
Returns the minimum size needed to display the current text.
Implements QmitkOverlay.
|
protected |
Sets up an ITK observer on the given property to auto-update the text.
| [in] | prop | The property to observe for modifications. |
|
protected |
Reads the current text from the property and updates the QLabel.
The text is read from the property identified by m_Id. If the property is not found, the label remains unchanged.
|
protected |
Applies font-related properties from the PropertyList to the QLabel.
Reads color, font size, kerning, and font family properties and applies them. Missing properties are replaced with default values.
| [in] | pl | The PropertyList to read font properties from. |
|
protected |
QLabel internally representing the text overlay.
Definition at line 116 of file QmitkTextOverlay.h.
|
protected |
The observed property for automatic text updates.
Definition at line 122 of file QmitkTextOverlay.h.
|
protected |
ITK observer tag for the property modification callback.
Definition at line 125 of file QmitkTextOverlay.h.
|
protected |
Cached PropertyList for property lookups.
Definition at line 119 of file QmitkTextOverlay.h.