summaryrefslogtreecommitdiffabout
path: root/korganizer/navigatorbar.cpp
authorzautrix <zautrix>2005-03-20 14:04:37 (UTC)
committer zautrix <zautrix>2005-03-20 14:04:37 (UTC)
commit69d75020eea5f95b9f5d77d97ed85ec8869d32db (patch) (unidiff)
tree378b920b9392e7ed4472597e586154d7b99b0645 /korganizer/navigatorbar.cpp
parent289dd44f4f23d92c45d8f28c867a14a980fd5dde (diff)
downloadkdepimpi-69d75020eea5f95b9f5d77d97ed85ec8869d32db.zip
kdepimpi-69d75020eea5f95b9f5d77d97ed85ec8869d32db.tar.gz
kdepimpi-69d75020eea5f95b9f5d77d97ed85ec8869d32db.tar.bz2
layout fixes
Diffstat (limited to 'korganizer/navigatorbar.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/navigatorbar.cpp67
1 files changed, 35 insertions, 32 deletions
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
62 62
63 topLayout->addWidget( mCtrlFrame ); 63 topLayout->addWidget( mCtrlFrame );
64 64
65 QFont tfont = font(); 65
66 if ( QApplication::desktop()->width() >= 480 )
67 tfont.setPointSize(tfont.pointSize()+2);
68 tfont.setBold(true);
69 66
70 bool isRTL = KOGlobals::self()->reverseLayout(); 67 bool isRTL = KOGlobals::self()->reverseLayout();
71#ifndef DESKTOP_VERSION 68#ifndef DESKTOP_VERSION
@@ -120,34 +117,10 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
120 mPrevWeek->hide(); 117 mPrevWeek->hide();
121 mNextWeek->hide(); 118 mNextWeek->hide();
122 } 119 }
123 mSelectMonth->setFont( tfont );
124 // Set minimum width to width of widest month name label
125 int i;
126 int maxwidth = 0;
127 QFontMetrics fm ( mSelectMonth->font() );
128 int width = fm.width("September '00" );
129// for( i = 1; i <= KOGlobals::self()->calendarSystem()->monthsInYear(date);
130// ++i ) {
131// //int width = fm.width( KOGlobals::self()->calendarSystem()->monthName(i,
132// // KOGlobals::self()->calendarSystem()->year(date) ) + " 2000" );
133// int width = fm.width("September 2000" );
134// if ( width > maxwidth ) maxwidth = width;
135// }
136 maxwidth = width+2;
137 int size = fm.height()+2;
138 if ( QApplication::desktop()->width() >= 480 ) {
139 size += 6;
140 maxwidth+= 6;
141 }
142 120
143 mSelectMonth->setFixedWidth( maxwidth ); 121 resetFont( font() );
144 mSelectMonth->setFixedHeight( size ); 122
145 mPrevYear->setFixedHeight( size ); 123
146 mPrevMonth->setFixedHeight( size );
147 mPrevWeek->setFixedHeight( size );
148 mNextMonth->setFixedHeight( size );
149 mNextWeek->setFixedHeight( size );
150 mNextYear->setFixedHeight ( size );
151 // set up control frame layout 124 // set up control frame layout
152 QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); 125 QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 );
153 ctrlLayout->addWidget( mPrevYear, 3 ); 126 ctrlLayout->addWidget( mPrevYear, 3 );
@@ -184,6 +157,36 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
184NavigatorBar::~NavigatorBar() 157NavigatorBar::~NavigatorBar()
185{ 158{
186} 159}
160void NavigatorBar::resetFont ( QFont fo )
161{
162
163 QFont tfont = fo;
164 if ( QApplication::desktop()->width() >= 480 )
165 tfont.setPointSize(tfont.pointSize()+2);
166 tfont.setBold(true);
167
168 mSelectMonth->setFont( tfont );
169 // Set minimum width to width of widest month name label
170 int i;
171 int maxwidth = 0;
172 QFontMetrics fm ( mSelectMonth->font() );
173 int width = fm.width("September '00" );
174 maxwidth = width+2;
175 int size = fm.height()+2;
176 if ( QApplication::desktop()->width() >= 480 ) {
177 size += 6;
178 maxwidth+= 6;
179 }
180 mSelectMonth->setMinimumWidth( maxwidth );
181 mSelectMonth->setFixedHeight( size );
182 mPrevYear->setFixedHeight( size );
183 mPrevMonth->setFixedHeight( size );
184 mPrevWeek->setFixedHeight( size );
185 mNextMonth->setFixedHeight( size );
186 mNextWeek->setFixedHeight( size );
187 mNextYear->setFixedHeight ( size );
188}
189
187void NavigatorBar::showButtons( bool left, bool right ) 190void NavigatorBar::showButtons( bool left, bool right )
188{ 191{
189 if ( left ) { 192 if ( left ) {
@@ -202,7 +205,7 @@ void NavigatorBar::showButtons( bool left, bool right )
202 mNextMonth->hide(); 205 mNextMonth->hide();
203 } 206 }
204 if ( !left && !right ) { 207 if ( !left && !right ) {
205 mSelectMonth->setMaximumWidth( 1024 ); 208 //mSelectMonth->setMaximumWidth( 1024 );
206 mSelectMonth->setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); 209 mSelectMonth->setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) );
207 } 210 }
208} 211}