本文整理汇总了C++中BasicBox::ID方法的典型用法代码示例。如果您正苦于以下问题:C++ BasicBox::ID方法的具体用法?C++ BasicBox::ID怎么用?C++ BasicBox::ID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BasicBox
的用法示例。
在下文中一共展示了BasicBox::ID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
ConditionalRelation::updateBoxesCoordinates(unsigned int boxId)
{
// Move related boxes, except boxId's box (already moved by user)
QList<BasicBox *>::iterator it;
BasicBox *box = _scene->getBox(boxId),
*curBox;
float curBoxX,
boxX = box->getLeftGripPoint().x();
for(it=_boxesAttached.begin() ; it!=_boxesAttached.end() ; it++)
{
curBox = *it;
if(curBox->ID() != box->ID())
{
curBoxX = curBox->getLeftGripPoint().x();
if(boxX != curBoxX)
{
curBox->moveBy(boxX - curBoxX, 0.);
_scene->boxMoved(curBox->ID());
}
}
}
}
示例2: if
void
Relation::mouseMoveEvent(QGraphicsSceneMouseEvent * event)
{
QGraphicsItem::mouseMoveEvent(event);
double eventPosX = mapFromScene(event->scenePos()).x();
double startX = mapFromScene(_start).x();
if (_leftHandleSelected) {
changeBounds(_abstract->maxBound() == NO_BOUND ? std::max(eventPosX - startX, 0.) : std::min((float)std::max(eventPosX - startX, 0.), _abstract->maxBound()), _abstract->maxBound());
_scene->changeRelationBounds(_abstract->ID(), NO_LENGTH, _abstract->minBound(), _abstract->maxBound());
update();
}
else if (_rightHandleSelected) {
_scene->changeRelationBounds(_abstract->ID(), NO_LENGTH, _abstract->minBound(), std::max((float)std::max(eventPosX - startX, 0.), _abstract->minBound()));
update();
}
else if (_middleHandleSelected) {
BasicBox *rightBox = _scene->getBox(_abstract->secondBox());
_scene->changeRelationBounds(_abstract->ID(), NO_LENGTH, NO_BOUND, NO_BOUND);
qreal factorX = 2 * (eventPosX - _mouseClickPosSave.x());
rightBox->moveBy(factorX, 0.);
rightBox->setTopLeft(rightBox->getTopLeft() + QPointF(factorX, 0.));
rightBox->updateStuff();
_scene->boxMoved(rightBox->ID());
}
}