@@ -103,7 +103,7 @@ void PropertyTreeWidget::setModel(PropertyTreeModel * model)
103103 if (model_) {
104104 connect (
105105 model_, SIGNAL (propertyHiddenChanged (const Property*)),
106- this , SLOT (propertyHiddenChanged (const Property*)), Qt::QueuedConnection );
106+ this , SLOT (propertyHiddenChanged (const Property*)), Qt::DirectConnection );
107107 connect (
108108 model_, SIGNAL (expand (const QModelIndex&)),
109109 this , SLOT (expand (const QModelIndex&)));
@@ -119,12 +119,14 @@ void PropertyTreeWidget::setModel(PropertyTreeModel * model)
119119void PropertyTreeWidget::propertyHiddenChanged (const Property * property)
120120{
121121 if (model_) {
122- const auto & parent_index = model_->parentIndex (property);
123- if (parent_index.isValid ()) {
124- setRowHidden (property->rowNumberInParent (), parent_index, property->getHidden ());
125- } else {
126- printf (" Trying to hide property '%s' that is not part of the model.\n " ,
127- qPrintable (property->getName ()));
122+ if (property->parent () != nullptr ) {
123+ const auto & parent_index = model_->parentIndex (property);
124+ if (parent_index.isValid ()) {
125+ setRowHidden (property->rowNumberInParent (), parent_index, property->getHidden ());
126+ } else {
127+ printf (" Trying to hide property '%s' that is not part of the model.\n " ,
128+ qPrintable (property->getName ()));
129+ }
128130 }
129131 }
130132}
0 commit comments