-rw-r--r-- | korganizer/kolistview.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/korganizer/kolistview.cpp b/korganizer/kolistview.cpp index b378330..192f8c0 100644 --- a/korganizer/kolistview.cpp +++ b/korganizer/kolistview.cpp @@ -1385,54 +1385,74 @@ void KOListViewListView::contentsMouseMoveEvent(QMouseEvent *e) else { mEventPos = contentsToViewport(e->pos()); mEventGlobalPos = e->globalPos(); } KListView::contentsMouseMoveEvent(e); } #define protected public #include <qheader.h> #undef protected void KOListViewListView::printList() { #ifdef DESKTOP_VERSION KOPrintPrefs pp ( this ); if (!pp.exec() ) return; int scaleval = pp.printMode() ; QPrinter printer; if (!printer.setup() ) return; clearSelection (); QPainter p; p.begin ( &printer ); + p.setFont(font()); QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); float dx, dy; int wid = (m.width() * 9)/10; dx = (float) wid/(float)contentsWidth (); dy = (float)(m.height()) / (float)contentsHeight (); float scale; // scale to fit the width or height of the paper if ( dx < dy ) scale = dx; else scale = dy; p.translate( m.width()/10,m.width()/10 ); if ( scaleval == 2 || scaleval == 1 && scale < 1.0 ) { p.scale( scale, scale ); } int cou = header()->count(); int iii; QRect rect ( 0,0,0, header()->height()); for ( iii = 0; iii < cou; ++iii ) { rect.setLeft ( header()->sectionPos( iii ) ); rect.setRight ( header()->sectionPos( iii ) + header()->sectionSize (iii)); header()->paintSection ( & p, header()->mapToIndex (iii), rect ); } p.translate( 0, header()->height()); - drawContentsOffset ( &p, 0,0, 0,0, contentsWidth (), contentsHeight () ); + //drawContentsOffset ( &p, 0,0, 0,0, contentsWidth (), contentsHeight () ); + + const QColorGroup &cg = colorGroup(); + KOListViewItem* item = (KOListViewItem* )firstChild(); + int yOff = 0; + while ( item ) { + p.translate( 0, yOff ); + p.save(); + for ( iii = 0; iii < cou; ++iii ) { + int align = columnAlignment( iii ); + if ( align == AlignAuto ) align = AlignLeft; + p.restore(); + p.save(); + p.translate( header()->sectionPos( iii ), 0); + item->paintCell( &p, cg, iii, header()->sectionSize (iii), align ); + } + yOff = item->height(); + item = (KOListViewItem* )(item->itemBelow()); + p.restore(); + } p.end(); #endif } |