23 #include <itkCommand.h>
63 if (text !=
m_Label->text().toStdString())
76 QPalette palette = QPalette();
83 if (colorProp.IsNull())
89 palette.setColor(QPalette::Foreground, QColor(color[0], color[1], color[2], 255));
90 palette.setColor(QPalette::Window, Qt::transparent);
108 if (!propertyList->GetIntProperty(
"overlay.fontSize", fontSize))
112 font.setPointSize(fontSize);
114 bool useKerning =
false;
115 if (!propertyList->GetBoolProperty(
"overlay.kerning", useKerning))
119 font.setKerning(useKerning);
121 std::string fontFamily =
"";
122 if (!propertyList->GetStringProperty(
"overlay.fontFamily", fontFamily))
124 fontFamily =
"Verdana";
126 font.setFamily(QString(fontFamily.c_str()));
135 if (prop.IsNotNull())
142 typedef itk::SimpleMemberCommand<QmitkTextOverlay> MemberCommandType;
146 m_ObserverTag = prop->AddObserver(itk::ModifiedEvent(), propModifiedCommand);
160 QFontMetrics fm(font);
162 return fm.size(Qt::TextSingleLine,
m_Label->text());
QSize GetNeededSize() override
itk::SmartPointer< Self > Pointer
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()
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.
virtual ~QmitkTextOverlay()
Default Destructor.
const char * m_Id
ID of the overlay.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.