本文整理汇总了C++中QmlItemNode::instanceSceneTransform方法的典型用法代码示例。如果您正苦于以下问题:C++ QmlItemNode::instanceSceneTransform方法的具体用法?C++ QmlItemNode::instanceSceneTransform怎么用?C++ QmlItemNode::instanceSceneTransform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QmlItemNode
的用法示例。
在下文中一共展示了QmlItemNode::instanceSceneTransform方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createParentAnchorPoint
static QPointF createParentAnchorPoint(const QmlItemNode &parentQmlItemNode, AnchorLine::Type anchorLineType, const QmlItemNode &childQmlItemNode)
{
QRectF parentBoundingRect = parentQmlItemNode.instanceSceneTransform().mapRect(parentQmlItemNode.instanceBoundingRect().adjusted(0., 0., 1., 1.));
QRectF childBoundingRect = childQmlItemNode.instanceSceneTransform().mapRect(childQmlItemNode.instanceBoundingRect().adjusted(0., 0., 1., 1.));
QPointF anchorPoint;
switch (anchorLineType) {
case AnchorLine::Top:
anchorPoint = QPointF(childBoundingRect.center().x(), parentBoundingRect.top());
break;
case AnchorLine::Bottom:
anchorPoint = QPointF(childBoundingRect.center().x(), parentBoundingRect.bottom());
break;
case AnchorLine::Left:
anchorPoint = QPointF(parentBoundingRect.left(), childBoundingRect.center().y());
break;
case AnchorLine::Right:
anchorPoint = QPointF(parentBoundingRect.right(), childBoundingRect.center().y());
break;
default:
break;
}
return anchorPoint;
}
示例2: createAnchorPoint
static QPointF createAnchorPoint(const QmlItemNode &qmlItemNode, AnchorLine::Type anchorLineType)
{
QRectF boundingRect = qmlItemNode.instanceBoundingRect().adjusted(0., 0., 1., 1.);
QPointF anchorPoint;
switch (anchorLineType) {
case AnchorLine::Top:
anchorPoint = QPointF(boundingRect.center().x(), boundingRect.top());
break;
case AnchorLine::Bottom:
anchorPoint = QPointF(boundingRect.center().x(), boundingRect.bottom());
break;
case AnchorLine::Left:
anchorPoint = QPointF(boundingRect.left(), boundingRect.center().y());
break;
case AnchorLine::Right:
anchorPoint = QPointF(boundingRect.right(), boundingRect.center().y());
break;
default:
break;
}
return qmlItemNode.instanceSceneTransform().map(anchorPoint);
}
示例3: bottomLine
QLineF bottomLine(const QmlItemNode &qmlItemNode)
{
QRectF rectangle = qmlItemNode.instanceSceneTransform().mapRect(qmlItemNode.instanceBoundingRect()).adjusted(1, 0, 0, 0);
return QLineF(rectangle.bottomLeft(), rectangle.bottomRight());
}