[Qt-interest] QPixmap

Qrikg macos_user at yahoo.com
Thu Apr 8 10:41:05 CEST 2010


Hello,
Itried following code:

    QPixmap oPixmap;
    QPainter painter(&oPixmap);
    QPixmap sample_icon((const char**)sample_icon);
            painter.drawPixmap( QRect(x,0,10,10),
                            sample_icon, QRect(0, 0, 10, 10 ));            

But it doesn;t give any pixmap.oPixmap is null

"QT -> QPainter::begin: Paint device returned engine == 0, type: 2"


--- On Thu, 4/8/10, Gabriel M. Beddingfield <gabrbedd at gmail.com> wrote:

From: Gabriel M. Beddingfield <gabrbedd at gmail.com>
Subject: Re: [Qt-interest] QPixmap
To: "Qrikg" <macos_user at yahoo.com>
Cc: "Qt Interest" <qt-interest at trolltech.com>
Date: Thursday, April 8, 2010, 5:50 AM



On Wed, 7 Apr 2010, Qrikg wrote:

> Which is the function similar to copyBlt in Qt4?

    Qt3's prototype:
    void QPixmap::copyBlt ( QPixmap * dst, int dx, int dy,
                            const QPixmap * src,
                            int sx, int sy, int sw, int sh )

There may be a better way... but this should work:

    void works_like_copyBlt( QPixmap& dst, int dx, int dy,
                             const QPixmap& src,
                             int sx, int sy, int sw, int sh )
    {
        QPainter painter(&dst);
        painter.drawPixmap( QRect( dx, dx, sw, sh ),
                            src,
                            QRect( sx, sy, sw, sh ) );
    }

-gabriel






      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100408/739dd6a7/attachment.html 


More information about the Qt-interest-old mailing list