Skip to content

Commit

Permalink
ENH: emit unique signals when color, opacity, font, style change.
Browse files Browse the repository at this point in the history
The scalar bar widget listens for the unique signals from the text property
widget and passes them along as a modified signal.
  • Loading branch information
Nicole Aucoin committed Apr 4, 2013
1 parent f72712d commit 042b601
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
12 changes: 11 additions & 1 deletion Libs/Visualization/VTK/Widgets/ctkVTKScalarBarWidget.cpp
Expand Up @@ -66,7 +66,17 @@ void ctkVTKScalarBarWidgetPrivate::init()

QObject::connect(this->LabelsTextPropertyWidget, SIGNAL(textChanged(QString)),
q, SLOT(setLabelsFormat(QString)));
QObject::connect(this->LabelsTextPropertyWidget, SIGNAL(modified()),
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()));
}

Expand Down
12 changes: 6 additions & 6 deletions Libs/Visualization/VTK/Widgets/ctkVTKTextPropertyWidget.cpp
Expand Up @@ -199,7 +199,7 @@ void ctkVTKTextPropertyWidget::setColor(const QColor& color)
}
d->TextProperty->SetColor(color.redF(), color.greenF(), color.blueF());

emit modified();
emit colorChanged(color);
}

//-----------------------------------------------------------------------------
Expand All @@ -219,7 +219,7 @@ void ctkVTKTextPropertyWidget::setOpacity(double opacity)
}
d->TextProperty->SetOpacity(opacity);

emit modified();
emit opacityChanged(opacity);
}

//-----------------------------------------------------------------------------
Expand All @@ -239,7 +239,7 @@ void ctkVTKTextPropertyWidget::setFont(const QString& font)
}
d->TextProperty->SetFontFamilyAsString(font.toStdString().data());

emit modified();
emit fontFamilyChanged(font);
}

//-----------------------------------------------------------------------------
Expand All @@ -259,7 +259,7 @@ void ctkVTKTextPropertyWidget::setBold(bool enable)
}
d->TextProperty->SetBold(enable);

emit modified();
emit boldChanged(enable);
}

//-----------------------------------------------------------------------------
Expand All @@ -279,7 +279,7 @@ void ctkVTKTextPropertyWidget::setItalic(bool enable)
}
d->TextProperty->SetItalic(enable);

emit modified();
emit italicChanged(enable);
}

//-----------------------------------------------------------------------------
Expand All @@ -299,5 +299,5 @@ void ctkVTKTextPropertyWidget::setShadow(bool enable)
}
d->TextProperty->SetShadow(enable);

emit modified();
emit shadowChanged(enable);
}
7 changes: 6 additions & 1 deletion Libs/Visualization/VTK/Widgets/ctkVTKTextPropertyWidget.h
Expand Up @@ -82,7 +82,12 @@ public Q_SLOTS:

Q_SIGNALS:
void textChanged(const QString& text);
void modified();
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();
Expand Down

0 comments on commit 042b601

Please sign in to comment.