From a09d7d43aec8f01c2635d18cd3600aadde0eea57 Mon Sep 17 00:00:00 2001 From: Andreas Schenk <andreas_schenk@hms.harvard.edu> Date: Mon, 30 Apr 2012 17:35:40 -0400 Subject: [PATCH] fixed parent of DropBox to avoid problems with hiding it --- modules/gui/src/panels/panel_bar.cc | 7 ++++++- modules/gui/src/panels/panel_bar.hh | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/gui/src/panels/panel_bar.cc b/modules/gui/src/panels/panel_bar.cc index e5f168d8c..81312afb1 100644 --- a/modules/gui/src/panels/panel_bar.cc +++ b/modules/gui/src/panels/panel_bar.cc @@ -41,7 +41,7 @@ PanelBar::PanelBar(QWidget* parent) : view_mode_menu_(new QMenu("View Mode",this)), current_view_mode_(NULL), widget_states_(), - drop_box_(new DropBox(this)), + drop_box_(new DropBox), // DropBox having no parent is done on purpose (otherwise it will not hide properly) show_action_(new QAction(this)) { connect(view_mode_menu_,SIGNAL(triggered(QAction*)),this,SLOT(ChangeViewMode(QAction*))); @@ -62,6 +62,11 @@ PanelBar::PanelBar(QWidget* parent) : this->addAction(show_action_); } +PanelBar::~PanelBar() +{ + delete drop_box_; // manually destroy drop_box_ widget, as it has no parent. +} + void PanelBar::AddWidget(Widget* widget, bool is_hidden) { int index = this->GetIndex(widget); diff --git a/modules/gui/src/panels/panel_bar.hh b/modules/gui/src/panels/panel_bar.hh index 7c81cbd0b..463641357 100644 --- a/modules/gui/src/panels/panel_bar.hh +++ b/modules/gui/src/panels/panel_bar.hh @@ -54,6 +54,7 @@ class DLLEXPORT_OST_GUI PanelBar : public Widget { Q_OBJECT public: PanelBar(QWidget* parent); + virtual ~PanelBar(); virtual bool Save(const QString& prefix); virtual bool Restore(const QString& prefix); -- GitLab