Source Code (Use browser search to find items of interest.)

Class Index

kpresenter'PixmapView (./koffice/kpresenter/preview.cc:79)

class PixmapView : public QScrollView
{
public:
    PixmapView( QWidget *parent )
	: QScrollView( parent ) { viewport()->setBackgroundMode( PaletteBase ); }

    void setPixmap( const QPixmap &pix ) {
	pixmap = pix;
	resizeContents( pixmap.size().width(), pixmap.size().height() );
	viewport()->repaint( FALSE );
    }

    void setClipart( const QString &s ) {
	QWinMetaFile wmf;

	if ( wmf.load( s ) ) {
	    QPicture pic;
	    wmf.paint( &pic );

	    pixmap = QPixmap( 200, 200 );
	    QPainter p;

	    p.begin( &pixmap );
	    p.setBackgroundColor( Qt::white );
	    pixmap.fill( Qt::white );

	    QRect oldWin = p.window();
	    QRect vPort = p.viewport();
	    p.setViewport( 0, 0, 200, 200 );
	    p.drawPicture( pic );
	    p.setWindow( oldWin );
	    p.setViewport( vPort );
	    p.end();
	    resizeContents( pixmap.size().width(), pixmap.size().height() );
	    viewport()->repaint( FALSE );
	}
    }

    void drawContents( QPainter *p, int, int, int, int ) {
	p->drawPixmap( 0, 0, pixmap );
    }

private:
    QPixmap pixmap;

};