-rw-r--r-- | korganizer/koagendaitem.cpp | 24 | ||||
-rw-r--r-- | korganizer/koagendaitem.h | 1 | ||||
-rw-r--r-- | korganizer/koagendaview.cpp | 2 |
3 files changed, 11 insertions, 16 deletions
diff --git a/korganizer/koagendaitem.cpp b/korganizer/koagendaitem.cpp index 9fe1be4..abb29f7 100644 --- a/korganizer/koagendaitem.cpp +++ b/korganizer/koagendaitem.cpp @@ -343,9 +343,9 @@ void KOAgendaItem::paintMe( bool selected, QPainter* paint ) return; QPainter pa; if ( mSelected ) { - pa.begin( paintPixSel() ); + pa.begin( this ); } else { if ( mAllDay ) pa.begin( paintPixAllday() ); else @@ -356,9 +356,12 @@ void KOAgendaItem::paintMe( bool selected, QPainter* paint ) x = pos().x(); w = width(); h = height (); if ( mAllDay ) yy = y(); else - yy = mCellYTop * ( height() / cellHeight() ); + yy = mCellYTop * ( height() / cellHeight() ); + if ( mSelected ) { + pa.translate( -x, -yy ); + } xPaintCoord= x; yPaintCoord = yy; wPaintCoord = width(); hPaintCoord = height(); @@ -469,9 +472,8 @@ void KOAgendaItem::paintMe( bool selected, QPainter* paint ) } void KOAgendaItem::resizePixmap( int w , int h ) { paintPix()->resize( w, h ); - paintPixSel()->resize( w, h ); } QPixmap * KOAgendaItem::paintPix() { @@ -492,18 +494,9 @@ QPixmap * KOAgendaItem::paintPixAllday() mPaintPixA = new QPixmap(w,h); } return mPaintPixA ; } -QPixmap * KOAgendaItem::paintPixSel() -{ - static QPixmap* mPaintPixSel = 0; - if ( ! mPaintPixSel ) { - int w = QApplication::desktop()->width(); - int h = QApplication::desktop()->height(); - mPaintPixSel = new QPixmap(w,h); - } - return mPaintPixSel ; -} + void KOAgendaItem::paintEvent ( QPaintEvent *e ) { if ( globalFlagBlockAgendaItemPaint ) @@ -526,8 +519,10 @@ void KOAgendaItem::paintEvent ( QPaintEvent *e ) globalFlagBlockAgendaItemUpdate = 0; paintMe( mSelected ); //qDebug("calling paintMe "); globalFlagBlockAgendaItemUpdate = 1; + if ( mSelected ) + return; } int rx, ry, rw, rh; rx = e->rect().x(); ry = e->rect().y(); @@ -536,9 +531,10 @@ void KOAgendaItem::paintEvent ( QPaintEvent *e ) //qDebug(" paintevent %s %d %d %d %d", mIncidence->summary().latin1(), x(), yy, width(), height()); QPixmap* paintFrom ; if ( mSelected ) { - paintFrom = paintPixSel(); + paintMe( mSelected ); + return; } else { if ( mAllDay ) paintFrom = paintPixAllday(); else diff --git a/korganizer/koagendaitem.h b/korganizer/koagendaitem.h index dc2316a..7103abe 100644 --- a/korganizer/koagendaitem.h +++ b/korganizer/koagendaitem.h @@ -102,9 +102,8 @@ class KOAgendaItem : public QWidget void paintMe( bool, QPainter* painter = 0 ); void repaintMe(); static void resizePixmap( int, int ); static QPixmap * paintPix(); - static QPixmap * paintPixSel(); static QPixmap * paintPixAllday(); void updateItem(); void computeText(); void recreateIncidence(); diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 5a63b35..f811fba 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -602,9 +602,9 @@ KOAgendaView::~KOAgendaView() { delete mAllAgendaPopup; //delete mAllDayAgendaPopup; delete KOAgendaItem::paintPix(); - delete KOAgendaItem::paintPixSel(); + delete KOAgendaItem::paintPixAllday(); } void KOAgendaView::resizeEvent( QResizeEvent* e ) { //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); |