1171 |
Qt::DisplayRole).value<DeviceParameterRow>(); |
Qt::DisplayRole).value<DeviceParameterRow>(); |
1172 |
|
|
1173 |
const bool bEnabled = (r.alive) ? !r.param.fix : true; |
const bool bEnabled = (r.alive) ? !r.param.fix : true; |
1174 |
|
const bool bFix = r.param.fix; |
1175 |
|
|
1176 |
QString val = (r.alive) ? r.param.value : r.param.defaultv; |
QString val = (r.alive) ? r.param.value : r.param.defaultv; |
1177 |
|
|
1184 |
if (val != QString::null) |
if (val != QString::null) |
1185 |
pCheckBox->setChecked(val.toLower() == "true"); |
pCheckBox->setChecked(val.toLower() == "true"); |
1186 |
pCheckBox->setEnabled(bEnabled); |
pCheckBox->setEnabled(bEnabled); |
1187 |
|
pCheckBox->setCheckable(!bFix); |
1188 |
return pCheckBox; |
return pCheckBox; |
1189 |
} else if (r.param.possibilities.count() > 0) { |
} else if (r.param.possibilities.count() > 0) { |
1190 |
QStringList opts = r.param.possibilities; |
QStringList opts = r.param.possibilities; |
1197 |
else |
else |
1198 |
pComboBox->setCurrentIndex(pComboBox->findText(val)); |
pComboBox->setCurrentIndex(pComboBox->findText(val)); |
1199 |
pComboBox->setEnabled(bEnabled); |
pComboBox->setEnabled(bEnabled); |
1200 |
|
pComboBox->setEditable(!bFix); |
1201 |
return pComboBox; |
return pComboBox; |
1202 |
} else if (r.param.type == LSCP_TYPE_INT && bEnabled) { |
} else if (r.param.type == LSCP_TYPE_INT && bEnabled) { |
1203 |
QSpinBox *pSpinBox = new QSpinBox(pParent); |
QSpinBox *pSpinBox = new QSpinBox(pParent); |
1210 |
r.param.range_max.toInt() : (1 << 24) // or better a higher default max value ? |
r.param.range_max.toInt() : (1 << 24) // or better a higher default max value ? |
1211 |
); |
); |
1212 |
pSpinBox->setValue(val.toInt()); |
pSpinBox->setValue(val.toInt()); |
1213 |
|
pSpinBox->setReadOnly(bFix); |
1214 |
return pSpinBox; |
return pSpinBox; |
1215 |
} else if (bEnabled) { |
} else if (bEnabled) { |
1216 |
QLineEdit *pLineEdit = new QLineEdit(val, pParent); |
QLineEdit *pLineEdit = new QLineEdit(val, pParent); |
1217 |
|
pLineEdit->setReadOnly(bFix); |
1218 |
return pLineEdit; |
return pLineEdit; |
1219 |
} else { |
} else { |
1220 |
QLabel *pLabel = new QLabel(val, pParent); |
QLabel *pLabel = new QLabel(val, pParent); |