HAL
settings_widget_checkbox.cpp
Go to the documentation of this file.
2 
3 #include <QFormLayout>
4 #include <QHBoxLayout>
5 #include <QLabel>
6 #include <QPair>
7 
8 #include <QCheckBox>
9 #include <QStringList>
10 
11 #include "gui/gui_globals.h"
13 
14 namespace hal
15 {
17  : SettingsWidget(item, parent)
18  {
21 
22  m_check_box = new QCheckBox(QString("set/unset"), this);
23  connect(m_check_box, &QCheckBox::clicked, this, &SettingsWidgetCheckbox::on_state_changed);
24 
25 
26  layout->addWidget(m_check_box);
27 
28  /*
29  QLabel* label = new QLabel(item->description(),this);
30  layout->addWidget(label);
31  */
32  load(item->value());
33 
34  //connect(this, &SettingsWidgetCheckbox::valueChanged, item, SettingsItemCheckbox::
35  }
36 
38  {
39  m_check_box->setChecked(value.toBool());
40  }
41 
43  {
44  return QVariant(m_check_box->isChecked());
45  }
46 
47  void SettingsWidgetCheckbox::on_state_changed(bool checked)
48  {
49  Q_UNUSED(checked);
50 
52  }
53 }
A SettingsItem representing a Checkbox.
virtual QVariant value() const override
virtual QVariant value() override
virtual void load(const QVariant &value) override
SettingsWidgetCheckbox(SettingsItemCheckbox *item, QWidget *parent=nullptr)
The base class for all specific SettingsWidgets.
QBoxLayout * mContainer
void setChecked(bool)
void clicked(bool checked)
void addLayout(QLayout *layout, int stretch)
void addWidget(QWidget *w)
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
bool toBool() const const
QLayout * layout() const const