-rw-r--r-- | microkde/kdatetbl.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/microkde/kdatetbl.cpp b/microkde/kdatetbl.cpp index 2d97c8c..4271b55 100644 --- a/microkde/kdatetbl.cpp +++ b/microkde/kdatetbl.cpp @@ -785,10 +785,15 @@ KDateInternalWeekPicker::KDateInternalWeekPicker setFont(font); setHScrollBarMode(AlwaysOff); setVScrollBarMode(AlwaysOff); setFrameStyle(QFrame::NoFrame); - setNumRows(13); - setNumCols(4); + if ( QApplication::desktop()->height() > 240 ) { + setNumRows(13); + setNumCols(4); + } else { + setNumRows(4); + setNumCols(13); + } // enable to find drawing failures: // setTableFlags(Tbl_clipCellPainting); #if 0 viewport()->setEraseColor(lightGray); // for consistency with the datepicker @@ -830,19 +835,19 @@ KDateInternalWeekPicker::setupPainter(QPainter *p) void KDateInternalWeekPicker::viewportResizeEvent(QResizeEvent*) { - setCellWidth(width()/4); - setCellHeight(height()/13); + setCellWidth(width()/ numCols()); + setCellHeight(height()/ numRows()); } void KDateInternalWeekPicker::paintCell(QPainter* painter, int row, int col) { int index; QString text; // ----- find the number of the cell: - index=4*row+col+1; + index=numCols()*row+col+1; text=QString::number( index ); painter->drawText(0, 0, cellWidth(), cellHeight(), AlignCenter, text); if ( activeCol == col && activeRow == row ) painter->drawRect( 0, 0, cellWidth(), cellHeight() ); @@ -932,8 +937,8 @@ KDateInternalWeekPicker::contentsMouseReleaseEvent(QMouseEvent *e) if(row<0 || col<0) { // the user clicked on the frame of the table emit(closeMe(0)); } - pos=4*row+col+1; + pos=numCols()*row+col+1; result=pos; emit(closeMe(1)); } |