MCPcopy Create free account
hub / github.com/analogdevicesinc/scopy / addPreferenceCheckBox

Method addPreferenceCheckBox

gui/src/preferenceshelper.cpp:58–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58QWidget *PreferencesHelper::addPreferenceCheckBox(Preferences *p, QString id, QString title, QString description,
59 QObject *parent)
60{
61 QWidget *widget = new QWidget();
62 QHBoxLayout *layout = new QHBoxLayout();
63 layout->setMargin(0);
64 layout->setSpacing(0);
65 layout->setMargin(0);
66 widget->setLayout(layout);
67
68 QWidget *infoBtn = setupDescriptionButton(id, description, parent);
69
70 SmallOnOffSwitch *pref = new SmallOnOffSwitch();
71 pref->setChecked(p->get(id).toBool());
72 parent->connect(pref, &SmallOnOffSwitch::toggled, parent, [p, id](bool b) { p->set(id, b); });
73
74 p->initDescription(id, title, description);
75
76 QSpacerItem *space = new QSpacerItem(20, 20, QSizePolicy::Fixed, QSizePolicy::Fixed);
77
78 layout->addWidget(infoBtn);
79 layout->addWidget(new QLabel(title, widget));
80 layout->addSpacerItem(space);
81 layout->addWidget(pref);
82 widget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
83
84 return widget;
85}
86
87QWidget *PreferencesHelper::addPreferenceEdit(Preferences *p, QString id, QString title, QString description,
88 QObject *parent)

Callers

nothing calls this directly

Calls 7

setCheckedMethod · 0.80
initDescriptionMethod · 0.80
setSpacingMethod · 0.45
getMethod · 0.45
connectMethod · 0.45
setMethod · 0.45
addWidgetMethod · 0.45

Tested by

no test coverage detected