本文整理汇总了C++中QTransform::toAffine方法的典型用法代码示例。如果您正苦于以下问题:C++ QTransform::toAffine方法的具体用法?C++ QTransform::toAffine怎么用?C++ QTransform::toAffine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTransform
的用法示例。
在下文中一共展示了QTransform::toAffine方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: matrixForElement
QMatrix QSvgTinyDocument::matrixForElement(const QString &id) const
{
QSvgNode *node = scopeNode(id);
if (!node) {
qDebug("Couldn't find node %s. Skipping rendering.", qPrintable(id));
return QMatrix();
}
QTransform t;
node = node->parent();
while (node) {
if (node->m_style.transform)
t *= node->m_style.transform->qtransform();
node = node->parent();
}
return t.toAffine();
}
示例2: transformItem
void SchematicTextLayerKinPaletteItem::transformItem(const QTransform & currTransf, bool includeRatsnest) {
Q_UNUSED(currTransf);
Q_UNUSED(includeRatsnest);
if (m_textThings.count() == 0) {
initTextThings();
}
double rotation;
QTransform chiefTransform = layerKinChief()->transform(); // assume chief already has rotation
bool isFlipped = GraphicsUtils::isFlipped(chiefTransform.toAffine(), rotation);
QString svg;
if (isFlipped) {
svg = makeFlipTextSvg();
}
if (svg.isEmpty()) {
svg = this->property("textSvg").toByteArray();
}
if (rotation >= 135 && rotation <= 225) {
svg = vflip(svg, isFlipped);
}
reloadRenderer(svg, true);
QPointF p = layerKinChief()->sceneBoundingRect().topLeft();
QTransform transform;
QRectF bounds = boundingRect();
transform.translate(bounds.width() / 2, bounds.height() / 2);
transform.rotate(rotation);
transform.translate(bounds.width() / -2, bounds.height() / -2);
this->setTransform(transform);
//QMatrix m1 = chiefTransform.toAffine();
//layerKinChief()->debugInfo("chief " + TextUtils::svgMatrix(m1));
//m1 = transform.toAffine();
//debugInfo("\t " + TextUtils::svgMatrix(m1));
}
示例3: drawOverlay
void OverlayScene::drawOverlay(QPainter *painter, QRectF exposed) {
QList<QGraphicsItem *> items = this->items();
QVarLengthArray<QGraphicsItem *, 5> overlayItems(items.size());
QVarLengthArray<QStyleOptionGraphicsItem, 5> options(items.size());
QLineF v1(0, 0, 1, 0);
QLineF v2(0, 0, 0, 1);
for (int i = 0; i < items.size(); i++) {
QTransform tform = painter->worldTransform(); // should be identity
if (items[i]->flags() & QGraphicsItem::ItemIgnoresTransformations)
tform = items[i]->deviceTransform(tform);
else tform = items[i]->sceneTransform() * tform;
options[i].exposedRect = tform.inverted().mapRect(exposed);
#if QT_VERSION < 0x40600
options[i].rect = items[i]->boundingRect().toRect();
options[i].matrix = tform.toAffine();
options[i].levelOfDetail = qSqrt(tform.map(v1).length() *
tform.map(v2).length());
#endif
overlayItems[i] = items[i];
}
drawItems(painter, items.size(), overlayItems.data(), options.data(),
_view->viewport());
}