From: Joel Holdsworth Date: Sat, 12 Oct 2013 11:31:04 +0000 (+0100) Subject: Added support for auto-apply in Binding X-Git-Tag: pulseview-0.2.0~255 X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=commitdiff_plain;h=f904b4128535f324b6a931bdaa9bbe9526c03ec0;hp=b1fe148e0dce6e369c9d4770ca935a6a9ec94b59 Added support for auto-apply in Binding --- diff --git a/pv/prop/binding/binding.cpp b/pv/prop/binding/binding.cpp index 28a47099..afdd7030 100644 --- a/pv/prop/binding/binding.cpp +++ b/pv/prop/binding/binding.cpp @@ -45,7 +45,8 @@ void Binding::commit() } } -void Binding::add_properties_to_form(QFormLayout *layout) const +void Binding::add_properties_to_form(QFormLayout *layout, + bool auto_commit) const { assert(layout); @@ -53,16 +54,18 @@ void Binding::add_properties_to_form(QFormLayout *layout) const { assert(p); const QString label = p->labeled_widget() ? QString() : p->name(); - layout->addRow(label, p->get_widget(layout->parentWidget())); + layout->addRow(label, p->get_widget(layout->parentWidget(), + auto_commit)); } } -QWidget* Binding::get_property_form(QWidget *parent) const +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); + add_properties_to_form(layout, auto_commit); return form; } diff --git a/pv/prop/binding/binding.h b/pv/prop/binding/binding.h index 97a6a5d1..4de4af33 100644 --- a/pv/prop/binding/binding.h +++ b/pv/prop/binding/binding.h @@ -40,9 +40,11 @@ public: void commit(); - void add_properties_to_form(QFormLayout *layout) const; + void add_properties_to_form(QFormLayout *layout, + bool auto_commit = false) const; - QWidget* get_property_form(QWidget *parent) const; + QWidget* get_property_form(QWidget *parent, + bool auto_commit = false) const; protected: std::vector< boost::shared_ptr > _properties;