-rw-r--r-- | korganizer/koagendaview.cpp | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 072d464..99f547a 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -131,6 +131,3 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) QString suffix; - int tW = fm.width("24:00i"); - int timeHeight = fm.height(); - //timeHeight -= (timeHeight/4-2); - int borderWidth = 0; + int timeHeight = fm.ascent(); QFont nFont = p->font(); @@ -139,4 +136,3 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) suffix = "00"; - else - borderWidth = 0; + if ( timeHeight > mCellHeight ) { @@ -147,3 +143,3 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) fm = QFontMetrics( nFont ); - if ( fm.height() < mCellHeight ) + if ( fm.ascent() < mCellHeight ) break; @@ -152,4 +148,3 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) fm = QFontMetrics( nFont ); - borderWidth = 4; - timeHeight = fm.height(); + timeHeight = fm.ascent(); } @@ -157,9 +152,10 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) QFont sFont = nFont; - sFont.setPointSize( sFont.pointSize()/2+2 ); + sFont.setPointSize( sFont.pointSize()/2 ); QFontMetrics fmS( sFont ); - int sHei = fmS.height(); + int sHei = fmS.ascent() ; //sHei -= (sHei/4-2); - int startW = this->width() - frameWidth()-1; + int startW = this->width() - 2*frameWidth()-1; + int tw2 = fmS.width(suffix); while (y < cy + ch) { - p->drawLine(cx,y,cx+tW,y); + p->drawLine(cx,y,cw,y); hour.setNum(cell); @@ -173,2 +169,3 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) if (cell > 12) hour.setNum(cell - 12); + tw2 = fmS.width(suffix); } @@ -177,3 +174,2 @@ void TimeLabels::drawContents(QPainter *p,int cx, int cy, int cw, int ch) int timeWidth = fm.width(hour); - int tw2 = fm.width(suffix); int offset = startW - timeWidth - tw2 ; @@ -213,8 +209,8 @@ void TimeLabels::updateConfig() setFont(KOPrefs::instance()->mTimeBarFont); - QString test = "88:88"; + QString test = "20oo"; if (KGlobal::locale()->use12Clock()) - test += "i"; + test = "12mi"; mMiniWidth = fontMetrics().width(test) + frameWidth()*2 +1 ; // update geometry restrictions based on new settings - setFixedWidth(minimumWidth()); + setFixedWidth( mMiniWidth ); |