X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fview%2Ftrace.cpp;h=d06c24b5e63ed98d98a7f190851ed2667f9d5ccc;hb=f3f98f8fade1cffb28161da2710dfc9def5e6d74;hp=79255bec3f98fa4491a4e81c6cb4529c12b176f0;hpb=20eaae392762d69fc97cdc68115bcc0e648a59da;p=pulseview.git diff --git a/pv/view/trace.cpp b/pv/view/trace.cpp index 79255bec..d06c24b5 100644 --- a/pv/view/trace.cpp +++ b/pv/view/trace.cpp @@ -88,6 +88,8 @@ void Trace::paint_back(QPainter &p, int left, int right) (void)p; (void)left; (void)right; + + compute_text_size(p); } void Trace::paint_mid(QPainter &p, int left, int right) @@ -183,10 +185,8 @@ pv::widgets::Popup* Trace::create_popup(QWidget *parent) using pv::widgets::Popup; _popup = new Popup(parent); - _popup_form = new QFormLayout(_popup); - _popup->setLayout(_popup_form); - populate_popup_form(_popup, _popup_form); + create_popup_form(); connect(_popup, SIGNAL(closed()), this, SLOT(on_popup_closed())); @@ -224,6 +224,22 @@ void Trace::add_colour_option(QWidget *parent, QFormLayout *form) form->addRow(tr("Colour"), colour_button); } +void Trace::create_popup_form() +{ + // Clear the layout + + // Transfer the layout and the child widgets to a temporary widget + // which then goes out of scope destroying the layout and all the child + // widgets. + if (_popup_form) + QWidget().setLayout(_popup_form); + + // Repopulate the popup + _popup_form = new QFormLayout(_popup); + _popup->setLayout(_popup_form); + populate_popup_form(_popup, _popup_form); +} + void Trace::populate_popup_form(QWidget *parent, QFormLayout *form) { QLineEdit *const name_edit = new QLineEdit(parent);