- if (_spin_box)
- return _spin_box;
-
- _spin_box = new QDoubleSpinBox(parent);
- _spin_box->setDecimals(_decimals);
- _spin_box->setSuffix(_suffix);
- if (_range)
- _spin_box->setRange(_range->first, _range->second);
- 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);
+ if (spin_box_)
+ return spin_box_;
+
+ if (!getter_)
+ return nullptr;
+
+ try {
+ Glib::VariantBase variant = getter_();
+ if (!variant.gobj())
+ return nullptr;
+ } catch (const sigrok::Error &e) {
+ qWarning() << tr("Querying config key %1 resulted in %2").arg(name_, e.what());
+ return nullptr;