#include "double.h"
-using namespace std;
-using namespace boost;
+using boost::optional;
+using std::pair;
namespace pv {
namespace prop {
if (_spin_box)
return _spin_box;
+ if (!_getter)
+ return NULL;
+
+ Glib::VariantBase variant = _getter();
+ if (!variant.gobj())
+ return NULL;
+
+ double value = Glib::VariantBase::cast_dynamic<Glib::Variant<double>>(
+ variant).get();
+
_spin_box = new QDoubleSpinBox(parent);
_spin_box->setDecimals(_decimals);
_spin_box->setSuffix(_suffix);
if (_step)
_spin_box->setSingleStep(*_step);
- GVariant *const value = _getter ? _getter() : NULL;
-
- if (value) {
- _spin_box->setValue(g_variant_get_double(value));
- g_variant_unref(value);
- }
+ _spin_box->setValue(value);
if (auto_commit)
connect(_spin_box, SIGNAL(valueChanged(double)),
if (!_spin_box)
return;
- _setter(g_variant_new_double(_spin_box->value()));
+ _setter(Glib::Variant<double>::create(_spin_box->value()));
}
void Double::on_value_changed(double)