Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't disable display if associated widget tab changes #1739

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions src/rviz/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Display::Display()
, visibility_bits_(0xFFFFFFFF)
, associated_widget_(nullptr)
, associated_widget_panel_(nullptr)
, associated_widget_visible_(false)
, suppress_hiding_associated_widget_panel_(false)
{
// Needed for timeSignal (see header) to work across threads
qRegisterMetaType<ros::Time>();
Expand Down Expand Up @@ -311,10 +311,7 @@ void Display::onEnableChanged()
scene_node_->setVisible(true);

if (associated_widget_panel_)
{
if (!associated_widget_visible_)
associated_widget_panel_->show();
}
associated_widget_panel_->show();
else if (associated_widget_)
associated_widget_->show();

Expand All @@ -327,7 +324,7 @@ void Display::onEnableChanged()

if (associated_widget_panel_)
{
if (associated_widget_visible_)
if (!suppress_hiding_associated_widget_panel_)
associated_widget_panel_->hide();
}
else if (associated_widget_)
Expand Down Expand Up @@ -366,7 +363,6 @@ void Display::setAssociatedWidget(QWidget* widget)
if (wm)
{
associated_widget_panel_ = wm->addPane(getName(), associated_widget_);
associated_widget_visible_ = true;
connect(associated_widget_panel_, SIGNAL(visibilityChanged(bool)), this,
SLOT(associatedPanelVisibilityChange(bool)));
connect(associated_widget_panel_, SIGNAL(closed()), this, SLOT(disable()));
Expand All @@ -386,9 +382,10 @@ void Display::setAssociatedWidget(QWidget* widget)

void Display::associatedPanelVisibilityChange(bool visible)
{
associated_widget_visible_ = visible;
// If something external makes the panel visible/invisible, make sure to enable/disable the display
suppress_hiding_associated_widget_panel_ = true;
setEnabled(visible);
suppress_hiding_associated_widget_panel_ = false;
// Remark: vice versa, in Display::onEnableChanged(),
// the panel is made visible/invisible when the display is enabled/disabled
}
Expand Down
2 changes: 1 addition & 1 deletion src/rviz/display.h
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ private Q_SLOTS:
uint32_t visibility_bits_;
QWidget* associated_widget_;
PanelDockWidget* associated_widget_panel_;
bool associated_widget_visible_;
bool suppress_hiding_associated_widget_panel_;
};

} // end namespace rviz
Expand Down