]> sigrok.org Git - pulseview.git/commitdiff
Added Binding::add_properties_to_form
authorJoel Holdsworth <redacted>
Fri, 6 Sep 2013 23:53:57 +0000 (00:53 +0100)
committerJoel Holdsworth <redacted>
Sun, 29 Sep 2013 14:56:12 +0000 (23:56 +0900)
pv/prop/binding/binding.cpp
pv/prop/binding/binding.h

index 3c9bba5aee16483c14596def207d5ca6d0b0249b..28a47099144eb8d50883a8d602c2f2d210a56c78 100644 (file)
@@ -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<pv::prop::Property> 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;
 }
 
index bdc4487b62c663429d64783366dc4c72dab66a39..97a6a5d1f8e7b6e9dfe6c03cd7345490269c95cd 100644 (file)
@@ -40,6 +40,8 @@ public:
 
        void commit();
 
+       void add_properties_to_form(QFormLayout *layout) const;
+
        QWidget* get_property_form(QWidget *parent) const;
 
 protected: