X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=pv%2Fprop%2Fbinding%2Fbinding.cpp;h=3c9bba5aee16483c14596def207d5ca6d0b0249b;hb=7112a4581822c43241a55fbd61c98bee062d452b;hp=9455ad5905258d00bb4c1c7518610754490ab291;hpb=3a69ef6b7e1a0c4effdcc3e66c00fc9dbc973613;p=pulseview.git diff --git a/pv/prop/binding/binding.cpp b/pv/prop/binding/binding.cpp index 9455ad59..3c9bba5a 100644 --- a/pv/prop/binding/binding.cpp +++ b/pv/prop/binding/binding.cpp @@ -18,51 +18,47 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include -#include - #include -#include "binding.h" +#include #include +#include "binding.h" + using namespace boost; namespace pv { namespace prop { namespace binding { -Binding::Binding() : - _form(NULL) +const std::vector< boost::shared_ptr >& Binding::properties() { + return _properties; } -QWidget* Binding::get_form(QWidget *parent) +void Binding::commit() { - if(_form) - return _form; - - _form = new QWidget(parent); - QFormLayout *const layout = new QFormLayout(_form); - _form->setLayout(layout); - - BOOST_FOREACH(shared_ptr p, _properties) - { + BOOST_FOREACH(shared_ptr p, _properties) { assert(p); - layout->addRow(p->name(), p->get_widget(_form)); + p->commit(); } - - return _form; } -void Binding::commit() +QWidget* Binding::get_property_form(QWidget *parent) const { - BOOST_FOREACH(shared_ptr p, _properties) + QWidget *const form = new QWidget(parent); + QFormLayout *const layout = new QFormLayout(form); + form->setLayout(layout); + + BOOST_FOREACH(shared_ptr p, _properties) { assert(p); - p->commit(); + const QString label = p->labeled_widget() ? QString() : p->name(); + layout->addRow(label, p->get_widget(form)); } + + return form; } } // binding