本文整理汇总了C++中QRectF::setBottomRight方法的典型用法代码示例。如果您正苦于以下问题:C++ QRectF::setBottomRight方法的具体用法?C++ QRectF::setBottomRight怎么用?C++ QRectF::setBottomRight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QRectF
的用法示例。
在下文中一共展示了QRectF::setBottomRight方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
void WidgetStyle::WidgetScene::mouseMoveEvent(QGraphicsSceneMouseEvent* event)
{
if(m_mouseButton == Qt::LeftButton)
{
QRectF rect = m_rectItem->rect();
QPointF point = event->scenePos();
if(point.x() >= m_topLeftRect.x() && point.y() >= m_topLeftRect.y())
{
rect.setTopLeft(m_topLeftRect);
rect.setBottomRight(point);
}
else if(point.x() >= m_topLeftRect.x() && point.y() <= m_topLeftRect.y())
{
rect.setBottomLeft(m_topLeftRect);
rect.setTopRight(point);
}
else if(point.x() <= m_topLeftRect.x() && point.y() >= m_topLeftRect.y())
{
rect.setTopRight(m_topLeftRect);
rect.setBottomLeft(point);
}
else if(point.x() <= m_topLeftRect.x() && point.y() <= m_topLeftRect.y())
{
rect.setBottomRight(m_topLeftRect);
rect.setTopLeft(point);
}
m_rectItem->setRect(rect);
m_wgtStyle->distinguishRect(rect);
}
QGraphicsScene::mouseMoveEvent(event);
}
示例2: mapFromItem
void core::Connector::setEndObject(GraphicObject *end)
{
if(!end) return;
endObject = end;
// qDebug() << currentMousePos;
//we use currentMousePos instead internal currentMousePos from "end" object due update mouse position problems
//there are conflicts when moving mouse so using this currentMousePos ensures mouse pos is always updated
// qDebug() << portRect;
endPoint = mapFromItem(end, end->getCurrentPortPos(mapToItem(end, currentMousePos)));
isBuildingConector = false;
// qDebug() << portCenter;
QRectF container = getContainerRect();
if(currentMousePos.x() < 0 && currentMousePos.y() < 0){
container.setTopLeft(endPoint );
}else if(currentMousePos.x() < 0 && currentMousePos.y() >= 0){
container.setBottomLeft(endPoint );
}else if(currentMousePos.x() >= 0 && currentMousePos.y() < 0){
container.setTopRight(endPoint );
}else if(currentMousePos.x() >= 0 && currentMousePos.y() >= 0){
container.setBottomRight(endPoint );
}else{
container= QRectF(0, 0, 0, 0);
}
setContainerRect(container);
}
示例3: boundingRect
QRectF coils::boundingRect() const
{
QRectF rect;
rect.setTopLeft(QPointF(-15,-15));
rect.setBottomRight(QPointF(15,15));
return rect;
}
示例4: eraseRegionObjectGroup
void eraseRegionObjectGroup(MapDocument *mapDocument,
ObjectGroup *layer,
const QRegion &where)
{
QUndoStack *undo = mapDocument->undoStack();
const auto objects = layer->objects();
for (MapObject *obj : objects) {
// TODO: we are checking bounds, which is only correct for rectangles and
// tile objects. polygons and polylines are not covered correctly by this
// erase method (we are in fact deleting too many objects)
// TODO2: toAlignedRect may even break rects.
// Convert the boundary of the object into tile space
const QRectF objBounds = obj->boundsUseTile();
QPointF tl = mapDocument->renderer()->pixelToTileCoords(objBounds.topLeft());
QPointF tr = mapDocument->renderer()->pixelToTileCoords(objBounds.topRight());
QPointF br = mapDocument->renderer()->pixelToTileCoords(objBounds.bottomRight());
QPointF bl = mapDocument->renderer()->pixelToTileCoords(objBounds.bottomLeft());
QRectF objInTileSpace;
objInTileSpace.setTopLeft(tl);
objInTileSpace.setTopRight(tr);
objInTileSpace.setBottomRight(br);
objInTileSpace.setBottomLeft(bl);
const QRect objAlignedRect = objInTileSpace.toAlignedRect();
if (where.intersects(objAlignedRect))
undo->push(new RemoveMapObject(mapDocument, obj));
}
}
示例5: mouseMoveEvent
void BlurItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
QGraphicsRectItem::mouseMoveEvent(event);
const QPointF pos = event->scenePos();
QRectF r;
r.setTopLeft(m_point);
r.setBottomRight(event->scenePos());
if (r.width() < 0) {
r.setLeft(pos.x());
r.setRight(m_point.x());
}
if (r.height() < 0) {
r.setTop(pos.y());
r.setBottom(m_point.y());
}
r = r.intersected(m_item->scene()->sceneRect());
setRect(r);
setSelected(true);
m_item->setOffset(r.topLeft());
reload(m_pixmap);
}
示例6: boundingRect
//! \brief Return bounding rectangle arround a wireline
QRectF WireLine::boundingRect() const
{
QRectF rect;
rect.setTopLeft(p1());
rect.setBottomRight(p2());
rect = rect.normalized();
rect.adjust(-m_adjust, -m_adjust, +m_adjust, +m_adjust);
return rect;
}
示例7: drawSquare
void GraphDraw::drawSquare(QPointF pt, double w)
{
painter.setRenderHint(QPainter::Antialiasing, false);
QRectF rect;
rect.setTopLeft(pt + QPointF(-w,-w));
rect.setBottomRight(pt + QPointF(w,w));
painter.drawRect(rect);
}
示例8: eventFilter
bool core::Connector::eventFilter(QObject *sender, QEvent *event)
{
// qDebug () << event->type();
if(event->type() == QEvent::MouseMove){
QMouseEvent *hEvent = (QMouseEvent*)event;
GraphicDetailedView *gdv = (GraphicDetailedView*)sender;
QPointF pos = mapFromScene(gdv->mapToScene(hEvent->pos()));
currentMousePos = pos;
// qDebug() << currentMousePos << "<< currentMousePos";
QRectF container = getContainerRect();
if(pos.x() < 0 && pos.y() < 0){
container.setTopLeft(pos);
container.setBottomRight(QPointF(0, 0));
}else if(pos.x() < 0 && pos.y() >= 0){
container.setBottomLeft(pos);
container.setTopRight(QPointF(0, 0));
}else if(pos.x() >= 0 && pos.y() < 0){
container.setTopRight(pos);
container.setBottomLeft(QPointF(0, 0));
}else if(pos.x() >= 0 && pos.y() >= 0){
container.setBottomRight(pos);
container.setTopLeft(QPointF(0, 0));
}else{
container= QRectF(0, 0, 0, 0);
}
setContainerRect(container);
if(isBuildingConector){
updateConectorLine(beginPoint, pos);
}
return true;
}
return GraphicObject::eventFilter(sender, event);
}
示例9: buildReferenceRect
static QRectF buildReferenceRect( const PolarCoordinatePlane* plane )
{
QRectF contentsRect;
QPointF referencePointAtTop = plane->translate( QPointF( 1, 0 ) );
QPointF temp = plane->translate( QPointF( 0, 0 ) ) - referencePointAtTop;
const double offset = temp.y();
referencePointAtTop.setX( referencePointAtTop.x() - offset );
contentsRect.setTopLeft( referencePointAtTop );
contentsRect.setBottomRight( referencePointAtTop + QPointF( 2*offset, 2*offset) );
return contentsRect;
}
示例10: resizeAccordingToChildren
void ResizeHandler::resizeAccordingToChildren(QRectF &newContents, QPointF &newPos) const
{
// Vector of minimum negative XY child deflection from top left corner.
const QPointF childDeflectionVector = childDeflection();
moveChildren(-childDeflectionVector);
newPos += childDeflectionVector;
newContents.setBottomRight(newContents.bottomRight() - childDeflectionVector);
expandByChildren(newContents);
}
示例11: mouseMoveEvent
void ContentWindowGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent * event)
{
// handle mouse movements differently depending on selected mode of item
if(!selected())
{
if(event->buttons().testFlag(Qt::LeftButton))
{
if(resizing_)
{
QRectF r = boundingRect();
QPointF eventPos = event->pos();
r.setBottomRight(eventPos);
QRectF sceneRect = mapRectToScene(r);
double w = sceneRect.width();
double h = sceneRect.height();
setSize(w, h);
}
else
{
QPointF delta = event->pos() - event->lastPos();
double new_x = coordinates_.x() + delta.x();
double new_y = coordinates_.y() + delta.y();
setPosition(new_x, new_y);
}
}
}
else
{
ContentWindowManagerPtr contentWindow = getContentWindowManager();
if(contentWindow)
{
// Zoom or forward event depending on type
contentWindow->getInteractionDelegate().mouseMoveEvent(event);
// force a redraw to update window info label
update();
}
}
}
示例12: updateDragging
void PrintTool::updateDragging(MapCoordF mouse_pos_map)
{
QPointF delta = QPointF(mouse_pos_map - click_pos_map);
QRectF area = map_printer->getPrintArea();
switch (region)
{
case Inside:
area.moveTopLeft(area.topLeft() + delta);
break;
case LeftBorder:
area.setLeft(area.left() + delta.rx());
break;
case TopLeftCorner:
area.setTopLeft(area.topLeft() + delta);
break;
case TopBorder:
area.setTop(area.top() + delta.ry());
break;
case TopRightCorner:
area.setTopRight(area.topRight() + delta);
break;
case RightBorder:
area.setRight(area.right() + delta.rx());
break;
case BottomRightCorner:
area.setBottomRight(area.bottomRight() + delta);
break;
case BottomBorder:
area.setBottom(area.bottom() + delta.ry());
break;
case BottomLeftCorner:
area.setBottomLeft(area.bottomLeft() + delta);
break;
case Outside:
Q_ASSERT(false); // Handled outside.
case Unknown:
; // Nothing
}
if (area.left() < area.right() && area.top() < area.bottom())
{
map_printer->setPrintArea(area);
click_pos_map = mouse_pos_map;
}
}
示例13: mouseMoveEvent
void CVisSystemCanvasNote::mouseMoveEvent(QGraphicsSceneMouseEvent* me)
{
if(d->resizing)
{
QPointF dp = me->scenePos() - d->mousePos;
prepareGeometryChange();
QRectF r = noteRect();
r.setBottomRight( r.bottomRight()+dp );
if(d->minimumSize.width() > r.width() || d->minimumSize.height() > r.height())
return;
setNoteRect(r);
d->mousePos = me->scenePos();
}
else
QGraphicsRectItem::mouseMoveEvent(me);
}
示例14: mouseMoveEvent
void ResizingGrip::mouseMoveEvent(QGraphicsSceneMouseEvent* event)
{
// ==========================================================================================
// VERSION 1: Resize AreaItem and then move it to 0,0
// ==========================================================================================
QRectF resizableZone = _areaItem->getRect().translated(_areaItem->scenePos());
QPointF scenePos = event->scenePos();
switch(_position)
{
case TOPLEFT:
resizableZone.setTopLeft(scenePos);
break;
case TOPCENTER:
resizableZone.setTop(scenePos.y());
break;
case TOPRIGHT:
resizableZone.setTopRight(scenePos);
break;
case LEFTCENTER:
resizableZone.setLeft(scenePos.x());
break;
case RIGHTCENTER:
resizableZone.setRight(scenePos.x());
break;
case BOTTOMLEFT:
resizableZone.setBottomLeft(scenePos);
break;
case BOTTOMCENTER:
resizableZone.setBottom(scenePos.y());
break;
case BOTTOMRIGHT:
resizableZone.setBottomRight(scenePos);
break;
default:
Q_ASSERT(false);
}
//resizableZone.moveTopLeft(QPointF(0, 0));
_areaItem->updateMainDiagram(resizableZone);
event->accept();
}
示例15: boundingRectOfSelectedItems
int QgsComposition::boundingRectOfSelectedItems( QRectF& bRect )
{
QList<QgsComposerItem*> selectedItems = selectedComposerItems();
if ( selectedItems.size() < 1 )
{
return 1;
}
//set the box to the first item
QgsComposerItem* currentItem = selectedItems.at( 0 );
double minX = currentItem->transform().dx();
double minY = currentItem->transform().dy();
double maxX = minX + currentItem->rect().width();
double maxY = minY + currentItem->rect().height();
double currentMinX, currentMinY, currentMaxX, currentMaxY;
for ( int i = 1; i < selectedItems.size(); ++i )
{
currentItem = selectedItems.at( i );
currentMinX = currentItem->transform().dx();
currentMinY = currentItem->transform().dy();
currentMaxX = currentMinX + currentItem->rect().width();
currentMaxY = currentMinY + currentItem->rect().height();
if ( currentMinX < minX )
minX = currentMinX;
if ( currentMaxX > maxX )
maxX = currentMaxX;
if ( currentMinY < minY )
minY = currentMinY;
if ( currentMaxY > maxY )
maxY = currentMaxY;
}
bRect.setTopLeft( QPointF( minX, minY ) );
bRect.setBottomRight( QPointF( maxX, maxY ) );
return 0;
}