void TextShape::initWithXMLProperties(Canvas *canvas, const QDomElement& node, const QString& ns) { // Call equivalent superclass method. ShapeObj::initWithXMLProperties(canvas, node, ns); //QT unicodeStr = SDLGui::UTF16_fromChar(txtStr); fontSize = essentialProp<int>(node, x_fontSize, ns);; setPainterPath(buildPainterPath()); QString value = nodeAttribute(node, ns, x_label); if (!value.isNull()) { setText(value); } routerAdd(); }
void FreehandShape::initWithXMLProperties(Canvas *canvas, const QDomElement& node, const QString& ns) { // Call equivalent superclass method. ShapeObj::initWithXMLProperties(canvas, node, ns); // Read in geometry; QString value = nodeAttribute(node, ns, x_geometry); if (!value.isNull()) { QStringList strings = value.split(QRegExp("[, ]"), QString::SkipEmptyParts); int stringIndex = 0; // Read the number of points. int strokes = strings.at(stringIndex++).toInt(); bool first = true; for (int c = 0; c < strokes; ++c) { int points = strings.at(stringIndex++).toInt(); if (first == false) { // XXX: hint vector size? _geometry.startNewStroke(); } for (int p = 0; p < points; ++p) { double x = strings.at(stringIndex++).toDouble(); double y = strings.at(stringIndex++).toDouble(); unsigned int t = strings.at(stringIndex++).toUInt(); _geometry.addPoint(x, y, t); } first = false; } double initOffX = strings.at(stringIndex++).toDouble(); double initOffY = strings.at(stringIndex++).toDouble(); _geometry.setInitialOffset(initOffX, initOffY); } setPainterPath(buildPainterPath()); }