本文整理汇总了C++中KoShapeLoadingContext::updateShape方法的典型用法代码示例。如果您正苦于以下问题:C++ KoShapeLoadingContext::updateShape方法的具体用法?C++ KoShapeLoadingContext::updateShape怎么用?C++ KoShapeLoadingContext::updateShape使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KoShapeLoadingContext
的用法示例。
在下文中一共展示了KoShapeLoadingContext::updateShape方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadOdf
bool KoConnectionShape::loadOdf(const KoXmlElement & element, KoShapeLoadingContext &context)
{
Q_D(KoConnectionShape);
loadOdfAttributes(element, context, OdfMandatories | OdfCommonChildElements | OdfAdditionalAttributes);
QString type = element.attributeNS(KoXmlNS::draw, "type", "standard");
if (type == "lines")
d->connectionType = Lines;
else if (type == "line")
d->connectionType = Straight;
else if (type == "curve")
d->connectionType = Curve;
else
d->connectionType = Standard;
// reset connection point indices
d->connectionPointId1 = -1;
d->connectionPointId2 = -1;
// reset connected shapes
d->shape1 = 0;
d->shape2 = 0;
if (element.hasAttributeNS(KoXmlNS::draw, "start-shape")) {
d->connectionPointId1 = element.attributeNS(KoXmlNS::draw, "start-glue-point", QString()).toInt();
QString shapeId1 = element.attributeNS(KoXmlNS::draw, "start-shape", QString());
kDebug(30006) << "references start-shape" << shapeId1 << "at glue-point" << d->connectionPointId1;
d->shape1 = context.shapeById(shapeId1);
if (d->shape1) {
kDebug(30006) << "start-shape was already loaded";
d->shape1->addDependee(this);
if (d->shape1->hasConnectionPoint(d->connectionPointId1)) {
kDebug(30006) << "connecting to start-shape";
d->handles[StartHandle] = d->shape1->absoluteTransformation(0).map(d->shape1->connectionPoint(d->connectionPointId1).position);
kDebug(30006) << "start handle position =" << d->handles[StartHandle];
}
} else {
kDebug(30006) << "start-shape not loaded yet, deferring connection";
context.updateShape(shapeId1, new KoConnectionShapeLoadingUpdater(this, KoConnectionShapeLoadingUpdater::First));
}
} else {
d->handles[StartHandle].setX(KoUnit::parseValue(element.attributeNS(KoXmlNS::svg, "x1", QString())));
d->handles[StartHandle].setY(KoUnit::parseValue(element.attributeNS(KoXmlNS::svg, "y1", QString())));
}
if (element.hasAttributeNS(KoXmlNS::draw, "end-shape")) {
d->connectionPointId2 = element.attributeNS(KoXmlNS::draw, "end-glue-point", "").toInt();
QString shapeId2 = element.attributeNS(KoXmlNS::draw, "end-shape", "");
kDebug(30006) << "references end-shape " << shapeId2 << "at glue-point" << d->connectionPointId2;
d->shape2 = context.shapeById(shapeId2);
if (d->shape2) {
kDebug(30006) << "end-shape was already loaded";
d->shape2->addDependee(this);
if (d->shape2->hasConnectionPoint(d->connectionPointId2)) {
kDebug(30006) << "connecting to end-shape";
d->handles[EndHandle] = d->shape2->absoluteTransformation(0).map(d->shape2->connectionPoint(d->connectionPointId2).position);
kDebug(30006) << "end handle position =" << d->handles[EndHandle];
}
} else {
kDebug(30006) << "end-shape not loaded yet, deferring connection";
context.updateShape(shapeId2, new KoConnectionShapeLoadingUpdater(this, KoConnectionShapeLoadingUpdater::Second));
}
} else {
d->handles[EndHandle].setX(KoUnit::parseValue(element.attributeNS(KoXmlNS::svg, "x2", QString())));
d->handles[EndHandle].setY(KoUnit::parseValue(element.attributeNS(KoXmlNS::svg, "y2", QString())));
}
QString skew = element.attributeNS(KoXmlNS::draw, "line-skew", QString());
QStringList skewValues = skew.simplified().split(' ', QString::SkipEmptyParts);
// TODO apply skew values once we support them
// load the path data if there is any
d->hasCustomPath = element.hasAttributeNS(KoXmlNS::svg, "d");
if (d->hasCustomPath) {
KoPathShapeLoader loader(this);
loader.parseSvg(element.attributeNS(KoXmlNS::svg, "d"), true);
if (m_subpaths.size() > 0) {
QRectF viewBox = loadOdfViewbox(element);
if (viewBox.isEmpty()) {
// there should be a viewBox to transform the path data
// if there is none, use the bounding rectangle of the parsed path
viewBox = outline().boundingRect();
}
// convert path to viewbox coordinates to have a bounding rect of (0,0 1x1)
// which can later be fitted back into the target rect once we have all
// the required information
QTransform viewMatrix;
viewMatrix.scale(viewBox.width() ? static_cast<qreal>(1.0) / viewBox.width() : 1.0,
viewBox.height() ? static_cast<qreal>(1.0) / viewBox.height() : 1.0);
viewMatrix.translate(-viewBox.left(), -viewBox.top());
d->map(viewMatrix);
// trigger finishing the connections in case we have all data
// otherwise it gets called again once the shapes we are
// connected to are loaded
}
else {
d->hasCustomPath = false;
}
finishLoadingConnection();
} else {
//.........这里部分代码省略.........