From 69d75020eea5f95b9f5d77d97ed85ec8869d32db Mon Sep 17 00:00:00 2001 From: zautrix Date: Sun, 20 Mar 2005 14:04:37 +0000 Subject: layout fixes --- (limited to 'korganizer/kdatenavigator.cpp') diff --git a/korganizer/kdatenavigator.cpp b/korganizer/kdatenavigator.cpp index b097dc1..92a0ac2 100644 --- a/korganizer/kdatenavigator.cpp +++ b/korganizer/kdatenavigator.cpp @@ -116,6 +116,46 @@ KDateNavigator::KDateNavigator( QWidget *parent, const char *name ) updateConfig(); enableRollover(FollowMonth); mySizeHint = sizeHint(); + mFontChanged = false; +} +void KDateNavigator::changeFont ( QFont fo ) +{ + setFont( fo ); + mNavigatorBar->resetFont( fo ); +} +QFont KDateNavigator::yourFontHint( QSize si , bool *b) +{ + QFont fo = KOPrefs::instance()->mDateNavigatorFont; + *b = false; + int fontPoint = fo.pointSize(); + while ( fontPoint > 5 ) { + --fontPoint; + fo.setPointSize( fontPoint ); + setFont( fo ); + mFontChanged = true; + mNavigatorBar->resetFont( fo ); + QSize sh = sizeHint(); + //qDebug("fp %d %d %d %d %d", fontPoint, si.width() , sh.width() , si.height() , sh.height() ); + if ( si.width() > sh.width() && si.height() > sh.height()) { + *b = true; + //qDebug("fooooooooooooooooooooooouuuuund "); + break; + } + } + //qDebug("returnnnnnnnnnnnnnnnnnnn %d", fo.pointSize() ); + return fo; +} +QSize KDateNavigator::sizeHint() const +{ + QFontMetrics fm ( font() ); + QSize day = daymatrix->sizeHint(); + QSize nav = mNavigatorBar->sizeHint(); + int wid = fm.width( "30") + day.width()+3; + int hei = fm.height() +day.height()+nav.height()+2; + if ( wid < nav.width() ) + wid = nav.width() ; + //qDebug("KDateNavigator+++++++++++++ %d %d", wid , hei); + return QSize ( wid, hei ); } void KDateNavigator::slotMonthSelected( int m ) { -- cgit v0.9.0.2