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


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

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


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

示例1: drawPixmap

void QPdfEngine::drawPixmap (const QRectF &rectangle, const QPixmap &pixmap, const QRectF &sr)
{
    if (sr.isEmpty() || rectangle.isEmpty() || pixmap.isNull())
        return;
    Q_D(QPdfEngine);

    QBrush b = d->brush;

    QRect sourceRect = sr.toRect();
    QPixmap pm = sourceRect != pixmap.rect() ? pixmap.copy(sourceRect) : pixmap;
    QImage image = pm.toImage();
    bool bitmap = true;
    const int object = d->addImage(image, &bitmap, pm.cacheKey());
    if (object < 0)
        return;

    *d->currentPage << "q\n/GSa gs\n";
    *d->currentPage
        << QPdf::generateMatrix(QTransform(rectangle.width() / sr.width(), 0, 0, rectangle.height() / sr.height(),
                                           rectangle.x(), rectangle.y()) * (d->simplePen ? QTransform() : d->stroker.matrix));
    if (bitmap) {
        // set current pen as d->brush
        d->brush = d->pen.brush();
    }
    setBrush();
    d->currentPage->streamImage(image.width(), image.height(), object);
    *d->currentPage << "Q\n";

    d->brush = b;
}
开发者ID:NikhilNJ,项目名称:screenplay-dx,代码行数:30,代码来源:qprintengine_pdf.cpp

示例2: drawPlainText

void X11FilterContext::drawPlainText(const QRectF &rect, int flags, const QString &text)
{
     if (text.isEmpty())
         return;
     if (rect.isEmpty()) {
         drawPlainText(rect.topLeft(), text);
         return;
     }
     if (test_img.size() != rect.size().toSize()) {
         test_img = QImage(rect.size().toSize(), QImage::Format_ARGB32); //TODO: create once
     }
     painter->begin(&test_img);
     prepare();
     QRectF br = painter->boundingRect(rect, flags, text);
     painter->end();
     if (br.isEmpty())
         return;

    if (text == this->text && plain && mask_pix) {
        renderTextImageX11(0, br.topLeft());
        return;
    }
    this->text = text;
    this->plain = true;

    text_q = QImage(br.size().toSize(), QImage::Format_ARGB32);
    text_q.fill(QColor(0, 0, 0, 0));
    painter->begin(&text_q);
    prepare();
    painter->drawText(0, 0, br.width(), br.height(), Qt::AlignCenter, text);
    painter->end();
    renderTextImageX11(&text_q, br.topLeft());
}
开发者ID:Jornason,项目名称:QtAV,代码行数:33,代码来源:X11FilterContext.cpp

示例3: be

/*!
  \brief Render the plot to a QSvgGenerator

  If the generator has a view box, the plot will be rendered into it.
  If it has no viewBox but a valid size the target coordinates
  will be (0, 0, generator.width(), generator.height()). Otherwise
  the target rectangle will be QRectF(0, 0, 800, 600);

  \param plot Plot to be rendered
  \param generator SVG generator
*/
void QwtPolarRenderer::renderTo(
    QwtPolarPlot *plot, QSvgGenerator &generator ) const
{
    QRectF rect = generator.viewBoxF();
    if ( rect.isEmpty() )
        rect.setRect( 0, 0, generator.width(), generator.height() );

    if ( rect.isEmpty() )
        rect.setRect( 0, 0, 800, 600 ); // something

    QPainter p( &generator );
    render( plot, &p, rect );
}
开发者ID:3liz,项目名称:Quantum-GIS,代码行数:24,代码来源:qwt_polar_renderer.cpp

示例4: compose

QImage QwtPlotRasterItem::compose( 
    const QwtScaleMap &xMap, const QwtScaleMap &yMap,
    const QRectF &imageArea, const QRectF &paintRect, 
    const QSize &imageSize, bool doCache) const
{
    QImage image;
    if ( imageArea.isEmpty() || paintRect.isEmpty() || imageSize.isEmpty() )
        return image;

    if ( doCache )
    {
        if ( !d_data->cache.image.isNull()
            && d_data->cache.area == imageArea
            && d_data->cache.size == paintRect.size() )
        {
            image = d_data->cache.image;
        }
    }

    if ( image.isNull() )
    {
        double dx = 0.0;
        if ( paintRect.toRect().width() > imageSize.width() )
            dx = imageArea.width() / imageSize.width();

        const QwtScaleMap xxMap = 
            imageMap(Qt::Horizontal, xMap, imageArea, imageSize, dx);
        
        double dy = 0.0;
        if ( paintRect.toRect().height() > imageSize.height() )
            dy = imageArea.height() / imageSize.height();

        const QwtScaleMap yyMap = 
            imageMap(Qt::Vertical, yMap, imageArea, imageSize, dy);

        image = renderImage( xxMap, yyMap, imageArea, imageSize );

        if ( doCache )
        {
            d_data->cache.area = imageArea;
            d_data->cache.size = paintRect.size();
            d_data->cache.image = image;
        }
    }

    if ( d_data->alpha >= 0 && d_data->alpha < 255 )
        image = toRgba( image, d_data->alpha );

    return image;
}
开发者ID:PrincetonPAVE,项目名称:old_igvc,代码行数:50,代码来源:qwt_plot_rasteritem.cpp

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

示例6: qwtDrawSvgSymbols

static inline void qwtDrawSvgSymbols( QPainter *painter, 
    const QPointF *points, int numPoints, 
    QSvgRenderer *renderer, const QwtSymbol &symbol )
{
    if ( renderer == NULL || !renderer->isValid() )
        return;

    const QRectF viewBox = renderer->viewBoxF();
    if ( viewBox.isEmpty() )
        return;

    QSizeF sz = symbol.size();
    if ( !sz.isValid() )
        sz = viewBox.size();

    const double sx = sz.width() / viewBox.width();
    const double sy = sz.height() / viewBox.height();

    QPointF pinPoint = viewBox.center();
    if ( symbol.isPinPointEnabled() )
        pinPoint = symbol.pinPoint();

    const double dx = sx * ( pinPoint.x() - viewBox.left() );
    const double dy = sy * ( pinPoint.y() - viewBox.top() );

    for ( int i = 0; i < numPoints; i++ )
    {
        const double x = points[i].x() - dx;
        const double y = points[i].y() - dy;

        renderer->render( painter, 
            QRectF( x, y, sz.width(), sz.height() ) );
    }
}
开发者ID:CaptainFalco,项目名称:OpenPilot,代码行数:34,代码来源:qwt_symbol.cpp

示例7: clipAndDrawPixmap

void QBlitterPaintEnginePrivate::clipAndDrawPixmap(const QRectF &clip, const QRectF &target, const QPixmap &pm, const QRectF &sr, bool opacity)
{
    Q_Q(QBlitterPaintEngine);
    QRectF intersectedRect = clip.intersected(target);
    if (intersectedRect.isEmpty())
        return;
    QRectF source = sr;
    if (intersectedRect.size() != target.size()) {
        if (sr.size() == target.size()) {
            // no resize
            qreal deltaTop = target.top() - intersectedRect.top();
            qreal deltaLeft = target.left() - intersectedRect.left();
            qreal deltaBottom = target.bottom() - intersectedRect.bottom();
            qreal deltaRight = target.right() - intersectedRect.right();
            source.adjust(-deltaLeft, -deltaTop, -deltaRight, -deltaBottom);
        } else {
            // resize case
            qreal hFactor = sr.size().width() / target.size().width();
            qreal vFactor = sr.size().height() / target.size().height();
            qreal deltaTop = (target.top() - intersectedRect.top()) * vFactor;
            qreal deltaLeft = (target.left() - intersectedRect.left()) * hFactor;
            qreal deltaBottom = (target.bottom() - intersectedRect.bottom()) * vFactor;
            qreal deltaRight = (target.right() - intersectedRect.right()) * hFactor;
            source.adjust(-deltaLeft, -deltaTop, -deltaRight, -deltaBottom);
        }
    }
    pmData->unmarkRasterOverlay(intersectedRect);
    if (opacity)
        pmData->blittable()->drawPixmapOpacity(intersectedRect, pm, source, q->state()->compositionMode(), q->state()->opacity);
    else
        pmData->blittable()->drawPixmap(intersectedRect, pm, source);
}
开发者ID:13W,项目名称:phantomjs,代码行数:32,代码来源:qpaintengine_blitter.cpp

示例8: runPartialDst

void KisPerspectiveTransformWorker::runPartialDst(KisPaintDeviceSP srcDev,
                                                  KisPaintDeviceSP dstDev,
                                                  const QRect &dstRect)
{
    if (m_isIdentity) {
        KisPainter::copyAreaOptimizedOldData(dstRect.topLeft(), srcDev, dstDev, dstRect);
        return;
    }

    QRectF srcClipRect = srcDev->exactBounds();
    if (srcClipRect.isEmpty()) return;

    KisProgressUpdateHelper progressHelper(m_progressUpdater, 100, dstRect.height());

    KisRandomSubAccessorSP srcAcc = srcDev->createRandomSubAccessor();
    KisRandomAccessorSP accessor = dstDev->createRandomAccessorNG(dstRect.x(), dstRect.y());

    for (int y = dstRect.y(); y < dstRect.y() + dstRect.height(); ++y) {
        for (int x = dstRect.x(); x < dstRect.x() + dstRect.width(); ++x) {

            QPointF dstPoint(x, y);
            QPointF srcPoint = m_backwardTransform.map(dstPoint);

            if (srcClipRect.contains(srcPoint)) {
                accessor->moveTo(dstPoint.x(), dstPoint.y());
                srcAcc->moveTo(srcPoint.x(), srcPoint.y());
                srcAcc->sampledOldRawData(accessor->rawData());
            }
        }
        progressHelper.step();
    }

}
开发者ID:TheTypoMaster,项目名称:calligra,代码行数:33,代码来源:kis_perspectivetransform_worker.cpp

示例9: applyViewboxTransformation

void KPathShapePrivate::applyViewboxTransformation(const KXmlElement &element)
{
    Q_Q(KPathShape);
    // apply viewbox transformation
    QRectF viewBox = q->loadOdfViewbox(element);
    if (! viewBox.isEmpty()) {
        // load the desired size
        QSizeF size;
        size.setWidth(KUnit::parseValue(element.attributeNS(KOdfXmlNS::svg, "width", QString())));
        size.setHeight(KUnit::parseValue(element.attributeNS(KOdfXmlNS::svg, "height", QString())));

        // load the desired position
        QPointF pos;
        pos.setX(KUnit::parseValue(element.attributeNS(KOdfXmlNS::svg, "x", QString())));
        pos.setY(KUnit::parseValue(element.attributeNS(KOdfXmlNS::svg, "y", QString())));

        // create matrix to transform original path data into desired size and position
        QTransform viewMatrix;
        viewMatrix.translate(-viewBox.left(), -viewBox.top());
        viewMatrix.scale(size.width() / viewBox.width(), size.height() / viewBox.height());
        viewMatrix.translate(pos.x(), pos.y());

        // transform the path data
        map(viewMatrix);
    }
}
开发者ID:KDE,项目名称:koffice,代码行数:26,代码来源:KPathShape.cpp

示例10: toTikzPath

QString QTikzPicturePrivate::toTikzPath(const QRectF & rect) const
{
    if (rect.isEmpty()) return QString();

    const QString path = toCoord(rect.topLeft()) + " rectangle "
                       + toCoord(rect.bottomRight());
    return path;
}
开发者ID:dhaumann,项目名称:qtikzpicture,代码行数:8,代码来源:qtikzpicture.cpp

示例11: computeVisibleSet

Indices PixelStreamUpdater::computeVisibleSet(const QRectF& visibleTilesArea,
                                              const uint lod,
                                              const uint channel) const
{
    Q_UNUSED(lod);
    if (!_frameLeftOrMono || visibleTilesArea.isEmpty())
        return Indices{};
    return _processorLeft->computeVisibleSet(visibleTilesArea, channel);
}
开发者ID:BlueBrain,项目名称:Tide,代码行数:9,代码来源:PixelStreamUpdater.cpp

示例12: select

void Canvas::select(QRectF & rect)
{
    if (rect.isEmpty()) {
        m_found = m_rtree.contains(rect.topLeft());
    } else {
        m_found = m_rtree.intersects(rect);
    }
    update();
}
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:9,代码来源:rtreetestapp.cpp

示例13: draw

// Drawing Routines
void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dst,
                       const FloatRect& src, ColorSpace styleColorSpace, CompositeOperator op)
{
    QRectF normalizedDst = dst.normalized();
    QRectF normalizedSrc = src.normalized();

    startAnimation();

    if (normalizedSrc.isEmpty() || normalizedDst.isEmpty())
        return;

    QPixmap* image = nativeImageForCurrentFrame();
    if (!image)
        return;

    if (mayFillWithSolidColor()) {
        fillWithSolidColor(ctxt, normalizedDst, solidColor(), styleColorSpace, op);
        return;
    }

#if ENABLE(IMAGE_DECODER_DOWN_SAMPLING)
    normalizedSrc = adjustSourceRectForDownSampling(normalizedSrc, image->size());
#endif

    CompositeOperator previousOperator = ctxt->compositeOperation();
    ctxt->setCompositeOperation(!image->hasAlpha() && op == CompositeSourceOver ? CompositeCopy : op);

    if (ctxt->hasShadow()) {
        ShadowBlur* shadow = ctxt->shadowBlur();
        GraphicsContext* shadowContext = shadow->beginShadowLayer(ctxt, normalizedDst);
        if (shadowContext) {
            QPainter* shadowPainter = shadowContext->platformContext();
            shadowPainter->drawPixmap(normalizedDst, *image, normalizedSrc);
            shadow->endShadowLayer(ctxt);
        }
    }

    ctxt->platformContext()->drawPixmap(normalizedDst, *image, normalizedSrc);

    ctxt->setCompositeOperation(previousOperator);

    if (imageObserver())
        imageObserver()->didDraw(this);
}
开发者ID:victusfate,项目名称:webkit-graphics,代码行数:45,代码来源:ImageQt.cpp

示例14: drawTileSelection

void OrthogonalRenderer::drawTileSelection(QPainter *painter,
                                           const QRegion &region,
                                           const QColor &color,
                                           const QRectF &exposed) const
{
    foreach (const QRect &r, region.rects()) {
        const QRectF toFill = QRectF(boundingRect(r)).intersected(exposed);
        if (!toFill.isEmpty())
            painter->fillRect(toFill, color);
    }
}
开发者ID:ErwanLeroux,项目名称:CatchChallenger,代码行数:11,代码来源:tiled_orthogonalrenderer.cpp

示例15: drawBackground

void MPlainWindow::drawBackground(QPainter *painter, const QRectF &rect)
{
    if (not host || rect.isEmpty()) {
        return;
    }

    const QPixmap bg(host->background());
    if (not bg.isNull()) {
        painter->drawPixmap(rect, bg, rect);
    }
}
开发者ID:dudochkin-victor,项目名称:touch-inputmethodkeyboard,代码行数:11,代码来源:mplainwindow.cpp


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