Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 10

Qt-interest Archive, March 2002
How to print the contents of a QPixmap ?


Message 1 in thread

Dear all,

I try to print a QPixmap and I don't know why it doesn't work !

First I have done :

#ifndef QT_NO_PRINTER
     if ( printer->setup( this ) ) {
        bitBlt(printer, 0, 0, Page);
     }
#endif

But when I have execute this I got :
bitBlt: Cannot bitBlt to device type 3

So I have re-read examples and I have write this :

int i,j;
QPainter p;
#ifndef QT_NO_PRINTER
     if ( printer->setup( this ) ) {
        p.begin( printer );
        i = p.viewport().width();
        j = p.viewport().height();
        // to verify if there is not a pb of space
        // pw and ph are globals variable with the sizes of my pixmap
        printf("printer viewport : %dx%d - Page : %dx%d\n", i, j, pw, ph);
        bitBlt(printer, 0, 0, Page);
        p.end();
     }
#endif

No error but I get a blank page !

Even with a printer->newPage() after the bitBlt it is not better !

It possible to print the contents of a pixmap ?

Thank you very much

Patrick
-- 
 [ signature omitted ] 

Message 2 in thread

>         p.begin( printer );
>         i = p.viewport().width();
>         j = p.viewport().height();
>         // to verify if there is not a pb of space
>         // pw and ph are globals variable with the sizes of my pixmap
>         printf("printer viewport : %dx%d - Page : %dx%d\n", i, j, pw, ph);
>         bitBlt(printer, 0, 0, Page);
>         p.end();


Try

paint.drawPixmap(0,0,Page);

instead of bitBlt. If this work then the problem is in bitBlt (maybe different color depth, in this case bitBlt does nothing as mentioned in the documentation)

Jacek



-- 

Tego nie znajdziesz w zadnym sklepie!
[ http://oferty.onet.pl ]