author | zautrix <zautrix> | 2005-04-30 07:32:03 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-30 07:32:03 (UTC) |
commit | 7c31102a00920834ab8e3778f0f459b96b2fb309 (patch) (unidiff) | |
tree | 9f238caaaab4ba150e4f14708d85162af0ea5092 /microkde/kdatetbl.cpp | |
parent | bdaded2da25b0ccef80d6e638fa12f92a4f8744d (diff) | |
download | kdepimpi-7c31102a00920834ab8e3778f0f459b96b2fb309.zip kdepimpi-7c31102a00920834ab8e3778f0f459b96b2fb309.tar.gz kdepimpi-7c31102a00920834ab8e3778f0f459b96b2fb309.tar.bz2 |
fixes
-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 | |||
@@ -781,18 +781,23 @@ KDateInternalWeekPicker::KDateInternalWeekPicker | |||
781 | int add = 2; | 781 | int add = 2; |
782 | if ( QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 ) | 782 | if ( QApplication::desktop()->width() >= 480 && QApplication::desktop()->width() <= 640 ) |
783 | add += 6; | 783 | add += 6; |
784 | font.setPointSize(fontsize+add); | 784 | font.setPointSize(fontsize+add); |
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 |
795 | #endif | 800 | #endif |
796 | // ----- find the preferred size | 801 | // ----- find the preferred size |
797 | // (this is slow, possibly, but unfortunatly it is needed here): | 802 | // (this is slow, possibly, but unfortunatly it is needed here): |
798 | QFontMetrics metrics(font); | 803 | QFontMetrics metrics(font); |
@@ -826,27 +831,27 @@ void | |||
826 | KDateInternalWeekPicker::setupPainter(QPainter *p) | 831 | KDateInternalWeekPicker::setupPainter(QPainter *p) |
827 | { | 832 | { |
828 | p->setPen(black); | 833 | p->setPen(black); |
829 | } | 834 | } |
830 | 835 | ||
831 | void | 836 | void |
832 | KDateInternalWeekPicker::viewportResizeEvent(QResizeEvent*) | 837 | KDateInternalWeekPicker::viewportResizeEvent(QResizeEvent*) |
833 | { | 838 | { |
834 | setCellWidth(width()/4); | 839 | setCellWidth(width()/ numCols()); |
835 | setCellHeight(height()/13); | 840 | setCellHeight(height()/ numRows()); |
836 | } | 841 | } |
837 | 842 | ||
838 | void | 843 | void |
839 | KDateInternalWeekPicker::paintCell(QPainter* painter, int row, int col) | 844 | KDateInternalWeekPicker::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() ); |
849 | } | 854 | } |
850 | 855 | ||
851 | void | 856 | void |
852 | KDateInternalWeekPicker::contentsMousePressEvent(QMouseEvent *e) | 857 | KDateInternalWeekPicker::contentsMousePressEvent(QMouseEvent *e) |
@@ -928,12 +933,12 @@ KDateInternalWeekPicker::contentsMouseReleaseEvent(QMouseEvent *e) | |||
928 | // ----- | 933 | // ----- |
929 | mouseCoord = e->pos(); | 934 | mouseCoord = e->pos(); |
930 | row=rowAt(mouseCoord.y()); | 935 | row=rowAt(mouseCoord.y()); |
931 | col=columnAt(mouseCoord.x()); | 936 | col=columnAt(mouseCoord.x()); |
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 | } |