Browse Source

Merge pull request #311 from naucoin/3027-ScalarBar-Respond-To-Updates-From-Labels-Text-Property-Widget

Notify the scalar bar widget when text properties change.
Julien Finet 12 years ago
parent
commit
72bf058ff4

+ 13 - 0
Libs/Visualization/VTK/Widgets/ctkVTKScalarBarWidget.cpp

@@ -63,8 +63,21 @@ void ctkVTKScalarBarWidgetPrivate::init()
                    q, SLOT(setNumberOfLabels(int)));
   QObject::connect(this->TitleTextPropertyWidget, SIGNAL(textChanged(QString)),
                    q, SLOT(setTitle(QString)));
+  
   QObject::connect(this->LabelsTextPropertyWidget, SIGNAL(textChanged(QString)),
                    q, SLOT(setLabelsFormat(QString)));
+  QObject::connect(this->LabelsTextPropertyWidget, SIGNAL(colorChanged(QColor)),
+                   q, SIGNAL(modified()));
+  QObject::connect(this->LabelsTextPropertyWidget, SIGNAL(opacityChanged(double)),
+                   q, SIGNAL(modified()));
+  QObject::connect(this->LabelsTextPropertyWidget, SIGNAL(fontFamilyChanged(QString)),
+                   q, SIGNAL(modified()));
+  QObject::connect(this->LabelsTextPropertyWidget, SIGNAL(boldChanged(bool)),
+                   q, SIGNAL(modified()));
+  QObject::connect(this->LabelsTextPropertyWidget, SIGNAL(italicChanged(bool)),
+                   q, SIGNAL(modified()));
+  QObject::connect(this->LabelsTextPropertyWidget, SIGNAL(shadowChanged(bool)),
+                   q, SIGNAL(modified()));
 }
 
 //-----------------------------------------------------------------------------

+ 12 - 0
Libs/Visualization/VTK/Widgets/ctkVTKTextPropertyWidget.cpp

@@ -198,6 +198,8 @@ void ctkVTKTextPropertyWidget::setColor(const QColor& color)
     return;
     }
   d->TextProperty->SetColor(color.redF(), color.greenF(), color.blueF());
+
+  emit colorChanged(color);
 }
 
 //-----------------------------------------------------------------------------
@@ -216,6 +218,8 @@ void ctkVTKTextPropertyWidget::setOpacity(double opacity)
     return;
     }
   d->TextProperty->SetOpacity(opacity);
+
+  emit opacityChanged(opacity);
 }
 
 //-----------------------------------------------------------------------------
@@ -234,6 +238,8 @@ void ctkVTKTextPropertyWidget::setFont(const QString& font)
     return;
     }
   d->TextProperty->SetFontFamilyAsString(font.toStdString().data());
+  
+  emit fontFamilyChanged(font);
 }
 
 //-----------------------------------------------------------------------------
@@ -252,6 +258,8 @@ void ctkVTKTextPropertyWidget::setBold(bool enable)
     return;
     }
   d->TextProperty->SetBold(enable);
+  
+  emit boldChanged(enable);
 }
 
 //-----------------------------------------------------------------------------
@@ -270,6 +278,8 @@ void ctkVTKTextPropertyWidget::setItalic(bool enable)
     return;
     }
   d->TextProperty->SetItalic(enable);
+  
+  emit italicChanged(enable);
 }
 
 //-----------------------------------------------------------------------------
@@ -288,4 +298,6 @@ void ctkVTKTextPropertyWidget::setShadow(bool enable)
     return;
     }
   d->TextProperty->SetShadow(enable);
+  
+  emit shadowChanged(enable);
 }

+ 6 - 0
Libs/Visualization/VTK/Widgets/ctkVTKTextPropertyWidget.h

@@ -82,6 +82,12 @@ public Q_SLOTS:
 
 Q_SIGNALS:
   void textChanged(const QString& text);
+  void colorChanged(const QColor& color);
+  void opacityChanged(double opacity);
+  void fontFamilyChanged(const QString &font);
+  void boldChanged(bool enable);
+  void italicChanged(bool enable);
+  void shadowChanged(bool enable);
 
 protected Q_SLOTS:
   void updateFromTextProperty();