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


C++ QPicture::boundingRect方法代码示例

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


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

示例1: dumpPartPictures

void dumpPartPictures(const QHash<QString, QPicture> &partPictures) {
    foreach (const QString &partKey, partPictures.keys()) {
        QPicture partPicture = partPictures.value(partKey);
        qDebug() << partKey << partPicture.boundingRect();
        QImage image(partPicture.boundingRect().size(), QImage::Format_ARGB32);
        image.fill(Qt::transparent);
        QPainter p(&image);
        partPicture.play(&p);
        image.save(partKey + QString::fromLatin1(".png"));
    }
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:11,代码来源:s60themeconvert.cpp

示例2: begin

bool QPicturePaintEngine::begin(QPaintDevice *pd)
{
    Q_D(QPicturePaintEngine);
#ifdef QT_PICTURE_DEBUG
    qDebug() << "QPicturePaintEngine::begin()";
#endif
    Q_ASSERT(pd);
    QPicture *pic = static_cast<QPicture *>(pd);

    d->pdev = pd;
    d->pic_d = pic->d_func();
    Q_ASSERT(d->pic_d);

    d->s.setDevice(&d->pic_d->pictb);
    d->s.setVersion(d->pic_d->formatMajor);

    d->pic_d->pictb.open(QIODevice::WriteOnly | QIODevice::Truncate);
    d->s.writeRawData(qt_mfhdr_tag, 4);
    d->s << (quint16) 0 << (quint16) d->pic_d->formatMajor << (quint16) d->pic_d->formatMinor;
    d->s << (quint8) QPicturePrivate::PdcBegin << (quint8) sizeof(qint32);
    d->pic_d->brect = QRect();
    if (d->pic_d->formatMajor >= 4) {
        QRect r = pic->boundingRect();
        d->s << (qint32) r.left() << (qint32) r.top() << (qint32) r.width()
             << (qint32) r.height();
    }
    d->pic_d->trecs = 0;
    d->s << (quint32)d->pic_d->trecs; // total number of records
    d->pic_d->formatOk = false;
    setActive(true);
    return true;
}
开发者ID:Nacto1,项目名称:qt-everywhere-opensource-src-4.6.2,代码行数:32,代码来源:qpaintengine_pic.cpp

示例3: render

void PictureRenderer::render(QPainter *painter, const QRectF &bounds)
{
    QRect br = picture.boundingRect();
    QTransform worldTransform = painter->worldTransform();
    painter->translate(bounds.topLeft());
    painter->scale(bounds.width()/br.width(), bounds.height()/br.height());
    painter->drawPicture(br.topLeft(), picture);
    painter->setWorldTransform(worldTransform);
}
开发者ID:muromec,项目名称:qtopia-ezx,代码行数:9,代码来源:renderer.cpp

示例4: operator

 void operator()( int )
 {
   QPicture pic = cache.svgAsPicture( svgPath, size, QColor( 255, 0, 0 ), QColor( 0, 255, 0 ), 1, 1, true );
   QSize imageSize = pic.boundingRect().size();
   QImage image( imageSize, QImage::Format_ARGB32_Premultiplied );
   image.fill( 0 ); // transparent background
   QPainter p( &image );
   p.drawPicture( 0, 0, pic );
 }
开发者ID:CS-SI,项目名称:QGIS,代码行数:9,代码来源:testqgssvgcache.cpp

示例5: commitDrawing

void BaseDrawingWidget::commitDrawing(QPicture drawingPictureData)
{
    getDrawingData()->registerAction(drawingPictureData);
    getDrawingData()->setModified(true);
    // update the stage
    getDrawingData()->update(drawingPictureData.boundingRect().adjusted(-drawingPen.width()-5,
                                                         -drawingPen.width()-5,
                                                         drawingPen.width()+5,
                                                         drawingPen.width()+5));
}
开发者ID:abom,项目名称:watchntouch,代码行数:10,代码来源:basedrawingwidget.cpp

示例6: partSize

QPixmap QS60StylePrivate::part(QS60StyleEnums::SkinParts part, const QSize &size,
                               QPainter *painter, QS60StylePrivate::SkinElementFlags flags)
{
    Q_UNUSED(painter);

    const QString partKey = QS60Style::partKeys().at(part);
    const QPicture partPicture = QS60StyleModeSpecifics::m_partPictures.value(partKey);
    QSize partSize(partPicture.boundingRect().size());
    if (flags & (SF_PointEast | SF_PointWest)) {
        const int temp = partSize.width();
        partSize.setWidth(partSize.height());
        partSize.setHeight(temp);
    }
    const qreal scaleX = size.width() / (qreal)partSize.width();
    const qreal scaleY = size.height() / (qreal)partSize.height();

    QImage partImage(size, QImage::Format_ARGB32);
    partImage.fill(Qt::transparent);
    QPainter resultPainter(&partImage);
    QTransform t;

    if (flags & SF_PointEast)
        t.translate(size.width(), 0);
    else if (flags & SF_PointSouth)
        t.translate(size.width(), size.height());
    else if (flags & SF_PointWest)
        t.translate(0, size.height());

    t.scale(scaleX, scaleY);

    if (flags & SF_PointEast)
        t.rotate(90);
    else if (flags & SF_PointSouth)
        t.rotate(180);
    else if (flags & SF_PointWest)
        t.rotate(270);

    resultPainter.setTransform(t, true);
    const_cast<QPicture *>(&partPicture)->play(&resultPainter);
    resultPainter.end();

    QPixmap result = QPixmap::fromImage(partImage);
    if (flags & SF_StateDisabled) {
        QStyleOption opt;
        QPalette *themePalette = QS60StylePrivate::themePalette();
        if (themePalette)
            opt.palette = *themePalette;
        result = QApplication::style()->generatedIconPixmap(QIcon::Disabled, result, &opt);
    }

    return result;
}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:52,代码来源:qs60style_simulated.cpp

示例7: registerAction

void DrawingData::registerAction(QPicture actions)
{
    QRect boundingRect = actions.boundingRect().adjusted(-2,-2,2,2);
    // fix negative / too large coordinates
    if(boundingRect.x() < 0)
        boundingRect.setX(0);
    if(boundingRect.y() < 0)
        boundingRect.setY(0);
    if(boundingRect.x() > width())
        boundingRect.setX(width());
    if(boundingRect.y() > height())
        boundingRect.setY(height());
    // backup the area to be painted, to be used for undo'ing later
    QPixmap areaToChange = QPixmap::fromImage(stage.copy(boundingRect));
    // set the properties of this drawing step for undo/redo
    currentAction->setActions(actions);
    currentAction->setPrevPixmap(areaToChange, boundingRect);
    // add to the undo stack
    undoStack.push(currentAction);
    currentAction =  new DrawingAction(this);
}
开发者ID:abom,项目名称:watchntouch,代码行数:21,代码来源:drawingdata.cpp


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