+void Trace::create_popup_form()
+{
+ // Clear the layout
+
+ // Transfer the layout and the child widgets to a temporary widget
+ // which we delete after the event was handled. This way, the layout
+ // and all widgets contained therein are deleted after the event was
+ // handled, leaving the parent popup_ time to handle the change.
+ if (popup_form_) {
+ QWidget *suicidal = new QWidget();
+ suicidal->setLayout(popup_form_);
+ suicidal->deleteLater();
+ }
+
+ // Repopulate the popup
+ popup_form_ = new QFormLayout(popup_);
+ popup_->setLayout(popup_form_);
+ populate_popup_form(popup_, popup_form_);
+}
+