X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fprop%2Fbinding%2Fbinding.cpp;h=90e5214e86c08dad3eb208c5b3ccf873e609662a;hb=819f4c25391a9c74d3d2f528d462142d5c4aad4d;hp=7d38cb4629b5498c5d9cd0bc92dd4982909b8177;hpb=479bcabe6b4d0b1f51984085d9944ce6b03ed07c;p=pulseview.git diff --git a/pv/prop/binding/binding.cpp b/pv/prop/binding/binding.cpp index 7d38cb4..90e5214 100644 --- a/pv/prop/binding/binding.cpp +++ b/pv/prop/binding/binding.cpp @@ -18,8 +18,16 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include + +#include + +#include + #include "binding.h" +using boost::shared_ptr; + namespace pv { namespace prop { namespace binding { @@ -29,6 +37,38 @@ const std::vector< boost::shared_ptr >& Binding::properties() return _properties; } +void Binding::commit() +{ + BOOST_FOREACH(shared_ptr p, _properties) { + assert(p); + p->commit(); + } +} + +void Binding::add_properties_to_form(QFormLayout *layout, + bool auto_commit) const +{ + 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(layout->parentWidget(), + auto_commit)); + } +} + +QWidget* Binding::get_property_form(QWidget *parent, + bool auto_commit) const +{ + QWidget *const form = new QWidget(parent); + QFormLayout *const layout = new QFormLayout(form); + form->setLayout(layout); + add_properties_to_form(layout, auto_commit); + return form; +} + } // binding } // prop } // pv