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


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

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


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

示例1: zoom

void QwtPlotZoomer::zoom( const QRectF &rect )
{
    if ( d_data->maxStackDepth >= 0 &&
            int( d_data->zoomRectIndex ) >= d_data->maxStackDepth )
    {
        return;
    }

    const QRectF zoomRect = rect.normalized();
    if ( zoomRect != d_data->zoomStack[d_data->zoomRectIndex] )
    {
        for ( uint i = d_data->zoomStack.count() - 1;
           i > d_data->zoomRectIndex; i-- )
        {
            ( void )d_data->zoomStack.pop();
        }

        d_data->zoomStack.push( zoomRect );
        d_data->zoomRectIndex++;

        rescale();

        Q_EMIT zoomed( zoomRect );
    }
}
开发者ID:facontidavide,项目名称:PlotJuggler,代码行数:25,代码来源:qwt_plot_zoomer.cpp

示例2: boundingRect

/*!
   \return Bounding rectangle of the data
   \sa QwtPlotRasterItem::interval()
*/
QRectF QwtPlotRasterItem::boundingRect() const
{
    const QwtInterval intervalX = interval( Qt::XAxis );
    const QwtInterval intervalY = interval( Qt::YAxis );

    if ( !intervalX.isValid() && !intervalY.isValid() )
        return QRectF(); // no bounding rect

    QRectF r;

    if ( intervalX.isValid() )
    {
        r.setLeft( intervalX.minValue() );
        r.setRight( intervalX.maxValue() );
    }
    else
    {
        r.setLeft(-0.5 * FLT_MAX);
        r.setWidth(FLT_MAX);
    }

    if ( intervalY.isValid() )
    {
        r.setTop( intervalY.minValue() );
        r.setBottom( intervalY.maxValue() );
    }
    else
    {
        r.setTop(-0.5 * FLT_MAX);
        r.setHeight(FLT_MAX);
    }

    return r.normalized();
}
开发者ID:wangyun123,项目名称:Third,代码行数:38,代码来源:qwt_plot_rasteritem.cpp

示例3: mouseMoveEvent

void ImageScene::mouseMoveEvent(QGraphicsSceneMouseEvent* in_mEvent) {
	if (m_pPixmap == NULL) {
		return;
	}
	qreal x = in_mEvent->scenePos().x(), y = in_mEvent->scenePos().y();
	if ( 	x < m_pPixmap->offset().x() ) {
		x = m_pPixmap->offset().x();
	} else if ( x - m_pPixmap->offset().x() >= m_pPixmap->pixmap().rect().width() ) {
		x = m_pPixmap->pixmap().rect().width() + m_pPixmap->offset().x() - 1;
	}
	if ( y < m_pPixmap->offset().y() ) {
		y = m_pPixmap->offset().y();
	} else if ( y - m_pPixmap->offset().y() >= m_pPixmap->pixmap().rect().height() ) {
		y = m_pPixmap->pixmap().rect().height() + m_pPixmap->offset().y() - 1;
	}
	if (m_pSelection != NULL) {
		QRectF rect;
		rect.setCoords ( m_SelectionPosition.x(),
				 m_SelectionPosition.y(),
				 x,y );
		m_pSelection->setRect ( rect.normalized());
	} else {
		m_pSelection = QGraphicsScene::addRect (x,y,0,0, m_SelectionPen, m_SelectionBrush);
		m_pSelection->setParentItem (m_pPixmap);
		m_SelectionPosition = m_pSelection->rect().topLeft();
	}

	if  ( 	m_pSelection->rect().width() < 1 ||
		m_pSelection->rect().height() < 1 )
	{
		m_pSelection->setVisible(false);
	} else {
		m_pSelection->setVisible(true);
	}
}
开发者ID:ein-shved,项目名称:qPaint,代码行数:35,代码来源:ImageScene.cpp

示例4: TGeometry

 TShape::TShape(const enum TShapeType ShapeType_, const QRectF &Rect_, const QString& Name_,
    const unsigned FillColor_, const unsigned BorderColor_, const unsigned BorderWidth_)
    : TGeometry(Name_), m_ShapeType(ShapeType_), m_FillColor(FillColor_),
      m_BorderColor(BorderColor_), m_BorderWidth(BorderWidth_)
 {
 setGeometryType("Shape");
 m_BoundingBoxF = Rect_.normalized();
 m_TextPosition = Middle;
 }
开发者ID:vasyutin,项目名称:qnetmap,代码行数:9,代码来源:qnetmap_shape.cpp

示例5: 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;
}
开发者ID:damiansimanuk,项目名称:qucs-qt4,代码行数:10,代码来源:wireline.cpp

示例6: invTransform

/*!
   Transform a rectangle from paint to scale coordinates

   \param xMap X map
   \param yMap Y map
   \param rect Rectangle in paint coordinates
   \return Rectangle in scale coordinates
   \sa transform()
*/
QRectF QwtScaleMap::invTransform( const QwtScaleMap &xMap,
    const QwtScaleMap &yMap, const QRectF &rect )
{
    const double x1 = xMap.invTransform( rect.left() );
    const double x2 = xMap.invTransform( rect.right() - 1 );
    const double y1 = yMap.invTransform( rect.top() );
    const double y2 = yMap.invTransform( rect.bottom() - 1 );

    const QRectF r( x1, y1, x2 - x1, y2 - y1 );
    return r.normalized();
}
开发者ID:01iv3r,项目名称:OpenPilot,代码行数:20,代码来源:qwt_scale_map.cpp

示例7: move

void MapHelperUniversal::move(const QRectF &rgn)
{
    Q_D(MapHelperUniversal);
    if (d->states.testFlag(stMove))
        return;

    MapSubHelperMove *sub = new MapSubHelperMove(d->map);
    d->addSubhelper(sub);
    if (!rgn.isEmpty())
        sub->initData(rgn.normalized());
}
开发者ID:doubletap1410,项目名称:Map,代码行数:11,代码来源:maphelper.cpp

示例8: getHandleRect

/***********************************************************************
 *Funtion : Get the handle rect
 *Return  : QRectF handle rect.
 *Parameter: handle id.
 **********************************************************************/
QRectF SamDrawItemBase::getHandleRect(int iHandleID, QRectF &qrcBondingRect)
{
    QRectF qrRect;
    // get the center of the handle in logical coords
    QPointF qpPoint = getHandle(iHandleID, qrcBondingRect);

    /*Set the rect and normalize it*/
    qrRect.setRect(qpPoint.rx()-SAMDRAW_TRACKER_POS_OFT, qpPoint.ry()-SAMDRAW_TRACKER_POS_OFT, SAMDRAW_TRACKER_SIZE, SAMDRAW_TRACKER_SIZE);
    qrRect = qrRect.normalized();

    return qrRect;
}
开发者ID:maqiangddb,项目名称:pc_code,代码行数:17,代码来源:samdrawitembase.cpp

示例9: firstDataInterval

/**
 * @brief GridItem::firstDataInterval Determins the first grid interval in data space.
 */
QRectF GridItem::firstDataInterval(QRectF dataRect) const
{
	QSizeF interval(m_minDistance, m_minDistance);
	interval = m_transform->sceneToData(interval);
	interval = niceInterval(interval);
	if (m_useManualInterval) {
		interval.setWidth(std::max(m_manualInterval.width(), interval.width()));
		interval.setHeight(std::max(m_manualInterval.height(), interval.height()));
	}
	QPointF start = intervalStart(dataRect.normalized().topLeft(), interval, QPointF());
	return QRectF(start, interval);
}
开发者ID:dejfh,项目名称:nicos-livewidget-ng,代码行数:15,代码来源:griditem.cpp

示例10: attemptResize

void QgsLayoutItemGroup::attemptResize( const QgsLayoutSize &size, bool includesFrame )
{
  if ( !mLayout )
    return;

  if ( !shouldBlockUndoCommands() )
    mLayout->undoStack()->beginMacro( tr( "Resize Group" ) );

  QRectF oldRect = rect();
  QSizeF newSizeLayoutUnits = mLayout->convertToLayoutUnits( size );
  QRectF newRect;
  newRect.setSize( newSizeLayoutUnits );

  //also resize all items within the group
  for ( QgsLayoutItem *item : qgis::as_const( mItems ) )
  {
    if ( !item )
      continue;

    std::unique_ptr< QgsAbstractLayoutUndoCommand > command;
    if ( !shouldBlockUndoCommands() )
    {
      command.reset( createCommand( QString(), 0 ) );
      command->saveBeforeState();
    }

    QRectF itemRect = mapRectFromItem( item, item->rect() );
    QgsLayoutUtils::relativeResizeRect( itemRect, oldRect, newRect );

    itemRect = itemRect.normalized();
    QPointF newPos = mapToScene( itemRect.topLeft() );

    QgsLayoutSize itemSize = mLayout->convertFromLayoutUnits( itemRect.size(), item->sizeWithUnits().units() );
    item->attemptResize( itemSize, includesFrame );

    // translate new position to current item units
    QgsLayoutPoint itemPos = mLayout->convertFromLayoutUnits( newPos, item->positionWithUnits().units() );
    item->attemptMove( itemPos, false );

    if ( command )
    {
      command->saveAfterState();
      mLayout->undoStack()->push( command.release() );
    }
  }
  QgsLayoutItem::attemptResize( size );
  if ( !shouldBlockUndoCommands() )
    mLayout->undoStack()->endMacro();

  resetBoundingRect();
}
开发者ID:cz172638,项目名称:QGIS,代码行数:51,代码来源:qgslayoutitemgroup.cpp

示例11: firstSceneInterval

/**
 * @brief GridItem::firstSceneInterval Determins the first grid interval in scene space
 */
QRectF GridItem::firstSceneInterval(QRectF sceneRect) const
{
	QSizeF interval(m_minDistance, m_minDistance);
	interval = m_transform->sceneToData(interval);
	interval = niceInterval(interval);
	if (m_useManualInterval) {
		interval.setWidth(std::max(m_manualInterval.width(), interval.width()));
		interval.setHeight(std::max(m_manualInterval.height(), interval.height()));
	}
	interval = m_transform->dataToScene(interval);
	interval = QSizeF(std::fabs(interval.width()), std::fabs(interval.height()));
	QPointF start = intervalStart(sceneRect.normalized().topLeft(), interval, m_transform->origin());
	return QRectF(start, interval);
}
开发者ID:dejfh,项目名称:nicos-livewidget-ng,代码行数:17,代码来源:griditem.cpp

示例12:

/*! Find a minimal rectangle that encapsulates the polygon. The
    rectangle is returned in the QRectF object.
 */
QRectF Polygon2D::GetSurroundingRectangle() const
{
	QRectF rc;

   if(m_vecV.size()) {
		Point2D pt1, pt2;
		GetSurroundingRectangle(pt1, pt2);
		rc.setCoords(
			pt1.GetX(), pt2.GetY(),	// left, top 
			pt2.GetX(), pt1.GetY()  // right, bottom.
		);
   }

	return rc.normalized();
}
开发者ID:jpoirier,项目名称:x-gauges,代码行数:18,代码来源:Polygon2D.cpp

示例13: scaleRect

/*!
  \return Normalized bounding rectangle of the axes
  \sa QwtPlot::autoReplot(), QwtPlot::replot().
*/
QRectF QwtPlotPicker::scaleRect() const
{
    QRectF rect;

    if ( plot() )
    {
        const QwtScaleDiv &xs = plot()->axisScaleDiv( xAxis() );
        const QwtScaleDiv &ys = plot()->axisScaleDiv( yAxis() );

        rect = QRectF( xs.lowerBound(), ys.lowerBound(),
            xs.range(), ys.range() );
        rect = rect.normalized();
    }

    return rect;
}
开发者ID:CaptainFalco,项目名称:OpenPilot,代码行数:20,代码来源:qwt_plot_picker.cpp

示例14: viewToCellCoordinates

QRect CanvasBase::viewToCellCoordinates(const QRectF& viewRect) const
{
    register Sheet * const sheet = activeSheet();
    if (!sheet)
        return QRect();

    // NOTE Stefan: Do not consider the layout direction in this case.
    const QRectF rect = viewConverter()->viewToDocument(viewRect.normalized()).translated(offset());

    qreal tmp;
    const int left = sheet->leftColumn(rect.left(), tmp);
    const int right = sheet->rightColumn(rect.right());
    const int top = sheet->topRow(rect.top(), tmp);
    const int bottom = sheet->bottomRow(rect.bottom());

    return QRect(left, top, right - left + 1, bottom - top + 1);
}
开发者ID:crayonink,项目名称:calligra-2,代码行数:17,代码来源:CanvasBase.cpp

示例15: painterSaver

/**
 * Draws a 3D cuboid by extending a 2D rectangle in the z-axis
 *
 * @param rect The rectangle to draw
 * @param brush The brush fill the surfaces of the cuboid with
 * @param pen The pen to draw the edges with
 * @param props The 3D properties to use for drawing the cuboid
 * @return The drawn cuboid as a polygon
 */
QPolygonF StockDiagram::Private::ThreeDPainter::drawThreeDRect( const QRectF &rect, const QBrush &brush,
                                                                const QPen &pen, const ThreeDProperties &props )
{
    // Restores the painting properties when destroyed
    PainterSaver painterSaver( painter );

    // Make sure that the top really is the top
    const QRectF normalizedRect = rect.normalized();

    // Calculate all the four sides of the rectangle
    const QLineF topSide = QLineF( normalizedRect.topLeft(), normalizedRect.topRight() );
    const QLineF bottomSide = QLineF( normalizedRect.bottomLeft(), normalizedRect.bottomRight() );
    const QLineF leftSide = QLineF( normalizedRect.topLeft(), normalizedRect.bottomLeft() );
    const QLineF rightSide = QLineF( normalizedRect.topRight(), normalizedRect.bottomRight() );

    QPolygonF drawnPolygon;

    // Shorter names are easier on the eyes
    const qreal angle = props.angle;

    // Only top and right side is visible
    if ( angle >= 0.0 && angle < 90.0 ) {
        drawnPolygon = drawnPolygon.united( drawThreeDLine( topSide, brush, pen, props ) );
        drawnPolygon = drawnPolygon.united( drawThreeDLine( rightSide, brush, pen, props ) );
    // Only top and left side is visible
    } else if ( angle >= 90.0 && angle < 180.0 ) {
        drawnPolygon = drawnPolygon.united( drawThreeDLine( topSide, brush, pen, props ) );
        drawnPolygon = drawnPolygon.united( drawThreeDLine( leftSide, brush, pen, props ) );
    // Only bottom and left side is visible
    } else if ( angle >= 180.0 && angle < 270.0 ) {
        drawnPolygon = drawnPolygon.united( drawThreeDLine( bottomSide, brush, pen, props ) );
        drawnPolygon = drawnPolygon.united( drawThreeDLine( leftSide, brush, pen, props ) );
    // Only bottom and right side is visible
    } else if ( angle >= 270.0 && angle <= 360.0 ) {
        drawnPolygon = drawnPolygon.united( drawThreeDLine( bottomSide, brush, pen, props ) );
        drawnPolygon = drawnPolygon.united( drawThreeDLine( rightSide, brush, pen, props ) );
    }

    // Draw the front side
    painter->setPen( pen );
    painter->setBrush( brush );
    painter->drawRect( normalizedRect );

    return drawnPolygon;
}
开发者ID:Wushaowei001,项目名称:mksPlanner,代码行数:54,代码来源:KDChartStockDiagram_p.cpp


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