| 197 | } |
| 198 | |
| 199 | Type type(const Key &key) |
| 200 | { |
| 201 | bool exists; |
| 202 | auto skey = QVariant::fromValue(key).toString(); |
| 203 | auto variant = _conf->getVariant(skey, true, &exists); |
| 204 | |
| 205 | if(!exists) |
| 206 | { |
| 207 | return Type::Unknown; |
| 208 | } |
| 209 | |
| 210 | auto type = QtCompat::variantTypeId(variant); |
| 211 | if(type == QMetaType::Int) |
| 212 | { |
| 213 | return Type::Int32; |
| 214 | } |
| 215 | if(type == QMetaType::Double) |
| 216 | { |
| 217 | return Type::Float; |
| 218 | } |
| 219 | if(type == QMetaType::Float) |
| 220 | { |
| 221 | return Type::Float; |
| 222 | } |
| 223 | if(type == QMetaType::QString) |
| 224 | { |
| 225 | return Type::String; |
| 226 | } |
| 227 | if(type == QMetaType::Bool) |
| 228 | { |
| 229 | return Type::Boolean; |
| 230 | } |
| 231 | |
| 232 | Log::error("Unknown type"); |
| 233 | return Type::Unknown; |
| 234 | } |
| 235 | |
| 236 | |
| 237 | QString serialize() |
no test coverage detected