45 #include <QHBoxLayout> 46 #include <QRadioButton> 48 #include "boolWidget.hh" 67 QHBoxLayout *hL =
new QHBoxLayout;
69 true_ =
new QRadioButton (
"True");
70 hL->addWidget (true_);
72 false_ =
new QRadioButton (
"False");
73 hL->addWidget (false_);
75 if (_hints.contains (
"default"))
76 default_ = strToBool (_hints[
"default"]);
79 true_->setChecked (
true);
81 false_->setChecked (
true);
98 return (true_->isChecked()) ?
"true" :
"false";
106 bool in = strToBool (_from);
108 true_->setChecked (
true);
110 false_->setChecked (
true);
119 true_->setChecked (
true);
121 false_->setChecked (
true);
127 bool BoolWidget::strToBool (QString _str)
129 if (_str ==
"1" || _str ==
"true" || _str ==
"True" || _str ==
"TRUE" ||
130 _str ==
"yes" || _str ==
"Yes" || _str ==
"YES")
QString toValue()
Convert current value to string.
void fromValue(QString _from)
Read value from string.
void toDefault()
Reset to default.
BoolWidget(QMap< QString, QString > &_hints, QString _typeName, QWidget *_parent=NULL)
Constructor.