summaryrefslogtreecommitdiffabout
path: root/microkde/kdatetbl.cpp
Unidiff
Diffstat (limited to 'microkde/kdatetbl.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kdatetbl.cpp17
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
785 setFont(font); 785 setFont(font);
786 setHScrollBarMode(AlwaysOff); 786 setHScrollBarMode(AlwaysOff);
787 setVScrollBarMode(AlwaysOff); 787 setVScrollBarMode(AlwaysOff);
788 setFrameStyle(QFrame::NoFrame); 788 setFrameStyle(QFrame::NoFrame);
789 setNumRows(13); 789 if ( QApplication::desktop()->height() > 240 ) {
790 setNumCols(4); 790 setNumRows(13);
791 setNumCols(4);
792 } else {
793 setNumRows(4);
794 setNumCols(13);
795 }
791 // enable to find drawing failures: 796 // enable to find drawing failures:
792 // setTableFlags(Tbl_clipCellPainting); 797 // setTableFlags(Tbl_clipCellPainting);
793#if 0 798#if 0
794 viewport()->setEraseColor(lightGray); // for consistency with the datepicker 799 viewport()->setEraseColor(lightGray); // for consistency with the datepicker
@@ -830,19 +835,19 @@ KDateInternalWeekPicker::setupPainter(QPainter *p)
830 835
831void 836void
832KDateInternalWeekPicker::viewportResizeEvent(QResizeEvent*) 837KDateInternalWeekPicker::viewportResizeEvent(QResizeEvent*)
833{ 838{
834 setCellWidth(width()/4); 839 setCellWidth(width()/ numCols());
835 setCellHeight(height()/13); 840 setCellHeight(height()/ numRows());
836} 841}
837 842
838void 843void
839KDateInternalWeekPicker::paintCell(QPainter* painter, int row, int col) 844KDateInternalWeekPicker::paintCell(QPainter* painter, int row, int col)
840{ 845{
841 int index; 846 int index;
842 QString text; 847 QString text;
843 // ----- find the number of the cell: 848 // ----- find the number of the cell:
844 index=4*row+col+1; 849 index=numCols()*row+col+1;
845 text=QString::number( index ); 850 text=QString::number( index );
846 painter->drawText(0, 0, cellWidth(), cellHeight(), AlignCenter, text); 851 painter->drawText(0, 0, cellWidth(), cellHeight(), AlignCenter, text);
847 if ( activeCol == col && activeRow == row ) 852 if ( activeCol == col && activeRow == row )
848 painter->drawRect( 0, 0, cellWidth(), cellHeight() ); 853 painter->drawRect( 0, 0, cellWidth(), cellHeight() );
@@ -932,8 +937,8 @@ KDateInternalWeekPicker::contentsMouseReleaseEvent(QMouseEvent *e)
932 if(row<0 || col<0) 937 if(row<0 || col<0)
933 { // the user clicked on the frame of the table 938 { // the user clicked on the frame of the table
934 emit(closeMe(0)); 939 emit(closeMe(0));
935 } 940 }
936 pos=4*row+col+1; 941 pos=numCols()*row+col+1;
937 result=pos; 942 result=pos;
938 emit(closeMe(1)); 943 emit(closeMe(1));
939} 944}