From: Joel Holdsworth Date: Sat, 30 Nov 2013 17:48:10 +0000 (+0000) Subject: Added message when there is an empty decode stack X-Git-Tag: pulseview-0.2.0~207 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=5069084a51b248fceaa123f451bad3d8fb01d2fb;p=pulseview.git Added message when there is an empty decode stack --- diff --git a/pv/view/decodetrace.cpp b/pv/view/decodetrace.cpp index bad849c0..b67c0f7a 100644 --- a/pv/view/decodetrace.cpp +++ b/pv/view/decodetrace.cpp @@ -148,14 +148,26 @@ void DecodeTrace::populate_popup_form(QWidget *parent, QFormLayout *form) _probe_selectors.clear(); const list< shared_ptr >& stack = _decoder_stack->stack(); - list< shared_ptr >::const_iterator iter = stack.begin(); - for (int i = 0; i < (int)stack.size(); i++, iter++) { - shared_ptr dec(*iter); - create_decoder_form(i, dec, parent, form); + + if (stack.empty()) + { + QLabel *const l = new QLabel( + tr("

No decoders in the stack

")); + l->setAlignment(Qt::AlignCenter); + form->addRow(l); } + else + { + list< shared_ptr >::const_iterator iter = + stack.begin(); + for (int i = 0; i < (int)stack.size(); i++, iter++) { + shared_ptr dec(*iter); + create_decoder_form(i, dec, parent, form); + } - form->addRow(new QLabel( - tr("* Required Probes"), parent)); + form->addRow(new QLabel( + tr("* Required Probes"), parent)); + } // Add stacking button pv::widgets::DecoderMenu *const decoder_menu =