19 #include <itkCommand.h> 59 if (text !=
m_Label->text().toStdString())
72 QPalette palette = QPalette();
79 if (colorProp.IsNull())
85 palette.setColor(QPalette::Foreground, QColor(color[0], color[1], color[2], 255));
86 palette.setColor(QPalette::Window, Qt::transparent);
104 if (!propertyList->GetIntProperty(
"overlay.fontSize", fontSize))
108 font.setPointSize(fontSize);
110 bool useKerning =
false;
111 if (!propertyList->GetBoolProperty(
"overlay.kerning", useKerning))
115 font.setKerning(useKerning);
117 std::string fontFamily =
"";
118 if (!propertyList->GetStringProperty(
"overlay.fontFamily", fontFamily))
120 fontFamily =
"Verdana";
122 font.setFamily(QString(fontFamily.c_str()));
131 if (prop.IsNotNull())
138 typedef itk::SimpleMemberCommand<QmitkTextOverlay> MemberCommandType;
139 MemberCommandType::Pointer propModifiedCommand;
140 propModifiedCommand = MemberCommandType::New();
142 m_ObserverTag = prop->AddObserver(itk::ModifiedEvent(), propModifiedCommand);
156 QFontMetrics fm(font);
158 return fm.size(Qt::TextSingleLine,
m_Label->text());
QSize GetNeededSize() override
void UpdateFontProperties(mitk::PropertyList::Pointer)
internal helper class to determine text-properties
QmitkTextOverlay(const char *id)
Default Constructor.
void AddDropShadow(QWidget *widget)
Add drop shadow effect via QGraphicsEffect.
Abstract base class for all overlay-objects in MITK.
void SetupCallback(mitk::BaseProperty::Pointer prop)
void UpdateDisplayedTextFromProperties()
~QmitkTextOverlay() override
Default Destructor.
mitk::PropertyList::Pointer m_PropertyList
The ColorProperty class RGB color property.
QWidget * m_Widget
internal QWidget representing the overlay
unsigned long m_ObserverTag
mitk::BaseProperty::Pointer m_ObservedProperty
itk::RGBPixel< float > Color
Color Standard RGB color typedef (float)
QLabel * m_Label
QLabel internally representing the TextOverlay.
void GenerateData(mitk::PropertyList::Pointer) override
Setup the QLabel with overlay specific information.
const char * m_Id
ID of the overlay.