author | zautrix <zautrix> | 2005-03-26 17:14:39 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-26 17:14:39 (UTC) |
commit | e3f00322eb77bd03250eb66a2574b640de9aebb4 (patch) (side-by-side diff) | |
tree | 739bb7f27af3dead05659abbb27cafe4da671882 | |
parent | c692f6870157f428aebf1dfdab4fbb6e88699c31 (diff) | |
download | kdepimpi-e3f00322eb77bd03250eb66a2574b640de9aebb4.zip kdepimpi-e3f00322eb77bd03250eb66a2574b640de9aebb4.tar.gz kdepimpi-e3f00322eb77bd03250eb66a2574b640de9aebb4.tar.bz2 |
fix
-rw-r--r-- | korganizer/koagendaview.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index acf43bd..a32333c 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -84,97 +84,97 @@ TimeLabels::TimeLabels(int rows,QWidget *parent,const char *name,WFlags f) : mRows = rows; setMinimumHeight( 20 ); mCellHeight = KOPrefs::instance()->mHourSize*4; enableClipper(true); setHScrollBarMode(AlwaysOff); setVScrollBarMode(AlwaysOff); resizeContents(50,mRows * mCellHeight); viewport()->setBackgroundMode( PaletteBackground ); } void TimeLabels::setCellHeight(int height) { mCellHeight = height; } /* Optimization so that only the "dirty" portion of the scroll view is redrawn. Unfortunately, this is not called by default paintEvent() method. */ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) { // if ( globalFlagBlockAgenda ) // return; // bug: the parameters cx, cy, cw, ch are the areas that need to be // redrawn, not the area of the widget. unfortunately, this // code assumes the latter... // now, for a workaround... // these two assignments fix the weird redraw bug cx = contentsX() + 2; cw = contentsWidth() - 2; // end of workaround int cell = ((int)(cy/mCellHeight)); int y = cell * mCellHeight; QFontMetrics fm = fontMetrics(); QString hour; QString suffix; QString fullTime; int tW = fm.width("24:00i"); int timeHeight = fm.height(); timeHeight -= (timeHeight/4-2); - int borderWidth = 2; + int borderWidth = 0; QFont nFont = p->font(); QFont sFont = nFont; sFont.setPointSize( sFont.pointSize()/2+2 ); if (!KGlobal::locale()->use12Clock()) suffix = "00"; else borderWidth = 0; QFontMetrics fmS( sFont ); int sHei = fmS.height(); if ( timeHeight > mCellHeight ) { timeHeight = mCellHeight-1; sHei -= 2; } while (y < cy + ch) { p->drawLine(cx,y,cx+tW,y); hour.setNum(cell); // handle 24h and am/pm time formats if (KGlobal::locale()->use12Clock()) { if (cell > 11) suffix = "pm"; else suffix = "am"; if (cell == 0) hour.setNum(12); if (cell > 12) hour.setNum(cell - 12); } // create string in format of "XX:XX" or "XXpm/am" fullTime = hour;// + suffix; // center and draw the time label int timeWidth = fm.width(fullTime+"i"); int tw2 = fm.width(suffix); int offset = this->width() - timeWidth - tw2; p->setFont( nFont ); p->drawText(cx - borderWidth + offset, y+ timeHeight, fullTime); p->setFont( sFont ); offset += timeWidth; p->drawText(cx - borderWidth + offset, y+ sHei, suffix); // increment indices y += mCellHeight; cell++; } } /** Calculates the minimum width. |