Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
QmitkTextOverlay Class Reference

object representing a text that is drawn as an overlay More...

#include <QmitkTextOverlay.h>

Inheritance diagram for QmitkTextOverlay:
Collaboration diagram for QmitkTextOverlay:

Public Member Functions

 QmitkTextOverlay (const char *id)
 Default Constructor. More...
 
virtual ~QmitkTextOverlay ()
 Default Destructor. More...
 
void GenerateData (mitk::PropertyList::Pointer) override
 Setup the QLabel with overlay specific information. More...
 
QSize GetNeededSize () override
 
- Public Member Functions inherited from QmitkOverlay
 QmitkOverlay (const char *id)
 Constructor with string ID. More...
 
virtual ~QmitkOverlay ()
 Default Destructor. More...
 
virtual void SetPosition (DisplayPosition)
 setter for the display-position More...
 
virtual DisplayPosition GetPosition ()
 getter for the display-position More...
 
virtual void SetLayer (unsigned int)
 setter for the layer More...
 
virtual unsigned int GetLayer ()
 getter for the layer More...
 
virtual QWidget * GetWidget ()
 returns the internally handled QWidget More...
 

Protected Member Functions

void UpdateFontProperties (mitk::PropertyList::Pointer)
 internal helper class to determine text-properties More...
 
void SetupCallback (mitk::BaseProperty::Pointer prop)
 
void UpdateDisplayedTextFromProperties ()
 
- Protected Member Functions inherited from QmitkOverlay
void AddDropShadow (QWidget *widget)
 Add drop shadow effect via QGraphicsEffect. More...
 

Protected Attributes

QLabel * m_Label
 QLabel internally representing the TextOverlay. More...
 
mitk::PropertyList::Pointer m_PropertyList
 
mitk::BaseProperty::Pointer m_ObservedProperty
 
unsigned long m_ObserverTag
 
- Protected Attributes inherited from QmitkOverlay
const char * m_Id
 ID of the overlay. More...
 
DisplayPosition m_Position
 position of the overlay More...
 
unsigned int m_Layer
 layer of the overlay More...
 
QWidget * m_Widget
 internal QWidget representing the overlay More...
 
bool m_WidgetIsCustom
 

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 More...
 

Detailed Description

object representing a text that is drawn as an overlay

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 QWidget (as in QmitkOverlay) a QmitkTextOverlay is internally represented by a QLabel. You can access it via GetWidget().

Calling GenerateData( mitk::PropertyList::Pointer ) will setup the textoverlay. This includes setting of the actual text (that must be stored in the property with the name that is given the overlay as ID).

e.g. mitk::StringProperty::Pointer nameProp = mitk::StringProperty::New( "overlay.text.patientName", "Max" );

QmitkTextOverlay* nameOverlay = new QmitkTextOverlay( "overlay.text.patientName" );

In order to customize the look of the textoverlays, a number of additional properties can be set (default values in square brackets):

overlay.color : defines the text-color (mitk::ColorProperty) overlay.fontSize : defines the fontSize of the text (mitk::IntProperty) overlay.kerning : defines if kerning is to be used (mitk::BoolProperty) overlay.fontFamily : defines the fon family that is to be used (mitk::StringProperty)

Definition at line 59 of file QmitkTextOverlay.h.

Constructor & Destructor Documentation

QmitkTextOverlay::QmitkTextOverlay ( const char *  id)

Default Constructor.

Definition at line 25 of file QmitkTextOverlay.cpp.

References QmitkOverlay::AddDropShadow(), m_Label, and QmitkOverlay::m_Widget.

QmitkTextOverlay::~QmitkTextOverlay ( )
virtual

Default Destructor.

Definition at line 31 of file QmitkTextOverlay.cpp.

References QmitkOverlay::m_Id, m_ObserverTag, and m_PropertyList.

Member Function Documentation

void QmitkTextOverlay::GenerateData ( mitk::PropertyList::Pointer  pl)
overridevirtual

Setup the QLabel with overlay specific information.

First, this method sets text-overlay specific properties as described in the class docu above. Secondly, the actual text of the label is set.

No error will be issued if the property containing the text is not found, the TextOverlay will show an empty string!

Reimplemented from QmitkOverlay.

Definition at line 36 of file QmitkTextOverlay.cpp.

References QmitkOverlay::m_Id, m_PropertyList, MITK_ERROR, SetupCallback(), UpdateDisplayedTextFromProperties(), and UpdateFontProperties().

QSize QmitkTextOverlay::GetNeededSize ( )
overridevirtual

Implements QmitkOverlay.

Definition at line 157 of file QmitkTextOverlay.cpp.

References m_Label.

void QmitkTextOverlay::SetupCallback ( mitk::BaseProperty::Pointer  prop)
protected
void QmitkTextOverlay::UpdateDisplayedTextFromProperties ( )
protected

Definition at line 56 of file QmitkTextOverlay.cpp.

References QmitkOverlay::m_Id, m_Label, m_PropertyList, and MITK_DEBUG.

Referenced by GenerateData(), and SetupCallback().

void QmitkTextOverlay::UpdateFontProperties ( mitk::PropertyList::Pointer  pl)
protected

internal helper class to determine text-properties

This method is only used internally to apply the font specific properties that can be set using a mitk::PropertyList. If a property cannot be found, a default value is used.

The values of these properties are then attributed to the QLabel using QFont and QPalette.

Definition at line 70 of file QmitkTextOverlay.cpp.

References m_Label, and mitk::ColorProperty::New().

Referenced by GenerateData().

Member Data Documentation

QLabel* QmitkTextOverlay::m_Label
protected

QLabel internally representing the TextOverlay.

Definition at line 101 of file QmitkTextOverlay.h.

Referenced by GetNeededSize(), QmitkTextOverlay(), UpdateDisplayedTextFromProperties(), and UpdateFontProperties().

mitk::BaseProperty::Pointer QmitkTextOverlay::m_ObservedProperty
protected

Definition at line 105 of file QmitkTextOverlay.h.

Referenced by SetupCallback().

unsigned long QmitkTextOverlay::m_ObserverTag
protected

Definition at line 107 of file QmitkTextOverlay.h.

Referenced by SetupCallback(), and ~QmitkTextOverlay().

mitk::PropertyList::Pointer QmitkTextOverlay::m_PropertyList
protected

The documentation for this class was generated from the following files: