Skip to content

Commit 4b386d3

Browse files
authored
Postpone hiding of properties until insertion into model is finished (#1508)
Signed-off-by: Alejandro Hernandez Cordero <[email protected]>
1 parent ac55fdd commit 4b386d3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

rviz_common/src/rviz_common/properties/property.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include <QLineEdit> // NOLINT: cpplint is unable to handle the include order here
4141
#include <QSpinBox> // NOLINT: cpplint is unable to handle the include order here
4242
#include <QString> // NOLINT: cpplint is unable to handle the include order here
43+
#include <QTimer> // NOLINT: cpplint is unable to handle the include order here
4344

4445
#include "rviz_common/properties/float_edit.hpp"
4546
#include "rviz_common/properties/property_tree_model.hpp"
@@ -386,7 +387,12 @@ void Property::setModel(PropertyTreeModel * model)
386387
{
387388
model_ = model;
388389
if (model_ && hidden_) {
389-
model_->emitPropertyHiddenChanged(this);
390+
// process propertyHiddenChanged after insertion into model has finishedAdd commentMore actions
391+
QTimer::singleShot(0, model_, [this]() {
392+
if (model_) {
393+
model_->emitPropertyHiddenChanged(this);
394+
}
395+
});
390396
}
391397
int num_children = numChildren();
392398
for (int i = 0; i < num_children; i++) {

0 commit comments

Comments
 (0)