Load from XML
| 472 | |
| 473 | //! Load from XML |
| 474 | bool DatapickerPoint::load(XmlStreamReader* reader, bool preview) { |
| 475 | Q_D(DatapickerPoint); |
| 476 | |
| 477 | if (!readBasicAttributes(reader)) |
| 478 | return false; |
| 479 | |
| 480 | QXmlStreamAttributes attribs; |
| 481 | QString str; |
| 482 | |
| 483 | while (!reader->atEnd()) { |
| 484 | reader->readNext(); |
| 485 | if (reader->isEndElement() && reader->name() == QStringLiteral("datapickerPoint")) |
| 486 | break; |
| 487 | |
| 488 | if (!reader->isStartElement()) |
| 489 | continue; |
| 490 | |
| 491 | if (!preview && reader->name() == QStringLiteral("geometry")) { |
| 492 | attribs = reader->attributes(); |
| 493 | |
| 494 | str = attribs.value(QStringLiteral("x")).toString(); |
| 495 | if (str.isEmpty()) |
| 496 | reader->raiseMissingAttributeWarning(QStringLiteral("x")); |
| 497 | else |
| 498 | d->position.setX(str.toDouble()); |
| 499 | |
| 500 | str = attribs.value(QStringLiteral("y")).toString(); |
| 501 | if (str.isEmpty()) |
| 502 | reader->raiseMissingAttributeWarning(QStringLiteral("y")); |
| 503 | else |
| 504 | d->position.setY(str.toDouble()); |
| 505 | } else if (!preview && reader->name() == QStringLiteral("errorBar")) { |
| 506 | attribs = reader->attributes(); |
| 507 | |
| 508 | str = attribs.value(QStringLiteral("plusDeltaXPos_x")).toString(); |
| 509 | if (str.isEmpty()) |
| 510 | reader->raiseMissingAttributeWarning(QStringLiteral("plusDeltaXPos_x")); |
| 511 | else |
| 512 | d->plusDeltaXPos.setX(str.toDouble()); |
| 513 | |
| 514 | str = attribs.value(QStringLiteral("plusDeltaXPos_y")).toString(); |
| 515 | if (str.isEmpty()) |
| 516 | reader->raiseMissingAttributeWarning(QStringLiteral("plusDeltaXPos_y")); |
| 517 | else |
| 518 | d->plusDeltaXPos.setY(str.toDouble()); |
| 519 | |
| 520 | str = attribs.value(QStringLiteral("minusDeltaXPos_x")).toString(); |
| 521 | if (str.isEmpty()) |
| 522 | reader->raiseMissingAttributeWarning(QStringLiteral("minusDeltaXPos_x")); |
| 523 | else |
| 524 | d->minusDeltaXPos.setX(str.toDouble()); |
| 525 | |
| 526 | str = attribs.value(QStringLiteral("minusDeltaXPos_y")).toString(); |
| 527 | if (str.isEmpty()) |
| 528 | reader->raiseMissingAttributeWarning(QStringLiteral("minusDeltaXPos_y")); |
| 529 | else |
| 530 | d->minusDeltaXPos.setY(str.toDouble()); |
| 531 |
nothing calls this directly
no test coverage detected