From f904b4128535f324b6a931bdaa9bbe9526c03ec0 Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Sat, 12 Oct 2013 12:31:04 +0100 Subject: [PATCH] Added support for auto-apply in Binding --- pv/prop/binding/binding.cpp | 11 +++++++---- pv/prop/binding/binding.h | 6 ++++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/pv/prop/binding/binding.cpp b/pv/prop/binding/binding.cpp index 28a4709..afdd703 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 97a6a5d..4de4af3 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; -- 2.30.2