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


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

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


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

示例1: 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

示例2: updateDirtyRect

void DrawRectangleTool::updateDirtyRect()
{
	QRectF rect;
	includePreviewRects(rect);
	
	if (shift_pressed)
		snap_helper->includeDirtyRect(rect);
	if (is_helper_tool)
		emit(dirtyRectChanged(rect));
	else
	{
		if (angle_helper->isActive())
			angle_helper->includeDirtyRect(rect);
		if (rect.isValid())
		{
			float helper_cross_radius = Settings::getInstance().getRectangleToolHelperCrossRadiusPx();
			int pixel_border = 0;
			if (editingInProgress())
				pixel_border = helper_cross_radius;	// helper_cross_radius as border is less than ideal but the only way to always ensure visibility of the helper cross at the moment
			if (angle_helper->isActive())
				pixel_border = qMax(pixel_border, angle_helper->getDisplayRadius());
			map()->setDrawingBoundingBox(rect, pixel_border, true);
		}
		else
			map()->clearDrawingBoundingBox();
	}
}
开发者ID:kjetilk,项目名称:mapper,代码行数:27,代码来源:tool_draw_rectangle.cpp

示例3: FitInstructionInView

void GInstructionView::FitInstructionInView()
{
	if(!m_pInstruction || !m_pInsScene)
		return;
//	setSceneRect(m_pInstruction->BoundingSceneRect());
	fitInView(&m_pInstruction->m_GraphicsItem);

	QRectF SceneRect = sceneRect();
	if(!SceneRect.isValid())
		return;
	// we don't want blank areas at the beginning or at the ending of the G_old_Instruction in the QGraphicsView
	// so here is what we are going to do: we will see what is the viewport coordinate in the scene,...
	// then, we will add 1 or so, and change the scene coordinate so that it corresponds to the beginning/ending of the G_old_Instruction
	fitInView(SceneRect);
	QRect geomView = geometry();
	int Xini = -1;
	int Xfin = geomView.width() - 3;
	if(Xfin <= 2)
		return;
	double Xiniscene = mapToScene(Xini, 0).rx();
	double Xfinscene = mapToScene(Xfin, 0).rx() - m_pInstruction->Duration();
	SceneRect.adjust(- Xiniscene, 0, - Xfinscene, 0);
	setSceneRect(SceneRect);
	fitInView(SceneRect);
}
开发者ID:GaelReinaudi,项目名称:LabExe,代码行数:25,代码来源:GInstructionView.cpp

示例4: updateDirtyRect

void DrawPathTool::updateDirtyRect()
{
	QRectF rect;
	
	if (dragging)
	{
		rectIncludeSafe(rect, click_pos_map);
		rectInclude(rect, cur_pos_map);
	}
	if (editingInProgress() && previous_point_is_curve_point)
	{
		rectIncludeSafe(rect, previous_pos_map);
		rectInclude(rect, previous_drag_map);
	}
	if ((editingInProgress() && !dragging) ||
		(!editingInProgress() && !shift_pressed && ctrl_pressed) ||
		(!editingInProgress() && (picking_angle || picked_angle)))
	{
		angle_helper->includeDirtyRect(rect);
	}
	if (shift_pressed || (!editingInProgress() && ctrl_pressed))
		snap_helper->includeDirtyRect(rect);
	includePreviewRects(rect);
	
	if (is_helper_tool)
		emit(dirtyRectChanged(rect));
	else
	{
		if (rect.isValid())
			map()->setDrawingBoundingBox(rect, qMax(qMax(dragging ? 1 : 0, angle_helper->getDisplayRadius()), snap_helper->getDisplayRadius()), true);
		else
			map()->clearDrawingBoundingBox();
	}
}
开发者ID:kjetilk,项目名称:mapper,代码行数:34,代码来源:tool_draw_path.cpp

示例5: updateVisibleAreas

void PdfThumbProvider::updateVisibleAreas()
{
    clearVisibleAreas();

    QRectF sceneRect;
    QList<QGraphicsItem *> visibleItems;

    if(0 != data->scene) {
        //MSceneManager * sceneManager = MApplication::activeApplicationWindow()->sceneManager();
        //QSizeF size = sceneManager->visibleSceneSize(M::Landscape);
        QSizeF size = ApplicationWindow::visibleSize(M::Landscape);
        sceneRect = QRectF(QPoint(0,0), size);
        visibleItems = data->scene->items(sceneRect, Qt::IntersectsItemBoundingRect);

    }

    foreach(QGraphicsItem * item, visibleItems) {

        ThumbWidget *newitem = qgraphicsitem_cast<ThumbWidget *>(item);

        if(0 != newitem &&  data->widgetName == newitem->objectName()) {
            //Lets get sceneRect in wigdets coodinate
            QRectF temp= newitem->mapRectFromScene(sceneRect);
            //Lets get intersecting between sceneRect and widgets area
            QRectF visibleArea = temp.intersected(newitem->rect());

            //If widget intersects with sceneRect then mark it as visible item

            if(visibleArea.isValid()) {
                addVisibleAreas(newitem->getPageIndex(), visibleArea, newitem->size());
            }
        }
    }
开发者ID:boudewijnrempt,项目名称:office-tools,代码行数:33,代码来源:pdfthumbprovider.cpp

示例6: curveLineAt

QLineF CurveTracker::curveLineAt( 
    const QwtPlotCurve *curve, double x ) const
{
    QLineF line;

    if ( curve->dataSize() >= 2 )
    {
        const QRectF br = curve->boundingRect();
        if ( br.isValid() && x >= br.left() && x <= br.right() )
        {
            int index = qwtUpperSampleIndex<QPointF>( 
                *curve->data(), x, compareX() );

            if ( index == -1 && 
                x == curve->sample( curve->dataSize() - 1 ).x() )
            {
                // the last sample is excluded from qwtUpperSampleIndex
                index = curve->dataSize() - 1;
            }

            if ( index > 0 )
            {
                line.setP1( curve->sample( index - 1 ) );
                line.setP2( curve->sample( index ) );
            }
        }
    }
    
    return line;
}
开发者ID:0vermind,项目名称:NeoLoader,代码行数:30,代码来源:curvetracker.cpp

示例7: calculateExtent

QRectF MapPart::calculateExtent(bool include_helper_symbols) const
{
	QRectF rect;
	
	int i = 0;
	int size = objects.size();
	while (size > i && !rect.isValid())
	{
		if ((include_helper_symbols || !objects[i]->getSymbol()->isHelperSymbol()) && !objects[i]->getSymbol()->isHidden())
		{
			objects[i]->update();
			rect = objects[i]->getExtent();
		}
		++i;
	}
	
	for (; i < size; ++i)
	{
		if ((include_helper_symbols || !objects[i]->getSymbol()->isHelperSymbol()) && !objects[i]->getSymbol()->isHidden())
		{
			objects[i]->update();
			rectInclude(rect, objects[i]->getExtent());
		}
	}
	
	return rect;
}
开发者ID:aivarszo,项目名称:mapper,代码行数:27,代码来源:map_part.cpp

示例8: handleMoving

void QReportWidgetResizer::handleMoving(QPointF point)
{
    QReportResizeHandle *s = qobject_cast<QReportResizeHandle*> (sender());
    QRectF rc = resizeRect;

    QReportMoveEvent e(point, point);
    emit pointGridNeeded(&e);

    if (!e.isAccepted()) return;

    if (s->resizeDirection() & ::Top) rc.setTop(e.point().y());
    if (s->resizeDirection() & ::Left) rc.setLeft(e.point().x());
    if (s->resizeDirection() & ::Right) rc.setRight(e.point().x());
    if (s->resizeDirection() & ::Bottom) rc.setBottom(e.point().y());

    if(_selectedWidgets.count() == 1){
        if(rc.width() < _selectedWidgets.at(0)->minimumSize().width())
            rc.setWidth(_selectedWidgets.at(0)->minimumSize().width());
        if(rc.height() < _selectedWidgets.at(0)->minimumSize().height())
            rc.setHeight(_selectedWidgets.at(0)->minimumSize().height());
    }

    if (rc.isValid()) {
        setResezeHandlePos(s, e.point());

        resizeRect = rc;
        proccessNewRect(rc);

        setHandlesOnItem(rc);
    }//if
}
开发者ID:HamedMasafi,项目名称:QtReport,代码行数:31,代码来源:qreportwidgetresizer.cpp

示例9: 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

示例10: updateRect

void AbstractGraphicsRectItem::updateRect(const QRectF &rect)
{
    if (!rect.isNull() && rect.isValid()) {
        setRect(rect);
        updateHandlesPosition();
    }
}
开发者ID:benklop,项目名称:kaption,代码行数:7,代码来源:abstractgraphicsrectitem.cpp

示例11: doData

QVariant ComplexControlModel::doData(int row, int column, int role) const
{
  if (role == Qt::DecorationRole) {
    QPixmap pixmap(m_interface->cellSizeHint());
    QPainter painter(&pixmap);
    Util::drawTransparencyPattern(&painter, pixmap.rect());
    painter.scale(m_interface->cellZoom(), m_interface->cellZoom());

    QScopedPointer<QStyleOptionComplex> opt(
      qstyleoption_cast<QStyleOptionComplex*>(complexControlElements[row].styleOptionFactory()));
    Q_ASSERT(opt);
    fillStyleOption(opt.data(), column);
    m_style->drawComplexControl(complexControlElements[row].control, opt.data(), &painter);

    int colorIndex = 7;
    for (int i = 0; i < 32; ++i) {
      QStyle::SubControl sc = static_cast<QStyle::SubControl>(1 << i);
      if (sc & complexControlElements[row].subControls) {
        QRectF scRect =
          m_style->subControlRect(complexControlElements[row].control, opt.data(), sc);
        scRect.adjust(0, 0, -1.0 / m_interface->cellZoom(), -1.0 / m_interface->cellZoom());
        if (scRect.isValid() && !scRect.isEmpty()) {
          // HACK: add some real color mapping
          painter.setPen(static_cast<Qt::GlobalColor>(colorIndex++));
          painter.drawRect(scRect);
        }
      }
    }

    return pixmap;
  }

  return AbstractStyleElementStateTable::doData(row, column, role);
}
开发者ID:dfries,项目名称:GammaRay,代码行数:34,代码来源:complexcontrolmodel.cpp

示例12: updateFrameRect

void RectTool::updateFrameRect()
{
	QRectF rect;
	
	if (d->mode == Inserting)
	{
		d->frameItem->setVisible(true);
		rect = d->layerToAdd->rect();
	}
	else
	{
		if (!(d->selectedLayerInfos.size() == 1 && d->selectedLayerInfos.at(0).rectLayer->isType<RectLayer>()))
		{
			for (const auto &info : d->selectedLayerInfos)
			{
				if (info.rectLayer)
					rect |= info.rectLayer->rect();
				else if (info.original->isType<RasterLayer>())
					rect |= info.rasterBoundingRect.translated(info.rasterOffset);
			}
		}
	}
	
	// set path
	if (rect.isValid())
	{
		QPainterPath path;
		path.addRect(rect);
		
		d->frameItem->setVisible(true);
		d->frameItem->setPath(path * canvas()->transforms()->sceneToView);
	}
	else
		d->frameItem->setVisible(false);
}
开发者ID:h2so5,项目名称:PaintField,代码行数:35,代码来源:recttool.cpp

示例13: boundingRect

/*!
  \return Bounding rectangle of all samples.
  For an empty series the rectangle is invalid.
*/
QRectF QwtPlotHistogram::boundingRect() const
{
    QRectF rect = d_series->boundingRect();
    if ( !rect.isValid() )
        return rect;

    if ( orientation() == Qt::Horizontal )
    {
        rect = QRectF( rect.y(), rect.x(),
            rect.height(), rect.width() );

        if ( rect.left() > d_data->baseline )
            rect.setLeft( d_data->baseline );
        else if ( rect.right() < d_data->baseline )
            rect.setRight( d_data->baseline );
    }
    else
    {
        if ( rect.bottom() < d_data->baseline )
            rect.setBottom( d_data->baseline );
        else if ( rect.top() > d_data->baseline )
            rect.setTop( d_data->baseline );
    }

    return rect;
}
开发者ID:Aconex,项目名称:pcp,代码行数:30,代码来源:qwt_plot_histogram.cpp

示例14: boundingRect

/*!
  \return Bounding rectangle of all samples.
  For an empty series the rectangle is invalid.
*/
QRectF QwtPlotIntervalCurve::boundingRect() const
{
    QRectF rect = QwtPlotSeriesItem<QwtIntervalSample>::boundingRect();
    if ( rect.isValid() && orientation() == Qt::Vertical )
        rect.setRect( rect.y(), rect.x(), rect.height(), rect.width() );

    return rect;
}
开发者ID:1heinz,项目名称:TauLabs,代码行数:12,代码来源:qwt_plot_intervalcurve.cpp

示例15: geometryChanged

void SvgItem::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
{
    if (newGeometry.size() != oldGeometry.size() && newGeometry.isValid()) {
        scheduleImageUpdate();
    }

    QQuickItem::geometryChanged(newGeometry, oldGeometry);
}
开发者ID:KDE,项目名称:plasma-framework,代码行数:8,代码来源:svgitem.cpp


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