-rw-r--r-- | korganizer/koagendaview.cpp | 10 | ||||
-rw-r--r-- | korganizer/koagendaview.h | 2 | ||||
-rw-r--r-- | korganizer/kodaymatrix.cpp | 17 | ||||
-rw-r--r-- | korganizer/kodaymatrix.h | 1 |
4 files changed, 26 insertions, 4 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 2996acb..218396d 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -81,8 +81,10 @@ using namespace KOrg; TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) : QScrollView(parent,name,f) { + myPix.resize( 1, 1 ); mRows = rows; + mRedrawNeeded = true; setMinimumHeight( 20 ); mCellHeight = KOPrefs::instance()->mHourSize*4; @@ -116,6 +118,7 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) // now, for a workaround... // these two assignments fix the weird redraw bug + if ( mRedrawNeeded ) { cx = contentsX() + 2; cw = contentsWidth() - 2; // end of workaround @@ -183,6 +186,12 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) y += mCellHeight; cell++; } + } else { + //qDebug("NO redraw "); + } + // double buffer not yet implemented + //bitBlt (this, 0, 0, &myPix, 0 ,0,width(), height() ,CopyROP); + //mRedrawNeeded = false; } /** @@ -196,6 +205,7 @@ int TimeLabels::minimumWidth() const /** updates widget's internal state */ void TimeLabels::updateConfig() { + mRedrawNeeded = true; // set the font // config->setGroup("Fonts"); // QFont font = config->readFontEntry("TimeBar Font"); diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h index 6dc81c6..30c9b05 100644 --- a/korganizer/koagendaview.h +++ b/korganizer/koagendaview.h @@ -101,6 +101,8 @@ class TimeLabels : public QScrollView { void drawContents(QPainter *p,int cx, int cy, int cw, int ch); private: + QPixmap myPix; + bool mRedrawNeeded; int mMiniWidth; int mMouseDownY; QString mOrgCap; diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index d543aaf..dfc6af7 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp @@ -110,6 +110,7 @@ KODayMatrix::KODayMatrix(QWidget *parent, Calendar* calendar, QDate date, const QFrame(parent, name) #endif { + mRedrawNeeded = true; mKODaymatrixWhatsThis = new KODaymatrixWhatsThis(this); mPendingUpdateBeforeRepaint = false; mouseDown = false; @@ -386,6 +387,7 @@ void KODayMatrix::updateViewTimed() mHolidays[i] = QString::null; } } + mRedrawNeeded = true; if ( ! mPendingUpdateBeforeRepaint ) repaint(false); } @@ -420,6 +422,7 @@ void KODayMatrix::updateView(QDate actdate) startdate = actdate; mDayChanged = true; recalculateToday(); + mRedrawNeeded = true; } //qDebug("restart Timer %d vis: %d", mDayChanged, isVisible() ); if ( !isVisible() ) { @@ -428,7 +431,7 @@ void KODayMatrix::updateView(QDate actdate) #ifdef DESKTOP_VERSION //mRepaintTimer->start( 100 ); //updateViewTimed(); - mUpdateTimer->start( 20 ); + mUpdateTimer->start( 50 ); #else mRepaintTimer->start( 350 ); mUpdateTimer->start( 1200 ); @@ -678,7 +681,11 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) } if ( myPix.width() != width() || myPix.height()!=height() ) { myPix.resize(size() ); + mRedrawNeeded = true; } + + if ( mRedrawNeeded ) { + //qDebug("REDRAW "); QPainter p(&myPix); p.setFont(font()); @@ -927,9 +934,11 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) p.setFont(myFont); } } - int off = 0;//xyOff; - bitBlt (this, off, off, &myPix, 0 ,0,width(), height() ,CopyROP); - //qDebug("ffffffffff %d ", off); + } else { + //qDebug("NO redraw "); + } + bitBlt (this, 0, 0, &myPix, 0 ,0,width(), height() ,CopyROP); + mRedrawNeeded = false; } // ---------------------------------------------------------------------------- diff --git a/korganizer/kodaymatrix.h b/korganizer/kodaymatrix.h index 38a7f92..731117c 100644 --- a/korganizer/kodaymatrix.h +++ b/korganizer/kodaymatrix.h @@ -227,6 +227,7 @@ protected: void resizeEvent(QResizeEvent *); private: + bool mRedrawNeeded; KODaymatrixWhatsThis* mKODaymatrixWhatsThis; bool mouseDown; QBitArray bDays; |