Bladeren bron

BUG: notify the scalar bar widget when text properties change.

The ctkVTKTextPropertyWidget was emitting a textChanged signal when
the label format changed, but no signals were emitted when the color,
opacity, font, or font style were changed. Added the modified
signal on the ctkVTKTextPropertyWidget and pass it through as a
modified signal on the ctkVTKScalarBarWidget so that anyone observing
the modified signal can respond to text property changes.

Slicer4 Issue #3027
Nicole Aucoin 12 jaren geleden
bovenliggende
commit
f72712dd5e

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

@@ -63,8 +63,11 @@ 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(modified()),
+                   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 modified();
 }
 
 //-----------------------------------------------------------------------------
@@ -216,6 +218,8 @@ void ctkVTKTextPropertyWidget::setOpacity(double opacity)
     return;
     }
   d->TextProperty->SetOpacity(opacity);
+
+  emit modified();
 }
 
 //-----------------------------------------------------------------------------
@@ -234,6 +238,8 @@ void ctkVTKTextPropertyWidget::setFont(const QString& font)
     return;
     }
   d->TextProperty->SetFontFamilyAsString(font.toStdString().data());
+  
+  emit modified();
 }
 
 //-----------------------------------------------------------------------------
@@ -252,6 +258,8 @@ void ctkVTKTextPropertyWidget::setBold(bool enable)
     return;
     }
   d->TextProperty->SetBold(enable);
+  
+  emit modified();
 }
 
 //-----------------------------------------------------------------------------
@@ -270,6 +278,8 @@ void ctkVTKTextPropertyWidget::setItalic(bool enable)
     return;
     }
   d->TextProperty->SetItalic(enable);
+  
+  emit modified();
 }
 
 //-----------------------------------------------------------------------------
@@ -288,4 +298,6 @@ void ctkVTKTextPropertyWidget::setShadow(bool enable)
     return;
     }
   d->TextProperty->SetShadow(enable);
+  
+  emit modified();
 }

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

@@ -82,6 +82,7 @@ public Q_SLOTS:
 
 Q_SIGNALS:
   void textChanged(const QString& text);
+  void modified();
 
 protected Q_SLOTS:
   void updateFromTextProperty();