Skip to content

Commit

Permalink
PropertyTree: set custom SelectionModel only with valid model (#1504)
Browse files Browse the repository at this point in the history
  • Loading branch information
v4hn authored May 12, 2020
1 parent 60f2998 commit 171eb3c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/rviz/properties/property_tree_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,12 @@ void PropertyTreeWidget::setModel(PropertyTreeModel* model)
}
model_ = model;
QTreeView::setModel(model_);
QItemSelectionModel* m = selectionModel();
setSelectionModel(new PropertySelectionModel(model_));
m->deleteLater();
if (model_)
{
QItemSelectionModel* m = selectionModel();
setSelectionModel(new PropertySelectionModel(model_));
m->deleteLater();

connect(model_, SIGNAL(propertyHiddenChanged(const Property*)), this,
SLOT(propertyHiddenChanged(const Property*)), Qt::QueuedConnection);
connect(model_, SIGNAL(expand(const QModelIndex&)), this, SLOT(expand(const QModelIndex&)));
Expand Down

0 comments on commit 171eb3c

Please sign in to comment.