From d998afaaf0fe1af0b9b5e3d6f4cb504e35e35025 Mon Sep 17 00:00:00 2001 From: zautrix Date: Sun, 20 Mar 2005 19:18:26 +0000 Subject: layout fix --- (limited to 'korganizer') diff --git a/korganizer/kodaymatrix.cpp b/korganizer/kodaymatrix.cpp index 15a1cb4..507f18e 100644 --- a/korganizer/kodaymatrix.cpp +++ b/korganizer/kodaymatrix.cpp @@ -640,7 +640,7 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) int xyOff = frameWidth(); int colModulo = sz.width() % 7; int rowModulo = sz.height() % 6; - qDebug("off %d col %d row %d ",xyOff,colModulo,rowModulo ); + //qDebug("off %d col %d row %d ",xyOff,colModulo,rowModulo ); bool isRTL = KOGlobals::self()->reverseLayout(); @@ -680,7 +680,9 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) int addCol = 0; - int addRow = 0; + int addRow = 0; + int addRow2 = 0; + int addCol2 = 0; #if 0 if ( colModulo ) { if ( col >= 7 - colModulo ) @@ -702,24 +704,44 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) addRow = row - 5 + rowModulo; } if ( colModulo ) { - if ( mSelEndT-mSelStartT+1 >= 7 - colModulo ) - addCol = mSelEndT-mSelStartT+1 - 7 + colModulo; + int colt1 = mSelEndT%7; + //qDebug("colt1 %d ", colt1 ); + if ( colt1 >= 7 - colModulo ) + addCol = colt1 - 7 + colModulo+1; + int colt = mSelStartT%7; + if ( colt >= 7 - colModulo ) + addCol2 = colt - 7 + colModulo; + addCol -= addCol2; + //qDebug("COL %d %d %d %d ",col , colt1 ,addCol ,addCol2 ); } // Single row selection if ( row == 0) addRow = 1; - p.fillRect(isRTL ? (7 - (mSelEndT-mSelStartT+1) - col)*dwidth : col*dwidth+1, + p.fillRect(isRTL ? (7 - (mSelEndT-mSelStartT+1) - col)*dwidth : col*dwidth+1+addCol2, row*dheight+addRow, (mSelEndT-mSelStartT+1)*dwidth+addCol, dheight+1, selcol); } else { // draw first row to the right + if ( colModulo ) { + if ( col >= 7 - colModulo ) + addCol2 = col - 7 + colModulo; + } + if ( rowModulo ) { + if ( row >= 6 - rowModulo ) + addRow = row - 5 + rowModulo; + } if ( row == 0) - addRow = 1; - p.fillRect(isRTL ? 0 : col*dwidth+1, row*dheight+addRow, (7-col)*dwidth+colModulo, - dheight, selcol); + addRow = 1; + p.fillRect(isRTL ? 0 : col*dwidth+1+addCol2, row*dheight+addRow, (7-col)*dwidth+colModulo, + dheight+1, selcol); // draw full block till last line - selh = mSelEndT/7-row; + selh = mSelEndT/7-row; + addRow = 0; + if ( rowModulo ) { + if ( mSelEndT/7 >= 6 - rowModulo ) + addRow = mSelEndT/7 - 5 + rowModulo; + } if (selh > 1) { - p.fillRect(1, (row+1)*dheight, 7*dwidth+colModulo, (selh-1)*dheight,selcol); + p.fillRect(1, (row+1)*dheight, 7*dwidth+colModulo, (selh-1)*dheight+addRow,selcol); } // draw last block from left to mSelEndT selw = mSelEndT-7*(mSelEndT/7)+1; @@ -733,8 +755,8 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) add = 0; } //qDebug("add %d ", add); - p.fillRect(isRTL ? (7-selw)*dwidth : 1, (row+selh)*dheight, - selw*dwidth+add, dheight, selcol); + p.fillRect(isRTL ? (7-selw)*dwidth : 1, (row+selh)*dheight+addRow, + selw*dwidth+add, dheight+1, selcol); } } } @@ -827,7 +849,7 @@ void KODayMatrix::paintEvent(QPaintEvent * pevent) addRow = row - 5 + rowModulo; } //qDebug("add %d %d -- %d %d ", col, addCol, row, addRow); - ++addCol;++addCol; + ++addCol;//++addCol; p.drawText(col*dwidth+addCol, row*dheight+addRow, dwidth, dheight, Qt::AlignHCenter | Qt::AlignVCenter, daylbls[i]); -- cgit v0.9.0.2