51 #include <QHBoxLayout> 52 #include <QRadioButton> 54 #include "boolWidget.hh" 73 QHBoxLayout *hL =
new QHBoxLayout;
75 true_ =
new QRadioButton (
"True");
76 hL->addWidget (true_);
78 false_ =
new QRadioButton (
"False");
79 hL->addWidget (false_);
81 if (_hints.contains (
"default"))
82 default_ = strToBool (_hints[
"default"]);
85 true_->setChecked (
true);
87 false_->setChecked (
true);
104 return (true_->isChecked()) ?
"true" :
"false";
112 bool in = strToBool (_from);
114 true_->setChecked (
true);
116 false_->setChecked (
true);
125 true_->setChecked (
true);
127 false_->setChecked (
true);
133 bool BoolWidget::strToBool (QString _str)
135 if (_str ==
"1" || _str ==
"true" || _str ==
"True" || _str ==
"TRUE" ||
136 _str ==
"yes" || _str ==
"Yes" || _str ==
"YES")
BoolWidget(QMap< QString, QString > &_hints, QString _typeName, QWidget *_parent=NULL)
Constructor.
void fromValue(QString _from)
Read value from string.
QString toValue()
Convert current value to string.
void toDefault()
Reset to default.