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


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

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


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

示例1: drawImage

void QPainterFilterContext::drawImage(const QRectF &target, const QImage &image, const QRectF &source, Qt::ImageConversionFlags flags)
{
    if (!prepare())
        return;
    if (source.isNull())
        painter->drawImage(target, image, QRectF(0, 0, image.width(), image.height()), flags);
    else
        painter->drawImage(target, image, source, flags);
    painter->restore();
}
开发者ID:Czhian,项目名称:QtAV,代码行数:10,代码来源:FilterContext.cpp

示例2: reload

void BlurItem::reload(const QPixmap &pixmap)
{
  const QRectF r = rect();
  if (r.isNull() && !r.isValid())
    return;

  QTransform t = sceneTransform();
  t.translate(qAbs(scene()->sceneRect().left()), qAbs(scene()->sceneRect().top()));
  m_item->setPixmap(pixmap.copy(t.mapRect(r).toRect()));
}
开发者ID:impomezia,项目名称:screenpic,代码行数:10,代码来源:BlurItem.cpp

示例3: drawPlainText

void QPainterFilterContext::drawPlainText(const QRectF &rect, int flags, const QString &text)
{
    if (!prepare())
        return;
    if (rect.isNull())
        painter->drawText(rect.topLeft(), text);
    else
        painter->drawText(rect, flags, text);
    painter->restore();
}
开发者ID:Andytianya,项目名称:QtAV,代码行数:10,代码来源:FilterContext.cpp

示例4: drawTileLayer

void OrthogonalRenderer::drawTileLayer(QPainter *painter,
                                       const TileLayer *layer,
                                       const QRectF &exposed) const
{
    const QTransform savedTransform = painter->transform();

    const int tileWidth = map()->tileWidth();
    const int tileHeight = map()->tileHeight();
    const QPointF layerPos(layer->x() * tileWidth,
                           layer->y() * tileHeight);

    painter->translate(layerPos);

    int startX = 0;
    int startY = 0;
    int endX = layer->width();
    int endY = layer->height();

    if (!exposed.isNull()) {
        QMargins drawMargins = layer->drawMargins();
        drawMargins.setTop(drawMargins.top() - tileHeight);
        drawMargins.setRight(drawMargins.right() - tileWidth);

        QRectF rect = exposed.adjusted(-drawMargins.right(),
                                       -drawMargins.bottom(),
                                       drawMargins.left(),
                                       drawMargins.top());

        rect.translate(-layerPos);

        startX = qMax((int) rect.x() / tileWidth, 0);
        startY = qMax((int) rect.y() / tileHeight, 0);
        endX = qMin((int) std::ceil(rect.right()) / tileWidth + 1, endX);
        endY = qMin((int) std::ceil(rect.bottom()) / tileHeight + 1, endY);
    }

    CellRenderer renderer(painter);

    for (int y = startY; y < endY; ++y) {
        for (int x = startX; x < endX; ++x) {
            const Cell &cell = layer->cellAt(x, y);
            if (cell.isEmpty())
                continue;

            renderer.render(cell,
                            QPointF(x * tileWidth, (y + 1) * tileHeight),
                            CellRenderer::BottomLeft);
        }
    }

    renderer.flush();

    painter->setTransform(savedTransform);
}
开发者ID:ErwanLeroux,项目名称:CatchChallenger,代码行数:54,代码来源:tiled_orthogonalrenderer.cpp

示例5: boundingRect

QRectF OrthogonalRenderer::boundingRect(const MapObject *object) const
{
    const QRectF bounds = object->bounds();
    const QRectF rect(tileToPixelCoords(bounds.topLeft()),
                      tileToPixelCoords(bounds.bottomRight()));

    QRectF boundingRect;

    if (!object->cell().isEmpty()) {
        const QPointF bottomLeft = rect.topLeft();
        const Tile *tile = object->cell().tile;
        const QSize imgSize = tile->image().size();
        const QPoint tileOffset = tile->tileset()->tileOffset();
        boundingRect = QRectF(bottomLeft.x() + tileOffset.x(),
                              bottomLeft.y() + tileOffset.y() - imgSize.height(),
                              imgSize.width(),
                              imgSize.height()).adjusted(-1, -1, 1, 1);
    } else {
        const qreal extraSpace = qMax(objectLineWidth() / 2, qreal(1));

        switch (object->shape()) {
        case MapObject::Ellipse:
        case MapObject::Rectangle:
            if (rect.isNull()) {
                boundingRect = rect.adjusted(-10 - extraSpace,
                                             -10 - extraSpace,
                                             10 + extraSpace + 1,
                                             10 + extraSpace + 1);
            } else {
                const int nameHeight = object->name().isEmpty() ? 0 : 15;
                boundingRect = rect.adjusted(-extraSpace,
                                             -nameHeight - extraSpace,
                                             extraSpace + 1,
                                             extraSpace + 1);
            }
            break;

        case MapObject::Polygon:
        case MapObject::Polyline: {
            const QPointF &pos = object->position();
            const QPolygonF polygon = object->polygon().translated(pos);
            QPolygonF screenPolygon = tileToPixelCoords(polygon);
            boundingRect = screenPolygon.boundingRect().adjusted(-extraSpace,
                                                                 -extraSpace,
                                                                 extraSpace + 1,
                                                                 extraSpace + 1);
            break;
        }
        }
    }

    return boundingRect;
}
开发者ID:4everalone,项目名称:tiled,代码行数:53,代码来源:orthogonalrenderer.cpp

示例6: boundingRect

QRectF OrthogonalRenderer::boundingRect(const MapObject *object) const
{
    const QRectF bounds = object->bounds();
    const QRectF rect(tileToPixelCoords(bounds.topLeft()),
                      tileToPixelCoords(bounds.bottomRight()));

    // The -2 and +3 are to account for the pen width and shadow
    if (rect.isNull())
        return rect.adjusted(-15 - 2, -25 - 2, 10 + 3, 10 + 3);
    else
        return rect.adjusted(-2, -15 - 2, 3, 3);
}
开发者ID:KaraJ,项目名称:conpenguum,代码行数:12,代码来源:orthogonalrenderer.cpp

示例7: contentsScale

qreal PathView::contentsScale() const
{
	QRectF br = _tr | _rr | _wr;

	if (br.isNull())
		return mapScale(ZOOM_MAX);

	QPointF sc(br.width() / (viewport()->width() - MARGIN/2),
	  br.height() / (viewport()->height() - MARGIN/2));

	return qMax(sc.x(), sc.y());
}
开发者ID:tumic0,项目名称:GPXSee,代码行数:12,代码来源:pathview.cpp

示例8: contentsSceneRect

QRectF PathView::contentsSceneRect() const
{
	qreal scale = mapScale(_zoom);
	QRectF br = scaled(_tr | _rr | _wr, 1.0/scale);

	if (br.isNull())
		return QRectF(QPointF(_wp.x() / scale - Tile::size()/2,
		  _wp.y() /scale - Tile::size()/2), QSizeF(Tile::size(), Tile::size()));
	else
		return br.adjusted(-Tile::size(), -Tile::size(), Tile::size(),
		  Tile::size());
}
开发者ID:tumic0,项目名称:GPXSee,代码行数:12,代码来源:pathview.cpp

示例9: painter

bool
BubbleAnimation::nextFrame(
	QColor const& head_color, QColor const& tail_color,
	QPaintDevice* pd, QRectF rect)
{
	if (rect.isNull()) {
		rect = QRectF(0.0, 0.0, pd->width(), pd->height());
	}
	
	QPainter painter(pd);
	return nextFrame(head_color, tail_color, &painter, rect);
}
开发者ID:4sp1r3,项目名称:scantailor,代码行数:12,代码来源:BubbleAnimation.cpp

示例10: draw

void QVGPixmapBlurFilter::draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect) const
{
    if (src.isNull())
        return;

    if (src.pixmapData()->classId() != QPixmapData::OpenVGClass) {
        // The pixmap data is not an instance of QVGPixmapData, so fall
        // back to the default blur filter implementation.
        QPixmapBlurFilter::draw(painter, dest, src, srcRect);
        return;
    }

    QVGPixmapData *pd = static_cast<QVGPixmapData *>(src.pixmapData());

    VGImage srcImage = pd->toVGImage();
    if (srcImage == VG_INVALID_HANDLE)
        return;

    QSize size = pd->size();
    VGImage dstImage = QVGImagePool::instance()->createTemporaryImage
        (VG_sARGB_8888_PRE, size.width(), size.height(),
         VG_IMAGE_QUALITY_FASTER, pd);
    if (dstImage == VG_INVALID_HANDLE)
        return;

    // Clamp the radius range.  We divide by 2 because the OpenVG blur
    // is "too blurry" compared to the default raster implementation.
    VGfloat maxRadius = VGfloat(vgGeti(VG_MAX_GAUSSIAN_STD_DEVIATION));
    VGfloat radiusF = VGfloat(radius()) / 2.0f;
    if (radiusF < 0.001f)
        radiusF = 0.001f;
    else if (radiusF > maxRadius)
        radiusF = maxRadius;

    vgGaussianBlur(dstImage, srcImage, radiusF, radiusF, VG_TILE_PAD);

    VGImage child = VG_INVALID_HANDLE;

    if (srcRect.isNull() ||
        (srcRect.topLeft().isNull() && srcRect.size() == size)) {
        child = dstImage;
    } else {
        QRect src = srcRect.toRect();
        child = vgChildImage(dstImage, src.x(), src.y(), src.width(), src.height());
    }

    qt_vg_drawVGImage(painter, dest, child);

    if(child != dstImage)
        vgDestroyImage(child);
    QVGImagePool::instance()->releaseImage(0, dstImage);
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:52,代码来源:qpixmapfilter_vg.cpp

示例11: tryPerformAdaptableVisualization

bool OLSAdaptiveNodeTextAreaVisualizer::tryPerformAdaptableVisualization(OLSOntologyGraphNodeItem *nodeToVisualize,
            OLSOntologyGraphNodeItem *nodeWithVisualizeInfo, QPainter *)
{
    if (nodeToVisualize == nullptr)
        return false;
    QRectF rect = enlargeRect(nodeToVisualize->textRect(), getParameterValueOrDefaultDouble(m_offsetStr, nodeWithVisualizeInfo, m_offset));
    if (!rect.isNull())
        nodeToVisualize->setRect(rect);
    else
        nodeToVisualize->setRect(nodeToVisualize->textRect());
    qDebug() << "OLSAdaptiveNodeTextAreaVisualizer";
    return true;
}
开发者ID:KirillReuk,项目名称:oscar,代码行数:13,代码来源:OLSAdaptiveNodeTextAreaVisualizer.cpp

示例12: shape

QPainterPath OrthogonalRenderer::shape(const MapObject *object) const
{
    const QRectF bounds = object->bounds();
    const QRectF rect(tileToPixelCoords(bounds.topLeft()),
                      tileToPixelCoords(bounds.bottomRight()));

    QPainterPath path;
    if (rect.isNull())
        path.addEllipse(rect.topLeft(), 20, 20);
    else
        path.addRoundedRect(rect, 10, 10);
    return path;
}
开发者ID:KaraJ,项目名称:conpenguum,代码行数:13,代码来源:orthogonalrenderer.cpp

示例13: drawGrid

void PrintBedView::drawGrid(QPainter *painter, const QRectF &rect)
{
	double gridDensity = 10;
	int thickLineWidth = 3;

	double thickLineSceneWidth = thickLineWidth / transform().m11();
	QRectF toDraw = m_gridRect.intersected(rect.adjusted(-thickLineSceneWidth, -thickLineSceneWidth,
										   thickLineSceneWidth, thickLineSceneWidth));

	if (toDraw.isNull()) {
		return;
	}

	QPen defaultPen = painter->pen();
	QPen thickPen = defaultPen;
	thickPen.setWidth(thickLineWidth);
	thickPen.setCosmetic(true);

	int lineNo = static_cast<int>(toDraw.left() / gridDensity);
	if (toDraw.left() > 0) {
		++lineNo;
	}

	for (double x = lineNo * gridDensity; x <= toDraw.right(); x += gridDensity, ++lineNo) {
		if (lineNo % 5 == 0) {
			painter->setPen(thickPen);
			painter->drawLine(QPointF(x, toDraw.top()), QPointF(x, toDraw.bottom()));
			painter->setPen(defaultPen);
		} else {
			painter->drawLine(QPointF(x, toDraw.top()), QPointF(x, toDraw.bottom()));
		}
	}

	lineNo = static_cast<int>(toDraw.top() / gridDensity);
	if (toDraw.top() > 0) {
		++lineNo;
	}

	for (double y = lineNo * gridDensity; y <= toDraw.bottom(); y += gridDensity, ++lineNo) {
		if (lineNo % 5 == 0) {
			painter->setPen(thickPen);
			painter->drawLine(QPointF(toDraw.left(), y), QPointF(toDraw.right(), y));
			painter->setPen(defaultPen);
		} else {
			painter->drawLine(QPointF(toDraw.left(), y), QPointF(toDraw.right(), y));
		}
	}

}
开发者ID:miso-,项目名称:vcd2path,代码行数:49,代码来源:PrintBedView.cpp

示例14: boundsOfChildren

QRectF boundsOfChildren( QGraphicsItem const * qgi )
{
    typedef QList<QGraphicsItem*> QGIL;
    QGIL ch( qboard::childItems(qgi) );
    QRectF r;
    for( QGIL::const_iterator it = ch.begin();
	 ch.end() != it; ++it )
    {
	QGraphicsItem const * x = *it;
	QRectF r2( x->mapToParent(x->pos()), x->boundingRect().size() );
	r = r.unite( r2 );
    }
    if(1  && ! r.isNull() ) qDebug() << "bounds of children ="<<r;
    return r;
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qboard,代码行数:15,代码来源:QGIPiece.cpp

示例15: updateRect

void BoxTextGraphicsItem::updateRect(const QRectF &rect)
{
    QRectF r = rect;
    if (!r.isNull() && r.isValid()) {
        if (r.height() < m_gi->boundingRect().height()+18) {
            r.setHeight(m_gi->boundingRect().height()+18);
        }
        if (r.width() < MINTEXTWIDTH) {
            r.setWidth(MINTEXTWIDTH);
        }
        m_gi->show();
        adaptTextItemWidth(r);
        setRect(r);
        updateHandlesPosition();
    }
}
开发者ID:ItTakesTwo,项目名称:screencloud,代码行数:16,代码来源:boxtextgraphicsitem.cpp


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