浏览代码

ENH: ctkVTKRenderView - Added getter cornerAnnotationText()

Also added the slots corresponding to cornerAnnotationText/SetCornerAnnotationText
using Q_PROPERTY
Jean-Christophe Fillion-Robin 15 年之前
父节点
当前提交
88d9f0a173

+ 7 - 0
Libs/Visualization/VTK/Widgets/ctkVTKRenderView.cpp

@@ -176,6 +176,13 @@ void ctkVTKRenderView::setCornerAnnotationText(const QString& text)
   d->CornerAnnotation->SetText(2, text.toLatin1());
 }
 
+//----------------------------------------------------------------------------
+QString ctkVTKRenderView::cornerAnnotationText() const
+{
+  CTK_D(const ctkVTKRenderView);
+  return QLatin1String(d->CornerAnnotation->GetText(2));
+}
+
 // --------------------------------------------------------------------------
 void ctkVTKRenderView::setBackgroundColor(double r, double g, double b)
 {

+ 3 - 1
Libs/Visualization/VTK/Widgets/ctkVTKRenderView.h

@@ -39,6 +39,7 @@ class vtkCamera;
 class CTK_VISUALIZATION_VTK_WIDGETS_EXPORT ctkVTKRenderView : public QWidget
 {
   Q_OBJECT
+  Q_PROPERTY(QString cornerAnnotationText READ cornerAnnotationText WRITE setCornerAnnotationText)
 public:
   /// Constructors
   typedef QWidget   Superclass;
@@ -61,8 +62,9 @@ public:
   /// Get current interactor style
   vtkInteractorObserver* interactorStyle();
 
-  /// Set corner annotation text
+  /// Set/Get corner annotation \a text
   void setCornerAnnotationText(const QString& text);
+  QString cornerAnnotationText() const;
 
   /// Set background color
   void setBackgroundColor(double r, double g, double b);