CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
ctkVTKTextPropertyWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Library: CTK
4 
5  Copyright (c) Kitware Inc.
6 
7  Licensed under the Apache License, Version 2.0 (the "License");
8  you may not use this file except in compliance with the License.
9  You may obtain a copy of the License at
10 
11  http://www.apache.org/licenses/LICENSE-2.0.txt
12 
13  Unless required by applicable law or agreed to in writing, software
14  distributed under the License is distributed on an "AS IS" BASIS,
15  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  See the License for the specific language governing permissions and
17  limitations under the License.
18 
19 =========================================================================*/
20 
21 #ifndef __ctkVTKTextPropertyWidget_h
22 #define __ctkVTKTextPropertyWidget_h
23 
24 // Qt includes
25 #include <QWidget>
26 
27 // CTK includes
28 #include "ctkPimpl.h"
29 #include "ctkVTKObject.h"
30 #include "ctkVisualizationVTKWidgetsExport.h"
31 
32 class ctkVTKTextPropertyWidgetPrivate;
33 class vtkTextProperty;
34 
36 class CTK_VISUALIZATION_VTK_WIDGETS_EXPORT ctkVTKTextPropertyWidget : public QWidget
37 {
38  Q_OBJECT;
40  Q_PROPERTY(bool showText READ isTextVisible WRITE setTextVisible);
41  Q_PROPERTY(QString text READ text WRITE setText);
42  Q_PROPERTY(QString textLabel READ textLabel WRITE setTextLabel);
43  Q_PROPERTY(bool showSize READ isSizeVisible WRITE setSizeVisible);
44 
45 public:
47  ctkVTKTextPropertyWidget(QWidget* parentWidget);
48  ctkVTKTextPropertyWidget(vtkTextProperty* textProperty, QWidget* parentWidget);
50 
51  vtkTextProperty* textProperty()const;
52 
53  void setTextVisible(bool visible);
54  bool isTextVisible()const;
55 
56  void setSizeVisible(bool visible);
57  bool isSizeVisible()const;
58 
59  QString text()const;
60  QString textLabel()const;
61 
63  QColor color()const;
65  double opacity()const;
67  QString font()const;
69  bool isBold()const;
71  bool isItalic()const;
73  bool hasShadow()const;
75  double size()const;
76 
77 public Q_SLOTS:
78  void setTextProperty(vtkTextProperty* textProperty);
79  void setText(const QString& text);
80  void setTextLabel(const QString& label);
81 
82  void setColor(const QColor& color);
83  void setOpacity(double opacity);
84  void setFont(const QString& font);
85  void setBold(bool enable);
86  void setItalic(bool enable);
87  void setShadow(bool enable);
88  void setSize(double size);
89 
90 Q_SIGNALS:
91  void textChanged(const QString& text);
92  void colorChanged(const QColor& color);
93  void opacityChanged(double opacity);
94  void fontFamilyChanged(const QString &font);
95  void boldChanged(bool enable);
96  void italicChanged(bool enable);
97  void shadowChanged(bool enable);
98  void sizeChanged(double size);
99 
100 protected Q_SLOTS:
102 
103 protected:
104  QScopedPointer<ctkVTKTextPropertyWidgetPrivate> d_ptr;
105 
106 private:
107  Q_DECLARE_PRIVATE(ctkVTKTextPropertyWidget);
108  Q_DISABLE_COPY(ctkVTKTextPropertyWidget);
109 };
110 
111 #endif
vtkTextProperty * textProperty() const
void fontFamilyChanged(const QString &font)
bool hasShadow() const
Has the text shadows.
void shadowChanged(bool enable)
void setOpacity(double opacity)
QString text() const
void setColor(const QColor &color)
bool isSizeVisible() const
QScopedPointer< ctkVTKTextPropertyWidgetPrivate > d_ptr
void setTextProperty(vtkTextProperty *textProperty)
void setSizeVisible(bool visible)
void italicChanged(bool enable)
void setShadow(bool enable)
virtual ~ctkVTKTextPropertyWidget()
bool isTextVisible() const
void setBold(bool enable)
void setText(const QString &text)
void textChanged(const QString &text)
QString font() const
Font of vtkTextProperty.
void setTextLabel(const QString &label)
void opacityChanged(double opacity)
void setTextVisible(bool visible)
bool isItalic() const
Is the text italic.
QString textLabel() const
void setItalic(bool enable)
bool isBold() const
Is the text bold.
ctkVTKTextPropertyWidget(QWidget *parentWidget)
Constructors.
ctkVTKTextPropertyWidget(vtkTextProperty *textProperty, QWidget *parentWidget)
void boldChanged(bool enable)
void sizeChanged(double size)
double size() const
Size of vtkTextProperty.
void colorChanged(const QColor &color)
void setSize(double size)
void setFont(const QString &font)
QColor color() const
Color of vtkTextProperty.
double opacity() const
Opacity of vtkTextProperty.
#define QVTK_OBJECT
Define VTK/Qt event/slot connection utility methods. It is a convenient macro that declares and defin...
Definition: ctkVTKObject.h:222