| 56 | } |
| 57 | |
| 58 | QWidget *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 | |
| 87 | QWidget *PreferencesHelper::addPreferenceEdit(Preferences *p, QString id, QString title, QString description, |
| 88 | QObject *parent) |
nothing calls this directly
no test coverage detected