Commit d3b27cb2 authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

fixed PropertyCollectionWidget changing visibility of property widgets from...

fixed PropertyCollectionWidget changing visibility of property widgets from non-Qt thread (now using Qt signals).
parent 39e6f8fc
......@@ -71,6 +71,7 @@ namespace campvis {
_layout->setSpacing(8);
_layout->setMargin(0);
setLayout(_layout);
connect(this, SIGNAL(s_widgetVisibilityChanged(QWidget*, bool)), this, SLOT(onWidgetVisibilityChanged(QWidget*, bool)));
}
void PropertyCollectionWidget::clearWidgetMap() {
......@@ -87,7 +88,11 @@ namespace campvis {
// const_cast does not harm anything.
std::map<AbstractProperty*, QWidget*>::iterator item = _widgetMap.find(const_cast<AbstractProperty*>(prop));
if (item != _widgetMap.end())
item->second->setVisible(item->first->isVisible());
emit s_widgetVisibilityChanged(item->second, item->first->isVisible());
}
void PropertyCollectionWidget::onWidgetVisibilityChanged(QWidget* widget, bool visibility) {
widget->setVisible(visibility);
}
}
\ No newline at end of file
......@@ -67,6 +67,15 @@ namespace campvis {
* \param prop Property that emitted the signal
*/
void onPropertyVisibilityChanged(const AbstractProperty* prop);
protected slots:
/**
* Gets called when the property has changed, so that widget can update its state.
*/
virtual void onWidgetVisibilityChanged(QWidget* widget, bool visibility);
signals:
void s_widgetVisibilityChanged(QWidget* widget, bool visibility);
private:
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment