本文整理汇总了C++中CanvasItem::canBeMovedByOthers方法的典型用法代码示例。如果您正苦于以下问题:C++ CanvasItem::canBeMovedByOthers方法的具体用法?C++ CanvasItem::canBeMovedByOthers怎么用?C++ CanvasItem::canBeMovedByOthers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CanvasItem
的用法示例。
在下文中一共展示了CanvasItem::canBeMovedByOthers方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: moveBy
void Floater::moveBy(double dx, double dy)
{
if (!isEnabled())
return;
QCanvasItemList l = collisions(false);
for (QCanvasItemList::Iterator it = l.begin(); it != l.end(); ++it)
{
CanvasItem *item = dynamic_cast<CanvasItem *>(*it);
if (!noUpdateZ && item && item->canBeMovedByOthers())
item->updateZ(this);
if ((*it)->z() >= z())
{
if (item && item->canBeMovedByOthers() && collidesWith(*it))
{
if ((*it)->rtti() == Rtti_Ball)
{
//((Ball *)(*it))->setState(Rolling);
(*it)->moveBy(dx, dy);
if (game && game->hasFocus() && !game->isEditing() && game->curBall() == (Ball *)(*it))
game->ballMoved();
}
else if ((*it)->rtti() != Rtti_Putter)
(*it)->moveBy(dx, dy);
}
}
}
point->dontMove();
point->move(x() + width(), y() + height());
// this call must come after we have tested for collisions, otherwise we skip them when saving!
// that's a bad thing
QCanvasRectangle::moveBy(dx, dy);
// because we don't do Bridge::moveBy();
topWall->move(x(), y());
botWall->move(x(), y() - 1);
leftWall->move(x(), y());
rightWall->move(x(), y());
if (game && game->isEditing())
game->updateHighlighter();
}