void AccountsView::print( QPrinter &printer, QPrintDialog &printDialog ) { //kDebug(planDbg()); uint top, left, bottom, right; printer.margins( &top, &left, &bottom, &right ); //kDebug(planDbg())<<m.width()<<"x"<<m.height()<<" :"<<top<<","<<left<<","<<bottom<<","<<right<<" :"<<size(); QPainter p; p.begin( &printer ); p.setViewport( left, top, printer.width() - left - right, printer.height() - top - bottom ); p.setClipRect( left, top, printer.width() - left - right, printer.height() - top - bottom ); QRect preg = p.clipRegion().boundingRect(); //kDebug(planDbg())<<"p="<<preg; //p.drawRect(preg.x(), preg.y(), preg.width()-1, preg.height()-1); double scale = qMin( ( double ) preg.width() / ( double ) size().width(), ( double ) preg.height() / ( double ) ( size().height() ) ); //kDebug(planDbg())<<"scale="<<scale; if ( scale < 1.0 ) { p.scale( scale, scale ); } QPixmap labelPixmap = QPixmap::grabWidget( m_label ); p.drawPixmap( m_label->pos(), labelPixmap ); p.translate( 0, m_label->size().height() ); m_dlv->paintContents( &p ); p.end(); }