MCPcopy Index your code
hub / github.com/DreamSourceLab/DSView / get_widget

Method get_widget

DSView/pv/prop/double.cpp:55–81  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53}
54
55QWidget* Double::get_widget(QWidget *parent, bool auto_commit)
56{
57 if (_spin_box)
58 return _spin_box;
59
60 _spin_box = new QDoubleSpinBox(parent);
61 _spin_box->setDecimals(_decimals);
62 _spin_box->setSuffix(_suffix);
63 if (_range)
64 _spin_box->setRange(_range->first, _range->second);
65 if (_step)
66 _spin_box->setSingleStep(*_step);
67
68 GVariant *const value = _getter ? _getter() : NULL;
69
70 if (value) {
71 _spin_box->setValue(g_variant_get_double(value));
72 g_variant_unref(value);
73 }
74
75 if (auto_commit) {
76 connect(_spin_box, SIGNAL(valueChanged(double)),
77 this, SLOT(on_value_changed(double)));
78 }
79
80 return _spin_box;
81}
82
83void Double::commit()
84{

Callers

nothing calls this directly

Calls 2

setRangeMethod · 0.80
setValueMethod · 0.80

Tested by

no test coverage detected