summaryrefslogtreecommitdiffabout
path: root/microkde/kdatetbl.cpp
Unidiff
Diffstat (limited to 'microkde/kdatetbl.cpp') (more/less context) (show whitespace changes)
-rw-r--r--microkde/kdatetbl.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/microkde/kdatetbl.cpp b/microkde/kdatetbl.cpp
index fce0e5a..e827412 100644
--- a/microkde/kdatetbl.cpp
+++ b/microkde/kdatetbl.cpp
@@ -195,14 +195,18 @@ KDateTable::paintCell(QPainter *painter, int row, int col)
195 } 195 }
196 } 196 }
197 painter->drawRect(0, 0, w, h); 197 painter->drawRect(0, 0, w, h);
198 painter->setPen(pen); 198 painter->setPen(pen);
199 painter->drawText(0, 0, w, h, AlignCenter, text, -1, &rect); 199 painter->drawText(0, 0, w, h, AlignCenter, text, -1, &rect);
200 } 200 }
201 /*
201 if(rect.width()>maxCell.width()) maxCell.setWidth(rect.width()); 202 if(rect.width()>maxCell.width()) maxCell.setWidth(rect.width());
202 if(rect.height()>maxCell.height()) maxCell.setHeight(rect.height()); 203 if(rect.height()>maxCell.height()) {
204 maxCell.setHeight(rect.height());
205 }
206 */
203} 207}
204 208
205void 209void
206KDateTable::keyPressEvent( QKeyEvent *e ) 210KDateTable::keyPressEvent( QKeyEvent *e )
207{ 211{
208 /* 212 /*
@@ -310,15 +314,21 @@ KDateTable::setFontSize(int size)
310 maxCell.setWidth(QMAX(maxCell.width(), rect.width())); 314 maxCell.setWidth(QMAX(maxCell.width(), rect.width()));
311 maxCell.setHeight(QMAX(maxCell.height(), rect.height())); 315 maxCell.setHeight(QMAX(maxCell.height(), rect.height()));
312 } 316 }
313 // ----- compare with a real wide number and add some space: 317 // ----- compare with a real wide number and add some space:
314 rect=metrics.boundingRect(QString::fromLatin1("88")); 318 rect=metrics.boundingRect(QString::fromLatin1("88"));
315 maxCell.setWidth(QMAX(maxCell.width()+2, rect.width())); 319 maxCell.setWidth(QMAX(maxCell.width()+2, rect.width()));
320#ifdef DESKTOP_VERSION
321 maxCell.setHeight(QMAX(maxCell.height()+8, rect.height()));
322#else
316 maxCell.setHeight(QMAX(maxCell.height()+4, rect.height())); 323 maxCell.setHeight(QMAX(maxCell.height()+4, rect.height()));
317 if ( maxCell.width() * 1000 / maxCell.height() > 1900 ) 324#endif
325 if ( maxCell.width() * 1000 / maxCell.height() > 1900 ) {
318 maxCell.setHeight(maxCell.width() * 1000 / 1900 ); 326 maxCell.setHeight(maxCell.width() * 1000 / 1900 );
327 qDebug("setmax ");
328 }
319} 329}
320 330
321void 331void
322KDateTable::contentsMousePressEvent(QMouseEvent *e) 332KDateTable::contentsMousePressEvent(QMouseEvent *e)
323{ 333{
324 if(e->type()!=QEvent::MouseButtonPress) 334 if(e->type()!=QEvent::MouseButtonPress)
@@ -440,13 +450,13 @@ KDateInternalMonthPicker::KDateInternalMonthPicker
440 QRect rect; 450 QRect rect;
441 QFont font; 451 QFont font;
442 // ----- 452 // -----
443 activeCol = -1; 453 activeCol = -1;
444 activeRow = -1; 454 activeRow = -1;
445 font=KGlobalSettings::generalFont(); 455 font=KGlobalSettings::generalFont();
446 font.setPointSize(fontsize); 456 //font.setPointSize(fontsize);
447 setFont(font); 457 setFont(font);
448 setHScrollBarMode(AlwaysOff); 458 setHScrollBarMode(AlwaysOff);
449 setVScrollBarMode(AlwaysOff); 459 setVScrollBarMode(AlwaysOff);
450 setFrameStyle(QFrame::NoFrame); 460 setFrameStyle(QFrame::NoFrame);
451 setNumRows(4); 461 setNumRows(4);
452 setNumCols(3); 462 setNumCols(3);
@@ -758,13 +768,13 @@ KDateInternalWeekPicker::KDateInternalWeekPicker
758 QRect rect; 768 QRect rect;
759 QFont font; 769 QFont font;
760 // ----- 770 // -----
761 activeCol = -1; 771 activeCol = -1;
762 activeRow = -1; 772 activeRow = -1;
763 font=KGlobalSettings::generalFont(); 773 font=KGlobalSettings::generalFont();
764 font.setPointSize(fontsize); 774 //font.setPointSize(fontsize);
765 setFont(font); 775 setFont(font);
766 setHScrollBarMode(AlwaysOff); 776 setHScrollBarMode(AlwaysOff);
767 setVScrollBarMode(AlwaysOff); 777 setVScrollBarMode(AlwaysOff);
768 setFrameStyle(QFrame::NoFrame); 778 setFrameStyle(QFrame::NoFrame);
769 setNumRows(13); 779 setNumRows(13);
770 setNumCols(4); 780 setNumCols(4);
@@ -779,13 +789,17 @@ KDateInternalWeekPicker::KDateInternalWeekPicker
779 for(int i=1; i <= 52; ++i) 789 for(int i=1; i <= 52; ++i)
780 { 790 {
781 rect=metrics.boundingRect(QString::number( i )); 791 rect=metrics.boundingRect(QString::number( i ));
782 if(max.width()<rect.width()) max.setWidth(rect.width()); 792 if(max.width()<rect.width()) max.setWidth(rect.width());
783 if(max.height()<rect.height()) max.setHeight(rect.height()); 793 if(max.height()<rect.height()) max.setHeight(rect.height());
784 } 794 }
795 if ( QApplication::desktop()->width() > 640 ) {
785 796
797 max.setWidth(max.width()+6);
798 max.setHeight(max.height()+8);
799 }
786} 800}
787 801
788QSize 802QSize
789KDateInternalWeekPicker::sizeHint() const 803KDateInternalWeekPicker::sizeHint() const
790{ 804{
791 return QSize((max.width()+6)*numCols()+2*frameWidth(), 805 return QSize((max.width()+6)*numCols()+2*frameWidth(),