ctkVTKTextPropertyWidget.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*=========================================================================
  2. Library: CTK
  3. Copyright (c) Kitware Inc.
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.apache.org/licenses/LICENSE-2.0.txt
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. =========================================================================*/
  14. #ifndef __ctkVTKTextPropertyWidget_h
  15. #define __ctkVTKTextPropertyWidget_h
  16. // Qt includes
  17. #include <QWidget>
  18. // CTK includes
  19. #include "ctkPimpl.h"
  20. #include "ctkVTKObject.h"
  21. #include "ctkVisualizationVTKWidgetsExport.h"
  22. class ctkVTKTextPropertyWidgetPrivate;
  23. class vtkTextProperty;
  24. class CTK_VISUALIZATION_VTK_WIDGETS_EXPORT ctkVTKTextPropertyWidget : public QWidget
  25. {
  26. Q_OBJECT;
  27. QVTK_OBJECT;
  28. Q_PROPERTY(bool showText READ isTextVisible WRITE setTextVisible);
  29. Q_PROPERTY(QString text READ text WRITE setText);
  30. Q_PROPERTY(QString textLabel READ textLabel WRITE setTextLabel);
  31. public:
  32. /// Constructors
  33. ctkVTKTextPropertyWidget(QWidget* parentWidget);
  34. ctkVTKTextPropertyWidget(vtkTextProperty* textProperty, QWidget* parentWidget);
  35. virtual ~ctkVTKTextPropertyWidget();
  36. vtkTextProperty* textProperty()const;
  37. void setTextVisible(bool visible);
  38. bool isTextVisible()const;
  39. QString text()const;
  40. QString textLabel()const;
  41. /// Color of vtkTextProperty
  42. QColor color()const;
  43. /// Opacity of vtkTextProperty
  44. double opacity()const;
  45. /// Font of vtkTextProperty
  46. QString font()const;
  47. /// Is the text bold
  48. bool isBold()const;
  49. /// Is the text italic
  50. bool isItalic()const;
  51. /// Has the text shadows
  52. bool hasShadow()const;
  53. public slots:
  54. void setTextProperty(vtkTextProperty* textProperty);
  55. void setText(const QString& text);
  56. void setTextLabel(const QString& label);
  57. void setColor(const QColor& color);
  58. void setOpacity(double opacity);
  59. void setFont(const QString& font);
  60. void setBold(bool enable);
  61. void setItalic(bool enable);
  62. void setShadow(bool enable);
  63. signals:
  64. void textChanged(const QString& text);
  65. protected slots:
  66. void updateFromTextProperty();
  67. protected:
  68. QScopedPointer<ctkVTKTextPropertyWidgetPrivate> d_ptr;
  69. private:
  70. Q_DECLARE_PRIVATE(ctkVTKTextPropertyWidget);
  71. Q_DISABLE_COPY(ctkVTKTextPropertyWidget);
  72. };
  73. #endif