QDomElement StylusItem::serialize(QDomDocument &document, QPoint const &topLeftPicture) { QDomElement stylusNode = setPenBrushToDoc(document, "stylus"); foreach (AbstractItem *abstractItem, mAbstractListLine) { LineItem *line = dynamic_cast<LineItem *>(abstractItem); line->setSerializeName("stylusLine"); QDomElement item = line->serialize(document, topLeftPicture - QPoint(static_cast<int>(scenePos().x()), static_cast<int>(scenePos().y()))); stylusNode.appendChild(item); }
void StylusItem::addLine(qreal x2, qreal y2) { mX2 = x2; mY2 = y2; LineItem *line = new LineItem(QPointF(mTmpX1, mTmpY1), QPointF(mX2, mY2)); line->setPen(mPen); line->setBrush(mBrush); line->setSerializeName(QString("stylusLine")); mAbstractListLine.push_back(line); mTmpX1 = mX2; mTmpY1 = mY2; }