author | hrw <hrw> | 2005-09-12 21:17:18 (UTC) |
---|---|---|
committer | hrw <hrw> | 2005-09-12 21:17:18 (UTC) |
commit | 2b74c3a954389db73827ba2bf0d79b835ec569f1 (patch) (side-by-side diff) | |
tree | 3d0268c50d01836aea555803ed4f98538881eafe /library | |
parent | c94b0601f73dabfb65525b263222d0ccdbd1544c (diff) | |
download | opie-2b74c3a954389db73827ba2bf0d79b835ec569f1.zip opie-2b74c3a954389db73827ba2bf0d79b835ec569f1.tar.gz opie-2b74c3a954389db73827ba2bf0d79b835ec569f1.tar.bz2 |
libqpe/datebookmonth selector use too small fontsize on VGA screen.
- now on =>480 screen.width it will use "default_fontsize" - 2 size
on smaller screen devices behavior is not changed
- close bug #1695
-rw-r--r-- | library/datebookmonth.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/library/datebookmonth.cpp b/library/datebookmonth.cpp index 2616b7b..ffdf335 100644 --- a/library/datebookmonth.cpp +++ b/library/datebookmonth.cpp @@ -600,129 +600,136 @@ void DayItemMonth::paint( QPainter *p, const QColorGroup &cg, normalLine.push(sLine); normalLine.push(eLine); } else { repeatLine.push(sLine); repeatLine.push(eLine); } } } // draw the background if (normalAllDay || repeatAllDay || travelAllDay || holidayAllDay) { p->save(); if (normalAllDay) if (repeatAllDay) { p->fillRect( 0, 0, cr.width(), cr.height() / 2, s_colorNormalLight ); p->fillRect( 0, cr.height() / 2, cr.width(), cr.height() / 2, colorRepeatLight ); } else { if (!holidayAllDay) { p->fillRect( 0, 0, cr.width(), cr.height(), s_colorNormalLight ); } else { p->fillRect( 0, 0, cr.width(), cr.height(), s_colorHolidayLight ); } } else if (repeatAllDay) { p->fillRect( 0, 0, cr.width(), cr.height(), s_colorRepeatLight ); } } else { p->fillRect( 0, 0, cr.width(), cr.height(), selected ? g.brush( QColorGroup::Highlight ) : g.brush( QColorGroup::Base ) ); } // The lines // now for the lines. int h = 5; int y = cr.height() / 2 - h; while(normalLine.count() >= 2) { int x2 = normalLine.pop(); int x1 = normalLine.pop(); if (x2 < x1 + 2) x2 = x1 + 2; p->fillRect(x1, y, x2 - x1, h, colorNormal); } y += h; while(repeatLine.count() >= 2) { int x2 = repeatLine.pop(); int x1 = repeatLine.pop(); if (x2 < x1 + 2) x2 = x1 + 2; p->fillRect(x1, y, x2 - x1, h, colorRepeat); } // Finally, draw the number. QFont f = p->font(); + if(qApp->desktop()->width() >= 480) + { + f.setPointSize( f.pointSize() - 2 ); + } + else + { f.setPointSize( ( f.pointSize() / 3 ) * 2 ); + } p->setFont( f ); QFontMetrics fm( f ); p->drawText( 1, 1 + fm.ascent(), QString::number( day() ) ); p->restore(); } void DayItemMonth::setType( Calendar::Day::Type t ) { switch ( t ) { case Calendar::Day::PrevMonth: case Calendar::Day::NextMonth: back = QBrush( QColor( 224, 224, 224 ) ); forg = black; break; case Calendar::Day::ThisMonth: back = QBrush( white ); forg = black; break; } typ = t; } DateButton::DateButton( bool longDate, QWidget *parent, const char * name ) :QPushButton( parent, name ) { longFormat = longDate; df = DateFormat('/', DateFormat::MonthDayYear, DateFormat::MonthDayYear); setDate( QDate::currentDate() ); connect(this,SIGNAL(pressed()),this,SLOT(pickDate())); } void DateButton::pickDate() { static QPopupMenu *m1 = 0; static DateBookMonth *picker = 0; if ( !m1 ) { m1 = new QPopupMenu( this ); picker = new DateBookMonth( m1, 0, TRUE ); m1->insertItem( picker ); connect( picker, SIGNAL( dateClicked(int,int,int) ), this, SLOT( setDate(int,int,int) ) ); connect( picker, SIGNAL( dateClicked(int,int,int) ), this, SIGNAL( dateSelected(int,int,int) ) ); connect( m1, SIGNAL( aboutToHide() ), this, SLOT( gotHide() ) ); } picker->slotWeekChange( weekStartsMonday ); picker->setDate( currDate.year(), currDate.month(), currDate.day() ); m1->popup(mapToGlobal(QPoint(0,height()))); picker->setFocus(); } void DateButton::gotHide() { |