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


C++ QRectF::united方法代码示例

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


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

示例1: objectsBoundingRect

QRectF ObjectGroup::objectsBoundingRect() const
{
    QRectF boundingRect;
    foreach (const MapObject *object, mObjects)
        boundingRect = boundingRect.united(object->bounds());
    return boundingRect;
}
开发者ID:AaronShea,项目名称:tiled,代码行数:7,代码来源:objectgroup.cpp

示例2: calculate_extent

 static QRectF calculate_extent(QRectF r)
 {
     // 确保image的大小,从左上角的(0,0)位置位起点。
     return r.united(QRectF(0, 0, 1, 1));
     // 测试的范围
     //return QRectF(0, 0, 1000, 10000);
 }
开发者ID:ongbe,项目名称:xchart,代码行数:7,代码来源:graph_path_renderer.cpp

示例3: buildObjects

void TemplateSCgObjectsBuilder::buildObjects(const TypeToObjectsMap& objects)
{
    mDecoratedBuilder->buildObjects(objects);
    QList<SCgObject*> l = mDecoratedBuilder->objects();

    foreach(SCgObject* obj, l)
        if(! obj->parentItem())
            obj->setDead(true);

    QRectF bounds;

    foreach(SCgObject* obj, l)
        bounds = bounds.united(obj->sceneBoundingRect());

    foreach(SCgObject* obj, l)
    {
        if(! obj->parentItem())
                obj->setPos(obj->scenePos() - bounds.topLeft());
    }

    foreach(SCgObject* obj, l)
    {
        if( obj->type() == QGraphicsItem::UserType + 3 )      // type SCgPair
            obj->positionChanged();
    }
}
开发者ID:DenisKlimenko,项目名称:kbe,代码行数:26,代码来源:scgtemplateobjectbuilder.cpp

示例4: relayout

void MFreestyleLayoutPolicy::relayout()
{
    Q_D(MFreestyleLayoutPolicy);

    QPointF topLeft = contentsArea().topLeft();

    QList<QRectF> new_geometries;
    const int size = count();
    for (int i = 0; i < size; ++i) {
        new_geometries << itemGeometry(i);
        d->placeItem(i, new_geometries, topLeft, contentsArea().width());
    }

    QRectF area = contentsArea();
    for (int i = 0; i < size; ++i) {
        area = area.united(new_geometries.at(i));
        setItemGeometry(i, new_geometries.at(i));
    }

    //if we have moved items outside of the bounding box, we need to invalidate the layout
    //causing another relayout, but we have to be careful that we don't end up in an
    //infinite loop because of this.
    if (area.isValid() && !contentsArea().adjusted(-0.0000001, -0.0000001, 0.0000001, 0.0000001).contains(area)) //adjust for rounding errors
        updateGeometry();
}
开发者ID:dudochkin-victor,项目名称:libgogootouch,代码行数:25,代码来源:mfreestylelayoutpolicy.cpp

示例5: sizeHint

QSizeF MFreestyleLayoutPolicy::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
{
    Q_D(const MFreestyleLayoutPolicy);

    if (which == Qt::MaximumSize) {
        // maximum size is the QWIDGETSIZE_MAX
        QSizeF new_size = constraint;
        if (new_size.width() < 0)
            new_size.setWidth(QWIDGETSIZE_MAX);
        if (new_size.height() < 0)
            new_size.setHeight(QWIDGETSIZE_MAX);
        return new_size;
    }

    // minimum and preferred size of a layout is the bounding box of the children
    int i = count();
    QRectF boundingBox;
    while (--i >= 0) {
        // iterate through children
        boundingBox = boundingBox.united(itemGeometry(i));
    }

    qreal right, bottom;
    d->layout->getContentsMargins(NULL, NULL, &right, &bottom);
    return QSizeF(boundingBox.right() + right - d->layout->geometry().left(), boundingBox.bottom() + bottom - d->layout->geometry().top());
}
开发者ID:dudochkin-victor,项目名称:libgogootouch,代码行数:26,代码来源:mfreestylelayoutpolicy.cpp

示例6: pageItemBounds

QRectF QgsLayout::pageItemBounds( int page, bool visibleOnly ) const
{
  //start with an empty rectangle
  QRectF bounds;

  //add all QgsLayoutItems on page
  const QList<QGraphicsItem *> itemList = items();
  for ( QGraphicsItem *item : itemList )
  {
    const QgsLayoutItem *layoutItem = dynamic_cast<const QgsLayoutItem *>( item );
    if ( layoutItem && layoutItem->type() != QgsLayoutItemRegistry::LayoutPage && layoutItem->page() == page )
    {
      if ( visibleOnly && !layoutItem->isVisible() )
        continue;

      //expand bounds with current item's bounds
      if ( bounds.isValid() )
        bounds = bounds.united( item->sceneBoundingRect() );
      else
        bounds = item->sceneBoundingRect();
    }
  }

  return bounds;
}
开发者ID:NathanW2,项目名称:QGIS,代码行数:25,代码来源:qgslayout.cpp

示例7: boundingRectFor

QRectF ShadowEffect::boundingRectFor(const QRectF &rect) const
{
    qreal padding = m_blurRadius * 2;
    return rect.united(
        rect.translated(m_xOffset, m_yOffset)
        .adjusted(-padding, -padding, padding, padding)
        );
}
开发者ID:KDE,项目名称:homerun,代码行数:8,代码来源:shadoweffect.cpp

示例8: boundingRect

QRectF CopyFilterGUIConnectionItem::boundingRect() const
{
	QRectF rect = QGraphicsLineItem::boundingRect();

	QPointF p2 = line().p2();
	QRectF rect2 = QRectF(p2.x() - maxArrowSize, p2.y() - maxArrowSize, 2 * maxArrowSize, 2 * maxArrowSize);

	return rect.united(rect2);
}
开发者ID:Noiled,项目名称:equalizerapo,代码行数:9,代码来源:CopyFilterGUIConnectionItem.cpp

示例9: foreach

void RuntimeController::Private::updateActiveRegion()
{
    Configuration configuration = q->activeConfiguration();

    // Calculate the bounding rect of all states in that are currently active
    QRectF activeRegion;
    foreach (State* state, configuration) {
        activeRegion = activeRegion.united(state->boundingRect());
    }
开发者ID:krf,项目名称:KDStateMachineEditor,代码行数:9,代码来源:runtimecontroller.cpp

示例10: onStitchClicked

void StitcherWorkspace::onStitchClicked() {
    QList<QGraphicsItem *> it = _stitcherView->items();
    if(it.size() < 2) {
        return;
    }
    QRectF combined;
    for(int i = 0; i < it.size(); i++) {
        if(QString("ImageItem") == it[i]->data(0)) {
            /* we have an image item */
            ImageItem * ii = qgraphicsitem_cast<ImageItem *>(it[i]);
            combined = combined.united(ii->sceneBoundingRect());
        }
    }
    /* we're gonna assume they all have the same scaling */
    combined =  _stitcherView->selectedImage()->mapRectFromScene(combined);
    qDebug("Combined with relative positions:");
    Image * a = sp_image_alloc(combined.width(),combined.height(),1);
    for(int i = 0; i < it.size(); i++) {
        if(QString("ImageItem") == it[i]->data(0)) {
            QPointF p =  it[i]->mapToScene(0,0);
            QPointF local_p = _stitcherView->selectedImage()->mapFromScene(p);
            qDebug("x = %f y = %f",local_p.x()-combined.x(),local_p.y()-combined.y());
        }
    }
    for(int x = 0; x<sp_image_x(a); x++) {
        for(int y = 0; y<sp_image_y(a); y++) {
            int mask = 0;
            Complex value = sp_cinit(0,0);
            QPointF p =  _stitcherView->selectedImage()->mapToScene(QPointF(combined.x()+x,combined.y()+y));
            for(int i = 0; i < it.size(); i++) {
                if(QString("ImageItem") == it[i]->data(0)) {
                    /* we have an image item */
                    ImageItem * ii = qgraphicsitem_cast<ImageItem *>(it[i]);

                    QPointF local_p = it[i]->mapFromScene(p);
                    if(it[i]->contains(local_p)) {
                        /* we're in business */
                        value = sp_cadd(value,sp_image_get(ii->getImage(),local_p.x(),local_p.y(),0));
                        mask++;
                    }
                }
            }
            if(mask) {
                sp_cscale(value,1.0/mask);
            }
            a->detector->image_center[0] = -combined.x();
            a->detector->image_center[1] = -combined.y();
            a->detector->image_center[2] = 0;
            sp_image_set(a,x,y,0,value);
            sp_image_mask_set(a,x,y,0,mask);
        }
    }
    ImageItem * item = new ImageItem(a,QString(),_stitcherView,NULL);
    _stitcherView->addImage(item);
    item->update();
}
开发者ID:ng110,项目名称:hawk,代码行数:56,代码来源:stitcherworkspace.cpp

示例11: updateMultiSelectionRect

void ChatLog::updateMultiSelectionRect()
{
    if (selectionMode == Multi && selFirstRow >= 0 && selLastRow >= 0)
    {
        QRectF selBBox;
        selBBox = selBBox.united(lines[selFirstRow]->sceneBoundingRect());
        selBBox = selBBox.united(lines[selLastRow]->sceneBoundingRect());

        if (selGraphItem->rect() != selBBox)
            scene->invalidate(selGraphItem->rect());

        selGraphItem->setRect(selBBox);
        selGraphItem->show();
    }
    else
    {
        selGraphItem->hide();
    }
}
开发者ID:BiTOk,项目名称:qTox,代码行数:19,代码来源:chatlog.cpp

示例12: boundingRect

QRectF PolyQtAnnotation::boundingRect() const {
  QRectF bRect;
  if (_annotation) {
      QRectF cpRect = _currentPath.controlPointRect();
      QPointF tl = cpRect.topLeft() - QPointF(3 * _lineAnnotationSelectedThickness, 3 * _lineAnnotationSelectedThickness);
      QPointF br = cpRect.bottomRight() + QPointF(3 * _lineAnnotationSelectedThickness, 3 * _lineAnnotationSelectedThickness);
      bRect = bRect.united(QRectF(tl, br));
  }
  return bRect;
}
开发者ID:Kvit,项目名称:ASAP,代码行数:10,代码来源:PolyQtAnnotation.cpp

示例13: boundingRect

QRectF UBGraphicsProtractor::boundingRect() const
{
    QPointF center = rect().center();
    qreal centerX = center.x();
    qreal centerY = center.y();

    QRectF bounds = resizeButtonRect().adjusted(centerX, centerY, centerX, centerY);
    bounds = bounds.united(closeButtonRect().adjusted(centerX, centerY, centerX, centerY));
    bounds = bounds.united(resetButtonRect().adjusted(centerX, centerY, centerX, centerY));

    QTransform t;
    t.translate(centerX, centerY);
    t.rotate(-mStartAngle);
    t.translate(-centerX, -centerY);
    bounds = t.mapRect(bounds);

    bounds = bounds.united(QGraphicsEllipseItem::boundingRect());

    return bounds;
}
开发者ID:xxbastekxx,项目名称:Sankore-3.1,代码行数:20,代码来源:UBGraphicsProtractor.cpp

示例14: frameRect

QRectF NonPdfCropping::frameRect () const
{
  // The x(), y(), pos(), rect() and boundingRect() will return coordinates assuming origin at the initial position of
  // each handle. So to get the coordinates in the window reference frame it takes a two step process like
  // QGraphicsRectItem::mapRectToScene (QGraphicsRectItem::rect())

  QRectF rectTL = m_handleTL->mapRectToScene (m_handleTL->boundingRect());
  QRectF rectBR = m_handleBR->mapRectToScene (m_handleBR->boundingRect());

  QRectF rectUnited = rectTL.united (rectBR);

  return rectUnited;
}
开发者ID:TobiasWinchen,项目名称:engauge-digitizer,代码行数:13,代码来源:NonPdfCropping.cpp

示例15: boundingRect

QRectF KoShapeLayer::boundingRect() const
{
    QRectF bb;

    Q_FOREACH (KoShape* shape, shapes()) {
        if (bb.isEmpty())
            bb = shape->boundingRect();
        else
            bb = bb.united(shape->boundingRect());
    }

    return bb;
}
开发者ID:AninaRJ,项目名称:krita,代码行数:13,代码来源:KoShapeLayer.cpp


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