Load from XML
| 1799 | |
| 1800 | //! Load from XML |
| 1801 | bool BoxPlot::load(XmlStreamReader* reader, bool preview) { |
| 1802 | Q_D(BoxPlot); |
| 1803 | |
| 1804 | if (!readBasicAttributes(reader)) |
| 1805 | return false; |
| 1806 | |
| 1807 | QXmlStreamAttributes attribs; |
| 1808 | QString str; |
| 1809 | bool firstBackgroundRead = false; |
| 1810 | bool firstBorderLineRead = false; |
| 1811 | bool firstMedianLineRead = false; |
| 1812 | |
| 1813 | while (!reader->atEnd()) { |
| 1814 | reader->readNext(); |
| 1815 | if (reader->isEndElement() && reader->name() == QLatin1String("boxPlot")) |
| 1816 | break; |
| 1817 | |
| 1818 | if (!reader->isStartElement()) |
| 1819 | continue; |
| 1820 | |
| 1821 | if (!preview && reader->name() == QLatin1String("comment")) { |
| 1822 | if (!readCommentElement(reader)) |
| 1823 | return false; |
| 1824 | } else if (!preview && reader->name() == QLatin1String("general")) { |
| 1825 | attribs = reader->attributes(); |
| 1826 | |
| 1827 | READ_INT_VALUE("ordering", ordering, BoxPlot::Ordering); |
| 1828 | READ_INT_VALUE("orientation", orientation, BoxPlot::Orientation); |
| 1829 | READ_INT_VALUE("variableWidth", variableWidth, bool); |
| 1830 | READ_DOUBLE_VALUE("widthFactor", widthFactor); |
| 1831 | READ_INT_VALUE("notches", notchesEnabled, bool); |
| 1832 | READ_INT_VALUE("jitteringEnabled", jitteringEnabled, bool); |
| 1833 | READ_INT_VALUE_DIRECT("plotRangeIndex", m_cSystemIndex, int); |
| 1834 | |
| 1835 | READ_DOUBLE_VALUE("xMin", xMin); |
| 1836 | READ_DOUBLE_VALUE("xMax", xMax); |
| 1837 | READ_DOUBLE_VALUE("yMin", yMin); |
| 1838 | READ_DOUBLE_VALUE("yMax", yMax); |
| 1839 | READ_INT_VALUE("legendVisible", legendVisible, bool); |
| 1840 | |
| 1841 | str = attribs.value(QStringLiteral("visible")).toString(); |
| 1842 | if (str.isEmpty()) |
| 1843 | reader->raiseMissingAttributeWarning(QStringLiteral("visible")); |
| 1844 | else |
| 1845 | d->setVisible(str.toInt()); |
| 1846 | } else if (reader->name() == QLatin1String("column")) { |
| 1847 | attribs = reader->attributes(); |
| 1848 | |
| 1849 | str = attribs.value(QStringLiteral("path")).toString(); |
| 1850 | if (!str.isEmpty()) |
| 1851 | d->dataColumnPaths << str; |
| 1852 | } else if (!preview && reader->name() == QLatin1String("filling")) |
| 1853 | if (!firstBackgroundRead) { |
| 1854 | auto* background = d->backgrounds.at(0); |
| 1855 | background->load(reader, preview); |
| 1856 | firstBackgroundRead = true; |
| 1857 | } else { |
| 1858 | auto* background = d->addBackground(KConfigGroup()); |
nothing calls this directly
no test coverage detected