summaryrefslogtreecommitdiff
authordrw <drw>2005-08-09 18:10:46 (UTC)
committer drw <drw>2005-08-09 18:10:46 (UTC)
commit2630b8b81ddf6904379eedab4e3c307ee6399863 (patch) (unidiff)
treef88ea9ff42e77c322136de6dea4c5cb16e3e225e
parent438e79dd18c8b752f1e7d74a79f3cdf84f8703c8 (diff)
downloadopie-2630b8b81ddf6904379eedab4e3c307ee6399863.zip
opie-2630b8b81ddf6904379eedab4e3c307ee6399863.tar.gz
opie-2630b8b81ddf6904379eedab4e3c307ee6399863.tar.bz2
Fix for bug #1682 - correct sizing of tab control
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/otabwidget.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/libopie2/opieui/otabwidget.cpp b/libopie2/opieui/otabwidget.cpp
index d617a9c..7103884 100644
--- a/libopie2/opieui/otabwidget.cpp
+++ b/libopie2/opieui/otabwidget.cpp
@@ -112,24 +112,27 @@ void OTabWidget::addTab( QWidget *child, const QString &icon, const QString &lab
112 m_tabList->insertItem( label ); 112 m_tabList->insertItem( label );
113 } 113 }
114 114
115 // Add widget to stack 115 // Add widget to stack
116 m_widgetStack->addWidget( child, tabid ); 116 m_widgetStack->addWidget( child, tabid );
117 m_widgetStack->raiseWidget( child ); 117 m_widgetStack->raiseWidget( child );
118 m_widgetStack->setFrameStyle( QFrame::StyledPanel | QFrame::Raised ); 118 m_widgetStack->setFrameStyle( QFrame::StyledPanel | QFrame::Raised );
119 119
120 // Keep track of tab information 120 // Keep track of tab information
121 OTabInfo *tabinfo = new OTabInfo( tabid, child, icon, label ); 121 OTabInfo *tabinfo = new OTabInfo( tabid, child, icon, label );
122 m_tabs.append( tabinfo ); 122 m_tabs.append( tabinfo );
123 123
124 // Force resizing of child controls
125 resizeEvent( 0x0 );
126
124 // Make newly added tab the current one displayed 127 // Make newly added tab the current one displayed
125 selectTab( tabinfo ); 128 selectTab( tabinfo );
126} 129}
127 130
128void OTabWidget::removePage( QWidget *childwidget ) 131void OTabWidget::removePage( QWidget *childwidget )
129{ 132{
130 if ( childwidget ) 133 if ( childwidget )
131 { 134 {
132 // Find tab information for desired widget 135 // Find tab information for desired widget
133 OTabInfo *tab = m_tabs.first(); 136 OTabInfo *tab = m_tabs.first();
134 while ( tab && tab->control() != childwidget ) 137 while ( tab && tab->control() != childwidget )
135 tab = m_tabs.next(); 138 tab = m_tabs.next();
@@ -158,24 +161,27 @@ void OTabWidget::removePage( QWidget *childwidget )
158 // Get rid of tab information 161 // Get rid of tab information
159 m_tabs.remove( tab ); 162 m_tabs.remove( tab );
160 delete tab; 163 delete tab;
161 164
162 // Reset current tab 165 // Reset current tab
163 m_currTab = m_tabs.current(); 166 m_currTab = m_tabs.current();
164 if ( !m_currTab ) 167 if ( !m_currTab )
165 m_widgetStack->setFrameStyle( QFrame::NoFrame ); 168 m_widgetStack->setFrameStyle( QFrame::NoFrame );
166 169
167 // Redraw widget 170 // Redraw widget
168 setUpLayout(); 171 setUpLayout();
169 } 172 }
173
174 // Force resizing of child controls
175 resizeEvent( 0x0 );
170 } 176 }
171} 177}
172 178
173void OTabWidget::changeTab( QWidget *widget, const QString &iconset, const QString &label) 179void OTabWidget::changeTab( QWidget *widget, const QString &iconset, const QString &label)
174{ 180{
175 // Find tab information for desired widget 181 // Find tab information for desired widget
176 OTabInfo *currtab = m_tabs.first(); 182 OTabInfo *currtab = m_tabs.first();
177 while ( currtab && currtab->control() != widget ) 183 while ( currtab && currtab->control() != widget )
178 currtab = m_tabs.next(); 184 currtab = m_tabs.next();
179 185
180 if ( currtab && currtab->control() == widget ) 186 if ( currtab && currtab->control() == widget )
181 { 187 {
@@ -199,24 +205,27 @@ void OTabWidget::changeTab( QWidget *widget, const QString &iconset, const QStri
199 { 205 {
200 if ( m_tabBarStyle == IconList ) 206 if ( m_tabBarStyle == IconList )
201 m_tabList->changeItem( icon, label, i ); 207 m_tabList->changeItem( icon, label, i );
202 else 208 else
203 m_tabList->changeItem( label, i ); 209 m_tabList->changeItem( label, i );
204 } 210 }
205 } 211 }
206 212
207 // Update tab information 213 // Update tab information
208 currtab->setLabel( label ); 214 currtab->setLabel( label );
209 currtab->setIcon( iconset ); 215 currtab->setIcon( iconset );
210 216
217 // Force resizing of child controls
218 resizeEvent( 0x0 );
219
211 // Redraw widget 220 // Redraw widget
212 setUpLayout(); 221 setUpLayout();
213 } 222 }
214} 223}
215 224
216void OTabWidget::setCurrentTab( QWidget *childwidget ) 225void OTabWidget::setCurrentTab( QWidget *childwidget )
217{ 226{
218 OTabInfo *currtab = m_tabs.first(); 227 OTabInfo *currtab = m_tabs.first();
219 while ( currtab && currtab->control() != childwidget ) 228 while ( currtab && currtab->control() != childwidget )
220 { 229 {
221 currtab = m_tabs.next(); 230 currtab = m_tabs.next();
222 } 231 }