当前位置: 首页>>代码示例>>C++>>正文


C++ QmlItemNode::instanceSceneTransform方法代码示例

本文整理汇总了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;
}
开发者ID:ProDataLab,项目名称:qt-creator,代码行数:26,代码来源:anchorindicatorgraphicsitem.cpp

示例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);
}
开发者ID:ProDataLab,项目名称:qt-creator,代码行数:25,代码来源:anchorindicatorgraphicsitem.cpp

示例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());
}
开发者ID:darksylinc,项目名称:qt-creator,代码行数:6,代码来源:bindingindicator.cpp


注:本文中的QmlItemNode::instanceSceneTransform方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。