]> sigrok.org Git - pulseview.git/blobdiff - pv/prop/double.cpp
pv::prop::Int: Removed assert from Int::get_widget
[pulseview.git] / pv / prop / double.cpp
index 188286ae1c4ff08a22687c0ac11704c69920ff23..93b45d327362f93b12595a4249e154bcdac0bb14 100644 (file)
@@ -24,8 +24,8 @@
 
 #include "double.h"
 
-using namespace std;
-using namespace boost;
+using boost::optional;
+using std::pair;
 
 namespace pv {
 namespace prop {
@@ -55,6 +55,10 @@ QWidget* Double::get_widget(QWidget *parent, bool auto_commit)
        if (_spin_box)
                return _spin_box;
 
+       GVariant *const value = _getter ? _getter() : NULL;
+       if (!value)
+               return NULL;
+
        _spin_box = new QDoubleSpinBox(parent);
        _spin_box->setDecimals(_decimals);
        _spin_box->setSuffix(_suffix);
@@ -63,12 +67,8 @@ QWidget* Double::get_widget(QWidget *parent, bool auto_commit)
        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(g_variant_get_double(value));
+       g_variant_unref(value);
 
        if (auto_commit)
                connect(_spin_box, SIGNAL(valueChanged(double)),