projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix SVG icons not being displayed on Windows.
[pulseview.git]
/
pv
/
prop
/
binding
/
binding.cpp
diff --git
a/pv/prop/binding/binding.cpp
b/pv/prop/binding/binding.cpp
index 3b15f5a9ebfed1858258461b63bb0b33c62ba15c..90e5214e86c08dad3eb208c5b3ccf873e609662a 100644
(file)
--- a/
pv/prop/binding/binding.cpp
+++ b/
pv/prop/binding/binding.cpp
@@
-18,52
+18,55
@@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <QFormLayout>
-#include <QWidget>
-
#include <boost/foreach.hpp>
#include <boost/foreach.hpp>
-#include
"binding.h"
+#include
<QFormLayout>
#include <pv/prop/property.h>
#include <pv/prop/property.h>
-using namespace boost;
+#include "binding.h"
+
+using boost::shared_ptr;
namespace pv {
namespace prop {
namespace binding {
namespace pv {
namespace prop {
namespace binding {
-Binding::Binding() :
- _form(NULL)
+const std::vector< boost::shared_ptr<Property> >& Binding::properties()
{
{
+ return _properties;
}
}
-
QWidget* Binding::get_form(QWidget *parent
)
+
void Binding::commit(
)
{
{
- if (_form)
- return _form;
+ BOOST_FOREACH(shared_ptr<pv::prop::Property> p, _properties) {
+ assert(p);
+ p->commit();
+ }
+}
- _form = new QWidget(parent);
- QFormLayout *const layout = new QFormLayout(_form);
- _form->setLayout(layout);
+void Binding::add_properties_to_form(QFormLayout *layout,
+ bool auto_commit) const
+{
+ assert(layout);
- BOOST_FOREACH(shared_ptr<Property> p, _properties)
+ BOOST_FOREACH(shared_ptr<
pv::prop::
Property> p, _properties)
{
assert(p);
const QString label = p->labeled_widget() ? QString() : p->name();
{
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(),
+ auto_commit));
}
}
-
- return _form;
}
}
-void Binding::commit()
+QWidget* Binding::get_property_form(QWidget *parent,
+ bool auto_commit) const
{
{
- BOOST_FOREACH(shared_ptr<Property> p, _properties)
- {
-
assert(p
);
-
p->commit(
);
- }
+ 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
}
} // binding