From 4206fe26e6b3f6439e382a072f5ff67c009f412a Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Sat, 7 Sep 2013 00:53:57 +0100 Subject: [PATCH] Added Binding::add_properties_to_form --- pv/prop/binding/binding.cpp | 15 ++++++++++----- pv/prop/binding/binding.h | 2 ++ 2 files changed, 12 insertions(+), 5 deletions(-) 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: -- 2.30.2