From: Joel Holdsworth Date: Fri, 6 Sep 2013 23:53:57 +0000 (+0100) Subject: Added Binding::add_properties_to_form X-Git-Tag: pulseview-0.2.0~289 X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=commitdiff_plain;h=4206fe26e6b3f6439e382a072f5ff67c009f412a Added Binding::add_properties_to_form --- diff --git a/pv/prop/binding/binding.cpp b/pv/prop/binding/binding.cpp index 3c9bba5a..28a47099 100644 --- a/pv/prop/binding/binding.cpp +++ b/pv/prop/binding/binding.cpp @@ -45,19 +45,24 @@ void Binding::commit() } } -QWidget* Binding::get_property_form(QWidget *parent) const +void Binding::add_properties_to_form(QFormLayout *layout) const { - QWidget *const form = new QWidget(parent); - QFormLayout *const layout = new QFormLayout(form); - form->setLayout(layout); + assert(layout); 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())); } +} +QWidget* Binding::get_property_form(QWidget *parent) const +{ + QWidget *const form = new QWidget(parent); + QFormLayout *const layout = new QFormLayout(form); + form->setLayout(layout); + add_properties_to_form(layout); return form; } diff --git a/pv/prop/binding/binding.h b/pv/prop/binding/binding.h index bdc4487b..97a6a5d1 100644 --- a/pv/prop/binding/binding.h +++ b/pv/prop/binding/binding.h @@ -40,6 +40,8 @@ public: void commit(); + void add_properties_to_form(QFormLayout *layout) const; + QWidget* get_property_form(QWidget *parent) const; protected: