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


C++ ListItem::setObject方法代码示例

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


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

示例1: setShape

/* Adds all groups and shapes to the tree as items. */
void PolygonView::setShape(Shape3D * shape) {
  EM_CERR("PolygonView::setShape");
  this->disableButtons();
  p_Shape = shape;
  if (shape == NULL)  return;

  ListItem * shapeitem = new ListItem(p_PolygonListView, "shape");
  shapeitem->setOpen(TRUE);

  int polyindex = 0;
  Polygon3D * poly = shape->getPolygon(polyindex);
  // all polys
  while (poly != NULL) {
    QString str;
    if (polyindex < 100 && polyindex >= 10) {
      str = "0" + QString().setNum(polyindex);
    } else if (polyindex < 10) {
      str = "00" + QString().setNum(polyindex);
    } else {
      str = QString().setNum(polyindex);
    }

    ListItem * polyitem = new ListItem(shapeitem, str + " polygon");
    polyitem->setObject(poly, LISTITEM_POLYGON);
    // hash it
    m_hPolyListItem.insert(pair<Polygon3D*, ListItem*>(poly, polyitem));
		
    polyindex++;
    poly = shape->getPolygon(polyindex);
  }
}
开发者ID:sergiomb2,项目名称:pinball-pinedit,代码行数:32,代码来源:polygonview.cpp

示例2: setPolygon

void PolygonView::setPolygon(Shape3D * shape, Polygon3D * poly) {
  EM_CERR("PolygonView::setPolygon");
  p_VertexListView->clear();
  assert(shape != NULL);
  assert(poly != NULL);
  p_Polygon = poly;

  int index = 0;
  int vtxindex = poly->getIndex(index);
  Vertex3D * vtx = shape->getVertex3D(vtxindex);
  Color * color = poly->getColor(index);
  TexCoord * texcoord = poly->getTexCoord(index);
  while (vtx != NULL) {
    assert(color != NULL);
    assert(texcoord != NULL);
    QString str = QString().setNum(index) +
      " vtx " + 
      QString().setNum(vtx->x, 'g', 2) + " " +
      QString().setNum(vtx->y, 'g', 2) + " " +
      QString().setNum(vtx->z, 'g', 2) + " " +
      " color " +
      QString().setNum(color->r, 'g', 2) + " " +
      QString().setNum(color->g, 'g', 2) + " " +
      QString().setNum(color->b, 'g', 2) + " " +
      QString().setNum(color->a, 'g', 2) + " " +
      " tex " + 
      QString().setNum(texcoord->u, 'g', 2) + " " +
      QString().setNum(texcoord->v, 'g', 2);
    ListItem * vtxitem = new ListItem(p_VertexListView, str);
    vtxitem->setObject(INT2OBJ(vtxindex), LISTITEM_VERTEX);
	
    index++;
    vtxindex = poly->getIndex(index);
    vtx = shape->getVertex3D(vtxindex);
    color = poly->getColor(index);
    texcoord = poly->getTexCoord(index);
  }
  p_VertexListView->show();
}
开发者ID:sergiomb2,项目名称:pinball-pinedit,代码行数:39,代码来源:polygonview.cpp


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