X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fprop%2Fbinding%2Fbinding.cpp;h=28a47099144eb8d50883a8d602c2f2d210a56c78;hb=4206fe26e6b3f6439e382a072f5ff67c009f412a;hp=3b15f5a9ebfed1858258461b63bb0b33c62ba15c;hpb=de1d99bbe58f825e30048baa48a9439c01686f10;p=pulseview.git diff --git a/pv/prop/binding/binding.cpp b/pv/prop/binding/binding.cpp index 3b15f5a..28a4709 100644 --- a/pv/prop/binding/binding.cpp +++ b/pv/prop/binding/binding.cpp @@ -18,52 +18,52 @@ * 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; + BOOST_FOREACH(shared_ptr p, _properties) { + assert(p); + p->commit(); + } +} - _form = new QWidget(parent); - QFormLayout *const layout = new QFormLayout(_form); - _form->setLayout(layout); +void Binding::add_properties_to_form(QFormLayout *layout) const +{ + assert(layout); - BOOST_FOREACH(shared_ptr p, _properties) + BOOST_FOREACH(shared_ptr p, _properties) { assert(p); const QString label = p->labeled_widget() ? QString() : p->name(); - layout->addRow(label, p->get_widget(_form)); + layout->addRow(label, p->get_widget(layout->parentWidget())); } - - return _form; } -void Binding::commit() +QWidget* Binding::get_property_form(QWidget *parent) const { - BOOST_FOREACH(shared_ptr p, _properties) - { - assert(p); - p->commit(); - } + QWidget *const form = new QWidget(parent); + QFormLayout *const layout = new QFormLayout(form); + form->setLayout(layout); + add_properties_to_form(layout); + return form; } } // binding