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/navigatorbar.cpp') diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp index 27d4d17..4a51bba 100644 --- a/korganizer/navigatorbar.cpp +++ b/korganizer/navigatorbar.cpp @@ -62,10 +62,7 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam topLayout->addWidget( mCtrlFrame ); - QFont tfont = font(); - if ( QApplication::desktop()->width() >= 480 ) - tfont.setPointSize(tfont.pointSize()+2); - tfont.setBold(true); + bool isRTL = KOGlobals::self()->reverseLayout(); #ifndef DESKTOP_VERSION @@ -120,34 +117,10 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam mPrevWeek->hide(); mNextWeek->hide(); } - mSelectMonth->setFont( tfont ); - // Set minimum width to width of widest month name label - int i; - int maxwidth = 0; - QFontMetrics fm ( mSelectMonth->font() ); - int width = fm.width("September '00" ); -// for( i = 1; i <= KOGlobals::self()->calendarSystem()->monthsInYear(date); -// ++i ) { -// //int width = fm.width( KOGlobals::self()->calendarSystem()->monthName(i, -// // KOGlobals::self()->calendarSystem()->year(date) ) + " 2000" ); -// int width = fm.width("September 2000" ); -// if ( width > maxwidth ) maxwidth = width; -// } - maxwidth = width+2; - int size = fm.height()+2; - if ( QApplication::desktop()->width() >= 480 ) { - size += 6; - maxwidth+= 6; - } - mSelectMonth->setFixedWidth( maxwidth ); - mSelectMonth->setFixedHeight( size ); - mPrevYear->setFixedHeight( size ); - mPrevMonth->setFixedHeight( size ); - mPrevWeek->setFixedHeight( size ); - mNextMonth->setFixedHeight( size ); - mNextWeek->setFixedHeight( size ); - mNextYear->setFixedHeight ( size ); + resetFont( font() ); + + // set up control frame layout QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); ctrlLayout->addWidget( mPrevYear, 3 ); @@ -184,6 +157,36 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam NavigatorBar::~NavigatorBar() { } +void NavigatorBar::resetFont ( QFont fo ) +{ + + QFont tfont = fo; + if ( QApplication::desktop()->width() >= 480 ) + tfont.setPointSize(tfont.pointSize()+2); + tfont.setBold(true); + + mSelectMonth->setFont( tfont ); + // Set minimum width to width of widest month name label + int i; + int maxwidth = 0; + QFontMetrics fm ( mSelectMonth->font() ); + int width = fm.width("September '00" ); + maxwidth = width+2; + int size = fm.height()+2; + if ( QApplication::desktop()->width() >= 480 ) { + size += 6; + maxwidth+= 6; + } + mSelectMonth->setMinimumWidth( maxwidth ); + mSelectMonth->setFixedHeight( size ); + mPrevYear->setFixedHeight( size ); + mPrevMonth->setFixedHeight( size ); + mPrevWeek->setFixedHeight( size ); + mNextMonth->setFixedHeight( size ); + mNextWeek->setFixedHeight( size ); + mNextYear->setFixedHeight ( size ); +} + void NavigatorBar::showButtons( bool left, bool right ) { if ( left ) { @@ -202,7 +205,7 @@ void NavigatorBar::showButtons( bool left, bool right ) mNextMonth->hide(); } if ( !left && !right ) { - mSelectMonth->setMaximumWidth( 1024 ); + //mSelectMonth->setMaximumWidth( 1024 ); mSelectMonth->setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); } } -- cgit v0.9.0.2