本文整理汇总了C++中QCanvasItemList::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ QCanvasItemList::begin方法的具体用法?C++ QCanvasItemList::begin怎么用?C++ QCanvasItemList::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QCanvasItemList
的用法示例。
在下文中一共展示了QCanvasItemList::begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
}
示例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;
}
示例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();
}
示例4: canvas
void k9MenuEditor::clear() {
QCanvasItemList list = canvas()->allItems();
QCanvasItemList::Iterator it = list.begin();
for (; it != list.end(); ++it) {
if ( *it )
delete *it;
}
}
示例5: 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);
}
示例6: contentsMouseMoveEvent
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);
}
}
}
}
示例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);
}
}
示例8: contentsMousePressEvent
void KviCanvasView::contentsMousePressEvent(QMouseEvent *e)
{
if(e->button() & Qt::LeftButton)
{
// QPoint p = inverseWorldMatrix().map(e->pos());
QPoint p = e->pos();
switch(m_state)
{
case SelectOrigin:
clearSelection();
setCursor(arrowCursor);
m_state = Idle;
insertObjectAt(p,m_objectToInsert);
canvas()->update();
break;
case Idle:
{
QCanvasItemList l = canvas()->collisions(p);
QCanvasItemList::Iterator it = l.begin();
if(it != l.end())
{
// Got an item
QCanvasItem * hit = *it;
if(hit != m_pSelectedItem)
{
// Was not selected yet
setItemSelected(hit);
canvas()->update();
}
// Now find the point on that we have clicked it
switch(KVI_CANVAS_RTTI_CONTROL_TYPE(hit))
{
case KVI_CANVAS_RTTI_CONTROL_TYPE_RECTANGLE:
beginDragRectangle(((KviCanvasRectangleItem *)hit),p);
break;
case KVI_CANVAS_RTTI_CONTROL_TYPE_LINE:
beginDragLine(((KviCanvasLine *)hit),p);
break;
case KVI_CANVAS_RTTI_CONTROL_TYPE_POLYGON:
beginDragPolygon(((KviCanvasPolygon *)hit),p,e->state() & Qt::ShiftButton,e->state() & Qt::ControlButton);
break;
}
} else {
// No item
clearSelection();
canvas()->update();
}
}
break;
}
}
}
示例9: contentsMousePressEvent
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;
}
示例10: onLinePath
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;
}
示例11:
void
KTreemapView::deleteAllItems( QCanvas * canvas )
{
if ( ! canvas )
return;
QCanvasItemList all = canvas->allItems();
for ( QCanvasItemList::Iterator it = all.begin(); it != all.end(); ++it )
delete *it;
}
示例12: showGame
void SpielFeldView::showGame()
{
QCanvasItemList list = canvas()->allItems();
QCanvasItemList::Iterator it = list.begin();
for(; it != list.end(); ++it)
{
(*it)->show();
}
_canvas->setAllChanged();
_canvas->update();
}
示例13: timerDone
void SpielFeldView::timerDone()
{
QCanvasItemList list = canvas()->allItems();
QCanvasItemList::Iterator it = list.begin();
for(; it != list.end(); ++it)
{
if((*it)->rtti() == RTTI_FLAMME)
{
(*it)->hide();
_canvas->update();
delete (*it);
}
}
}
示例14: removeItem
void SpielFeldView::removeItem(int atx, int aty)
{
// cout << "removeItem(" << atx << "," << aty << ");" << endl;
QCanvasItemList list = canvas()->allItems();
QCanvasItemList::Iterator it = list.begin();
for(; it != list.end(); ++it)
{
if( ((*it)->x() == atx*FIELD_WIDTH) && ((*it)->y() == aty*FIELD_WIDTH)
&& ((*it)->rtti() != RTTI_FIGUR) && ((*it)->rtti() != RTTI_FLAMME))
{
delete (*it);
}
}
}
示例15: contentsMousePressEvent
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();
}