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


C++ QCanvasItemList类代码示例

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


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

示例1: canvas

void SkeletonCanvasView::contentsMousePressEvent( QMouseEvent *e )
{
    // a list of all items underneath the mouse when it was pressed
    QCanvasItemList list = canvas()->collisions(e->pos());

    // the RTTI of a QCanvasSprite is 1...
    if ( !list.isEmpty() && list.first()->rtti() == 1 )
    {
        // ...which means we can safely cast to a Bone pointer.
        Bone *sphere = (Bone*)list.first();

        // hit() will return false it we hit the transparent corners
        // of the planet image.
        if ( sphere->hit( e->pos() ) )
        {
            Moving = sphere;
            canvas()->setAdvancePeriod( -1 );  // stops the animation when dragging
            MovingStart = e->pos();
            Moving->setZ( 2 );  // raises the current item above other items when dragging.
            // (This in not really necessary here, since we have just one item.)

            Timer->start( 10, false );  // start the timer
        }
    }

}
开发者ID:BackupTheBerlios,项目名称:lesetaje-svn,代码行数:26,代码来源:skeletoncanvasview.cpp

示例2: collisions

QCanvasItem * UmlCanvas::collision(const QPoint & p, int except) const {
  QCanvasItemList l = collisions(p);
  QCanvasItemList::ConstIterator it;
  QCanvasItemList::ConstIterator end = l.end();
  ArrowCanvas * arrow = 0;
  
  for (it = l.begin(); it != end; ++it)
    if (((*it)->visible()) && // at least not deleted
	!isa_alien(*it) &&
	!isa_col_msg_dirs(*it)) {
    int k = (*it)->rtti();
    
    if (k != except) {
      switch (k) {
      case RTTI_ARROW:
	if (arrow == 0)
	  arrow = (ArrowCanvas *) *it;
	break;
      case RTTI_LABEL:
	return (arrow == 0) ? *it : arrow;
      default:
      // isa DiagramCanvas
      return ((arrow == 0) || 
	      (small_element(((DiagramCanvas *) *it)->rect()) &&
	       ((DiagramCanvas *) *it)->attached_to(arrow)))
	? *it : arrow;
      }
    }
  }
  
  return arrow;
}
开发者ID:,项目名称:,代码行数:32,代码来源:

示例3: redraw

void Canvas::redraw()
{
    QCanvasItemList l = m_canvas->allItems();    
    for(QCanvasItemList::iterator i = l.begin(),
            e = l.end(); i != e; ++i)
    {
        delete *i;
    }
    
    unsigned count = 0;
    for (unsigned x = 10; x < 4*1600; x += 20)
        for (unsigned y = 10; y < 600; y += 20) {
            QCanvasRectangle* r = new QCanvasRectangle(x, y, 10, 10, m_canvas);
            r->setPen(m_pen);
            r->setBrush(m_brushes[m_current_brush]);
            r->show();  
            ++count;  
            QCanvasText* t = new QCanvasText("D", m_canvas);
            t->move(x, y);
            t->show();
            ++count;
        }
    
    (new QCanvasText(QString::number(count), m_canvas))->show();
    m_canvas->setAllChanged();

}
开发者ID:Albermg7,项目名称:boost,代码行数:27,代码来源:canvas.cpp

示例4: select

void ItemDocument::select(const QCanvasItemList &list) {
	const QCanvasItemList::const_iterator end = list.end();

	for (QCanvasItemList::const_iterator it = list.begin(); it != end; ++it)
		selectList()->addQCanvasItem(*it);

	selectList()->setSelected(true);
}
开发者ID:zoltanp,项目名称:ktechlab-0.3,代码行数:8,代码来源:itemdocument.cpp

示例5: canvas

void k9MenuEditor::clear() {
    QCanvasItemList list = canvas()->allItems();
    QCanvasItemList::Iterator it = list.begin();
    for (; it != list.end(); ++it) {
        if ( *it )
            delete *it;
    }
}
开发者ID:mitch000001,项目名称:k9copy,代码行数:8,代码来源:k9menueditor.cpp

示例6: switch

	void KviCanvasView::contentsMouseMoveEvent(QMouseEvent *e)
	{
	//	QPoint p = inverseWorldMatrix().map(e->pos());
		QPoint p = e->pos();
		if(e->state() & Qt::LeftButton)
		{
			if((m_dragMode != None) && (m_pSelectedItem))
			{
				if(m_pSelectedItem->isEnabled())m_pSelectedItem->setEnabled(false);
				switch(KVI_CANVAS_RTTI_CONTROL_TYPE(m_pSelectedItem))
				{
					case KVI_CANVAS_RTTI_CONTROL_TYPE_RECTANGLE:
						dragRectangle((KviCanvasRectangleItem *)m_pSelectedItem,p);
					break;
					case KVI_CANVAS_RTTI_CONTROL_TYPE_LINE:
						dragLine((KviCanvasLine *)m_pSelectedItem,p);
					break;
					case KVI_CANVAS_RTTI_CONTROL_TYPE_POLYGON:
						dragPolygon((KviCanvasPolygon *)m_pSelectedItem,p);
					break;
				}
			}
		} else {
			// Without buttons
			if(m_state == Idle)
			{
				QCanvasItemList l = canvas()->collisions(p);
				QCanvasItemList::Iterator it = l.begin();

				if(it != l.end())
				{
					// Got an item
					QCanvasItem * hit = (QCanvasItem *)*it;
					// Now find the point on that we have clicked it
					if(hit == m_pSelectedItem)
					{
						switch(KVI_CANVAS_RTTI_CONTROL_TYPE(m_pSelectedItem))
						{
							case KVI_CANVAS_RTTI_CONTROL_TYPE_RECTANGLE:
								beginDragRectangle((KviCanvasRectangleItem *)m_pSelectedItem,p);
							break;
							case KVI_CANVAS_RTTI_CONTROL_TYPE_LINE:
								beginDragLine((KviCanvasLine *)m_pSelectedItem,p);
							break;
							case KVI_CANVAS_RTTI_CONTROL_TYPE_POLYGON:
								beginDragPolygon((KviCanvasPolygon *)m_pSelectedItem,p);
							break;
						}
					}
					else if(m_dragMode != None)setCursor(arrowCursor);
				} else {
					if(m_dragMode != None)setCursor(arrowCursor);
				}
			}
		}
	}
开发者ID:netrunner-debian-kde-extras,项目名称:kvirc,代码行数:56,代码来源:canvaswidget.cpp

示例7: setSVGExport

void ItemDocument::setSVGExport(bool svgExport) {
	// Find any items and tell them not to draw buttons or sliders
	QCanvasItemList items = m_canvas->allItems();
	const QCanvasItemList::iterator end = items.end();

	for (QCanvasItemList::Iterator it = items.begin(); it != end; ++it) {
		if (CNItem * cnItem = dynamic_cast<CNItem*>(*it))
			cnItem->setDrawWidgets(!svgExport);
	}
}
开发者ID:zoltanp,项目名称:ktechlab-0.3,代码行数:10,代码来源:itemdocument.cpp

示例8: canvas

void CanvasView::contentsMousePressEvent( QMouseEvent *e )
{
    QCanvasItemList list = canvas()->collisions( e->pos() );
    for ( QCanvasItemList::iterator it = list.begin(); it != list.end(); ++it )
	if ( (*it)->rtti() == CanvasText::CANVAS_TEXT ) {
	    m_movingItem = *it;
	    m_pos = e->pos();
	    return;
	}
    m_movingItem = 0;
}
开发者ID:AliYousuf,项目名称:univ-aca-mips,代码行数:11,代码来源:canvasview.cpp

示例9:

void
KTreemapView::deleteAllItems( QCanvas * canvas )
{
    if ( ! canvas )
	return;

    QCanvasItemList all = canvas->allItems();

    for ( QCanvasItemList::Iterator it = all.begin(); it != all.end(); ++it )
	delete *it;
}
开发者ID:gregp-forks,项目名称:kdirstat,代码行数:11,代码来源:ktreemapview.cpp

示例10: getCanvas

int LinePath::onLinePath( const QPoint &position ) {
    QCanvasItemList list = getCanvas() -> collisions( position );
    int index = -1;

    QCanvasItemList::iterator end(list.end());
    for(QCanvasItemList::iterator item_it(list.begin()); item_it != end; ++item_it ) {
        if( ( index = m_LineList.findRef( (QCanvasLine*)*item_it ) ) != -1 )
            break;
    }//end for
    return index;
}
开发者ID:serghei,项目名称:kde-kdesdk,代码行数:11,代码来源:linepath.cpp

示例11: canvas

void SpielFeldView::showGame()
{
  QCanvasItemList list = canvas()->allItems();
  QCanvasItemList::Iterator it = list.begin();
  for(; it != list.end(); ++it)
  {
    (*it)->show();
  }

  _canvas->setAllChanged();
  _canvas->update();
}
开发者ID:eglimi,项目名称:netbomb,代码行数:12,代码来源:spielfeldview.cpp

示例12: selectItems

void ossimQtVceCanvasWidget::selectItems(QCanvasItemList& selectionList)
{
   if(selectionList.size())
   {
      for(int idx = 0; idx < (int)selectionList.size(); ++idx)
      {
         theSelectedItems.push_back(selectionList[idx]);
         selectionList[idx]->setSelected(true);
         emit itemSelected(selectionList[idx]);
      }
   }
}
开发者ID:star-labs,项目名称:star_ossim,代码行数:12,代码来源:ossimQtVceCanvasWidget.cpp

示例13: clearCanvas

void ScheduleDialog::clearCanvas()
{
    QCanvasItemList::iterator it;
    QCanvasItemList canvasItems = canvas->allItems();
    for (it = canvasItems.begin(); it != canvasItems.end(); ++it) {
        delete *it;
    }

    canvasItems = labelCanvas->allItems();
    for (it = canvasItems.begin(); it != canvasItems.end(); ++it) {
        delete *it;
    }
}
开发者ID:BackupTheBerlios,项目名称:poa,代码行数:13,代码来源:scheduledialog.cpp

示例14: inverseWorldMatrix

void CNavigationDiagramView::contentsMousePressEvent(QMouseEvent * e){
	QWMatrix matrix = inverseWorldMatrix();
	int xPos = matrix.m11() * e->pos().x() + matrix.m12() * e->pos().y();
	int yPos = matrix.m21() * e->pos().x() + matrix.m22() * e->pos().y();
	QPoint p(xPos, yPos);

	QCanvasItemList items = canvas()->collisions(p);
	if (items.empty()){
		setActiveItem(0);
	}else{
		setActiveItem(*items.begin());
	}
	m_qLastPos = e->pos();
}
开发者ID:ufz-vislab,项目名称:vislab,代码行数:14,代码来源:NavigationDiagramView.cpp

示例15: buildXML

void ReportSection::buildXML(QDomDocument & doc, QDomElement & section) {
    //qDebug("ReportSection::buildXML()");
    float f = (float)canvas->height() / dpiY * 100.0;
    f = ((f - (int)f) > .5 ? (int)f : (int)f + 1);
    QDomElement height = doc.createElement("height");
    height.appendChild(doc.createTextNode(QString::number((int)f)));
    section.appendChild(height);

    // now get a list of all the QCanvasItems on this canvas and output them.
    QCanvasItemList list = canvas->allItems();
    for(QCanvasItemList::iterator it = list.begin();
          it != list.end(); it++ ) {
          ReportEntity::buildXML((*it),doc,section);
    }
}
开发者ID:Wushaowei001,项目名称:xtuple,代码行数:15,代码来源:reportsection.cpp


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