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/datenavigatorcontainer.cpp') diff --git a/korganizer/datenavigatorcontainer.cpp b/korganizer/datenavigatorcontainer.cpp index b9bd1b9..3358ecf 100644 --- a/korganizer/datenavigatorcontainer.cpp +++ b/korganizer/datenavigatorcontainer.cpp @@ -33,6 +33,7 @@ #include #include "datenavigatorcontainer.h" +#include "koprefs.h" DateNavigatorContainer::DateNavigatorContainer( QWidget *parent, const char *name ) @@ -167,12 +168,33 @@ void DateNavigatorContainer::resizeEvent( QResizeEvent * e ) int horizontalCount = size().width() / minSize.width(); //qDebug(" wattdatt %d new %d %d ", size().width() ,e->size().width() , minSize.width() ); //qDebug("COUNT %d %d %d %d ", verticalCount, horizontalCount , mVerticalCount, mHorizontalCount ); + bool fontchange = false; + QFont fo; if ( horizontalCount != mHorizontalCount || verticalCount != mVerticalCount ) { uint count = horizontalCount * verticalCount; if ( count == 0 ) { - mNavigatorView->resize( minSize ); - return; + bool ok; + fo = mNavigatorView->yourFontHint( size() , &ok); + //mNavigatorView->resize( size() ); + //if ( ! ok ) + // return; + minSize = mNavigatorView->sizeHint(); + verticalCount = size().height() / minSize.height(); + horizontalCount = size().width() / minSize.width(); + if ( horizontalCount == 0 ) + horizontalCount = 1; + if ( verticalCount == 0 ) + verticalCount = 1; + fontchange = true; + count = horizontalCount * verticalCount; + } else { + if ( mNavigatorView->fontChanged() ) { + fontchange = true; + fo = KOPrefs::instance()->mDateNavigatorFont; + mNavigatorView->changeFont( fo ); + mNavigatorView->unsetFontChanged(); + } } while ( count > ( mExtraViews.count() + 1 ) ) { @@ -188,11 +210,17 @@ void DateNavigatorContainer::resizeEvent( QResizeEvent * e ) while ( count < ( mExtraViews.count() + 1 ) ) { mExtraViews.removeLast(); } - + if ( fontchange ) { + //mNavigatorView->changeFont( fo ); + uint i; + for( i = 0; i < mExtraViews.count(); ++i ) { + KDateNavigator *view = mExtraViews.at( i ); + view->changeFont( fo ); + } + } mHorizontalCount = horizontalCount; mVerticalCount = verticalCount; } - int height = size().height() / verticalCount; int width = size().width() / horizontalCount; -- cgit v0.9.0.2