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


C++ QQuickItemPrivate::itemToWindowTransform方法代码示例

本文整理汇总了C++中QQuickItemPrivate::itemToWindowTransform方法的典型用法代码示例。如果您正苦于以下问题:C++ QQuickItemPrivate::itemToWindowTransform方法的具体用法?C++ QQuickItemPrivate::itemToWindowTransform怎么用?C++ QQuickItemPrivate::itemToWindowTransform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QQuickItemPrivate的用法示例。


在下文中一共展示了QQuickItemPrivate::itemToWindowTransform方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: renderScene

void QuickInspector::renderScene()
{
  if (!m_clientConnected || !m_window)
    return;

  QImage img;
  if (m_window->windowState() != Qt::WindowMinimized)
    img = m_window->grabWindow();
  if (m_currentItem) {
    QQuickItem *parent = m_currentItem->parentItem();

    QVariantMap geometryData;
    if (parent)
      geometryData.insert("itemRect", m_currentItem->parentItem()->mapRectToScene(QRectF(m_currentItem->x(), m_currentItem->y(), m_currentItem->width(), m_currentItem->height())));
    else
      geometryData.insert("itemRect", QRectF(0, 0, m_currentItem->width(), m_currentItem->height()));
    geometryData.insert("boundingRect", m_currentItem->mapRectToScene(m_currentItem->boundingRect()));
    geometryData.insert("childrenRect", m_currentItem->mapRectToScene(m_currentItem->childrenRect()));
    geometryData.insert("transformOriginPoint", m_currentItem->mapToScene(m_currentItem->transformOriginPoint()));
#ifdef HAVE_SG_INSPECTOR
    QQuickAnchors *anchors = m_currentItem->property("anchors").value<QQuickAnchors*>();
    if (anchors) {
      QQuickAnchors::Anchors usedAnchors = anchors->usedAnchors();
      geometryData.insert("left", (bool)(usedAnchors & QQuickAnchors::LeftAnchor) || anchors->fill());
      geometryData.insert("right", (bool)(usedAnchors & QQuickAnchors::RightAnchor) || anchors->fill());
      geometryData.insert("top", (bool)(usedAnchors & QQuickAnchors::TopAnchor) || anchors->fill());
      geometryData.insert("bottom", (bool)(usedAnchors & QQuickAnchors::BottomAnchor) || anchors->fill());
      geometryData.insert("baseline", (bool)(usedAnchors & QQuickAnchors::BaselineAnchor));
      geometryData.insert("horizontalCenter", (bool)(usedAnchors & QQuickAnchors::HCenterAnchor) || anchors->centerIn());
      geometryData.insert("verticalCenter", (bool)(usedAnchors & QQuickAnchors::VCenterAnchor) || anchors->centerIn());
      geometryData.insert("leftMargin", anchors->leftMargin());
      geometryData.insert("rightMargin", anchors->rightMargin());
      geometryData.insert("topMargin", anchors->topMargin());
      geometryData.insert("bottomMargin", anchors->bottomMargin());
      geometryData.insert("horizontalCenterOffset", anchors->horizontalCenterOffset());
      geometryData.insert("verticalCenterOffset", anchors->verticalCenterOffset());
      geometryData.insert("baselineOffset", anchors->baselineOffset());
      geometryData.insert("margins", anchors->margins());
    }
#endif
    geometryData.insert("x", m_currentItem->x());
    geometryData.insert("y", m_currentItem->y());
#ifdef HAVE_SG_INSPECTOR
    QQuickItemPrivate *itemPriv = QQuickItemPrivate::get(m_currentItem);
    geometryData.insert("transform", itemPriv->itemToWindowTransform());
    if (parent) {
      QQuickItemPrivate *parentPriv = QQuickItemPrivate::get(parent);
      geometryData.insert("parentTransform", parentPriv->itemToWindowTransform());
    }
#endif

    emit sceneRendered(img, geometryData);
  } else {
    emit sceneRendered(img, QVariantMap());
  }

}
开发者ID:motto0808,项目名称:GammaRay,代码行数:57,代码来源:quickinspector.cpp


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