From df72fce669683e01a67156bec3f847f6449b30a7 Mon Sep 17 00:00:00 2001 From: Robert Haschke Date: Sun, 5 Nov 2023 11:28:30 +0100 Subject: [PATCH] Postpone hiding of properties until insertion into model is finished When disabling and re-enabling a RobotModelDisplay, its hidden properties (e.g. Alpha of a link having no geometry), were not hidden anymore. --- src/rviz/properties/property.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/rviz/properties/property.cpp b/src/rviz/properties/property.cpp index 1c4fb32576..200ebe2133 100644 --- a/src/rviz/properties/property.cpp +++ b/src/rviz/properties/property.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -395,7 +396,8 @@ void Property::setModel(PropertyTreeModel* model) model_ = model; if (model_ && hidden_) { - model_->emitPropertyHiddenChanged(this); + // process propertyHiddenChanged after insertion into model has finished + QTimer::singleShot(0, model_, [this]() { model_->emitPropertyHiddenChanged(this); }); } int num_children = numChildren(); for (int i = 0; i < num_children; i++)