summaryrefslogtreecommitdiff
path: root/libqtaux/qsplitter.cpp
Unidiff
Diffstat (limited to 'libqtaux/qsplitter.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libqtaux/qsplitter.cpp4
1 files changed, 0 insertions, 4 deletions
diff --git a/libqtaux/qsplitter.cpp b/libqtaux/qsplitter.cpp
index ab6e01b..39321f8 100644
--- a/libqtaux/qsplitter.cpp
+++ b/libqtaux/qsplitter.cpp
@@ -1,428 +1,424 @@
1/**************************************************************************** 1/****************************************************************************
2** $Id$ 2** $Id$
3** 3**
4** Splitter widget 4** Splitter widget
5** 5**
6** Created: 980105 6** Created: 980105
7** 7**
8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. 8** Copyright (C) 1992-2000 Trolltech AS. All rights reserved.
9** 9**
10** This file is part of the widgets module of the Qt GUI Toolkit. 10** This file is part of the widgets module of the Qt GUI Toolkit.
11** 11**
12** This file may be distributed under the terms of the Q Public License 12** This file may be distributed under the terms of the Q Public License
13** as defined by Trolltech AS of Norway and appearing in the file 13** as defined by Trolltech AS of Norway and appearing in the file
14** LICENSE.QPL included in the packaging of this file. 14** LICENSE.QPL included in the packaging of this file.
15** 15**
16** This file may be distributed and/or modified under the terms of the 16** This file may be distributed and/or modified under the terms of the
17** GNU General Public License version 2 as published by the Free Software 17** GNU General Public License version 2 as published by the Free Software
18** Foundation and appearing in the file LICENSE.GPL included in the 18** Foundation and appearing in the file LICENSE.GPL included in the
19** packaging of this file. 19** packaging of this file.
20** 20**
21** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition 21** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
22** licenses may use this file in accordance with the Qt Commercial License 22** licenses may use this file in accordance with the Qt Commercial License
23** Agreement provided with the Software. 23** Agreement provided with the Software.
24** 24**
25** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 25** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
26** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 26** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27** 27**
28** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for 28** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
29** information about Qt Commercial License Agreements. 29** information about Qt Commercial License Agreements.
30** See http://www.trolltech.com/qpl/ for QPL licensing information. 30** See http://www.trolltech.com/qpl/ for QPL licensing information.
31** See http://www.trolltech.com/gpl/ for GPL licensing information. 31** See http://www.trolltech.com/gpl/ for GPL licensing information.
32** 32**
33** Contact info@trolltech.com if any conditions of this licensing are 33** Contact info@trolltech.com if any conditions of this licensing are
34** not clear to you. 34** not clear to you.
35** 35**
36**********************************************************************/ 36**********************************************************************/
37#include "qsplitter.h" 37#include "qsplitter.h"
38 38
39#include "qpainter.h"
40#include "qdrawutil.h" 39#include "qdrawutil.h"
41#include "qbitmap.h"
42#include "qlayoutengine_p.h" 40#include "qlayoutengine_p.h"
43#include "qlist.h"
44#include "qarray.h"
45#include "qobjectlist.h" 41#include "qobjectlist.h"
46#include "qapplication.h" //sendPostedEvents 42#include "qapplication.h" //sendPostedEvents
47 43
48class QSplitterHandle : public QWidget 44class QSplitterHandle : public QWidget
49{ 45{
50public: 46public:
51 QSplitterHandle( Qt::Orientation o, 47 QSplitterHandle( Qt::Orientation o,
52 QSplitter *parent, const char* name=0 ); 48 QSplitter *parent, const char* name=0 );
53 void setOrientation( Qt::Orientation o ); 49 void setOrientation( Qt::Orientation o );
54 Qt::Orientation orientation() const { return orient; } 50 Qt::Orientation orientation() const { return orient; }
55 51
56 bool opaque() const { return s->opaqueResize(); } 52 bool opaque() const { return s->opaqueResize(); }
57 53
58 QSize sizeHint() const; 54 QSize sizeHint() const;
59 QSizePolicy sizePolicy() const; 55 QSizePolicy sizePolicy() const;
60 56
61 int id() const { return myId; } // data->list.at(id())->wid == this 57 int id() const { return myId; } // data->list.at(id())->wid == this
62 void setId( int i ) { myId = i; } 58 void setId( int i ) { myId = i; }
63 59
64protected: 60protected:
65 void paintEvent( QPaintEvent * ); 61 void paintEvent( QPaintEvent * );
66 void mouseMoveEvent( QMouseEvent * ); 62 void mouseMoveEvent( QMouseEvent * );
67 void mousePressEvent( QMouseEvent * ); 63 void mousePressEvent( QMouseEvent * );
68 void mouseReleaseEvent( QMouseEvent * ); 64 void mouseReleaseEvent( QMouseEvent * );
69 65
70private: 66private:
71 Qt::Orientation orient; 67 Qt::Orientation orient;
72 bool opaq; 68 bool opaq;
73 int myId; 69 int myId;
74 70
75 QSplitter *s; 71 QSplitter *s;
76}; 72};
77 73
78static int mouseOffset; 74static int mouseOffset;
79static int opaqueOldPos = -1; //### there's only one mouse, but this is a bit risky 75static int opaqueOldPos = -1; //### there's only one mouse, but this is a bit risky
80 76
81 77
82QSplitterHandle::QSplitterHandle( Qt::Orientation o, 78QSplitterHandle::QSplitterHandle( Qt::Orientation o,
83 QSplitter *parent, const char * name ) 79 QSplitter *parent, const char * name )
84 : QWidget( parent, name ) 80 : QWidget( parent, name )
85{ 81{
86 s = parent; 82 s = parent;
87 setOrientation(o); 83 setOrientation(o);
88} 84}
89 85
90QSizePolicy QSplitterHandle::sizePolicy() const 86QSizePolicy QSplitterHandle::sizePolicy() const
91{ 87{
92 //### removeme 3.0 88 //### removeme 3.0
93 return QWidget::sizePolicy(); 89 return QWidget::sizePolicy();
94} 90}
95 91
96QSize QSplitterHandle::sizeHint() const 92QSize QSplitterHandle::sizeHint() const
97{ 93{
98 int sw = style().splitterWidth(); 94 int sw = style().splitterWidth();
99 return QSize(sw,sw).expandedTo( QApplication::globalStrut() ); 95 return QSize(sw,sw).expandedTo( QApplication::globalStrut() );
100} 96}
101 97
102void QSplitterHandle::setOrientation( Qt::Orientation o ) 98void QSplitterHandle::setOrientation( Qt::Orientation o )
103{ 99{
104 orient = o; 100 orient = o;
105#ifndef QT_NO_CURSOR 101#ifndef QT_NO_CURSOR
106 if ( o == QSplitter::Horizontal ) 102 if ( o == QSplitter::Horizontal )
107 setCursor( splitHCursor ); 103 setCursor( splitHCursor );
108 else 104 else
109 setCursor( splitVCursor ); 105 setCursor( splitVCursor );
110#endif 106#endif
111} 107}
112 108
113 109
114void QSplitterHandle::mouseMoveEvent( QMouseEvent *e ) 110void QSplitterHandle::mouseMoveEvent( QMouseEvent *e )
115{ 111{
116 if ( !(e->state()&LeftButton) ) 112 if ( !(e->state()&LeftButton) )
117 return; 113 return;
118 QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos())) 114 QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos()))
119 - mouseOffset; 115 - mouseOffset;
120 if ( opaque() ) { 116 if ( opaque() ) {
121 s->moveSplitter( pos, id() ); 117 s->moveSplitter( pos, id() );
122 } else { 118 } else {
123 int min = pos; int max = pos; 119 int min = pos; int max = pos;
124 s->getRange( id(), &min, &max ); 120 s->getRange( id(), &min, &max );
125 s->setRubberband( QMAX( min, QMIN(max, pos ))); 121 s->setRubberband( QMAX( min, QMIN(max, pos )));
126 } 122 }
127} 123}
128 124
129void QSplitterHandle::mousePressEvent( QMouseEvent *e ) 125void QSplitterHandle::mousePressEvent( QMouseEvent *e )
130{ 126{
131 if ( e->button() == LeftButton ) 127 if ( e->button() == LeftButton )
132 mouseOffset = s->pick(e->pos()); 128 mouseOffset = s->pick(e->pos());
133} 129}
134 130
135void QSplitterHandle::mouseReleaseEvent( QMouseEvent *e ) 131void QSplitterHandle::mouseReleaseEvent( QMouseEvent *e )
136{ 132{
137 if ( !opaque() && e->button() == LeftButton ) { 133 if ( !opaque() && e->button() == LeftButton ) {
138 QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos())); 134 QCOORD pos = s->pick(parentWidget()->mapFromGlobal(e->globalPos()));
139 s->setRubberband( -1 ); 135 s->setRubberband( -1 );
140 s->moveSplitter( pos, id() ); 136 s->moveSplitter( pos, id() );
141 } 137 }
142} 138}
143 139
144void QSplitterHandle::paintEvent( QPaintEvent * ) 140void QSplitterHandle::paintEvent( QPaintEvent * )
145{ 141{
146 QPainter p( this ); 142 QPainter p( this );
147 s->drawSplitter( &p, 0, 0, width(), height() ); 143 s->drawSplitter( &p, 0, 0, width(), height() );
148} 144}
149 145
150 146
151class QSplitterLayoutStruct 147class QSplitterLayoutStruct
152{ 148{
153public: 149public:
154 QSplitter::ResizeMode mode; 150 QSplitter::ResizeMode mode;
155 QCOORD sizer; 151 QCOORD sizer;
156 bool isSplitter; 152 bool isSplitter;
157 QWidget *wid; 153 QWidget *wid;
158}; 154};
159 155
160class QSplitterData 156class QSplitterData
161{ 157{
162public: 158public:
163 QSplitterData() : opaque( FALSE ), firstShow( TRUE ) {} 159 QSplitterData() : opaque( FALSE ), firstShow( TRUE ) {}
164 160
165 QList<QSplitterLayoutStruct> list; 161 QList<QSplitterLayoutStruct> list;
166 bool opaque; 162 bool opaque;
167 bool firstShow; 163 bool firstShow;
168}; 164};
169 165
170 166
171// NOT REVISED 167// NOT REVISED
172/*! 168/*!
173 \class QSplitter qsplitter.h 169 \class QSplitter qsplitter.h
174 \brief The QSplitter class implements a splitter widget. 170 \brief The QSplitter class implements a splitter widget.
175 171
176 \ingroup organizers 172 \ingroup organizers
177 173
178 A splitter lets the user control the size of child widgets by 174 A splitter lets the user control the size of child widgets by
179 dragging the boundary between the children. Any number of widgets 175 dragging the boundary between the children. Any number of widgets
180 may be controlled. 176 may be controlled.
181 177
182 To show a QListBox, a QListView and a QMultiLineEdit side by side: 178 To show a QListBox, a QListView and a QMultiLineEdit side by side:
183 179
184 \code 180 \code
185 QSplitter *split = new QSplitter( parent ); 181 QSplitter *split = new QSplitter( parent );
186 QListBox *lb = new QListBox( split ); 182 QListBox *lb = new QListBox( split );
187 QListView *lv = new QListView( split ); 183 QListView *lv = new QListView( split );
188 QMultiLineEdit *ed = new QMultiLineEdit( split ); 184 QMultiLineEdit *ed = new QMultiLineEdit( split );
189 \endcode 185 \endcode
190 186
191 In QSplitter the boundary can be either horizontal or vertical. The 187 In QSplitter the boundary can be either horizontal or vertical. The
192 default is horizontal (the children are side by side) and you 188 default is horizontal (the children are side by side) and you
193 can use setOrientation( QSplitter::Vertical ) to set it to vertical. 189 can use setOrientation( QSplitter::Vertical ) to set it to vertical.
194 190
195 By default, all widgets can be as large or as small as the user 191 By default, all widgets can be as large or as small as the user
196 wishes, down to \link QWidget::minimumSizeHint() minimumSizeHint()\endlink. 192 wishes, down to \link QWidget::minimumSizeHint() minimumSizeHint()\endlink.
197 You can naturally use setMinimumSize() and/or 193 You can naturally use setMinimumSize() and/or
198 setMaximumSize() on the children. Use setResizeMode() to specify that 194 setMaximumSize() on the children. Use setResizeMode() to specify that
199 a widget should keep its size when the splitter is resized. 195 a widget should keep its size when the splitter is resized.
200 196
201 QSplitter normally resizes the children only at the end of a 197 QSplitter normally resizes the children only at the end of a
202 resize operation, but if you call setOpaqueResize( TRUE ), the 198 resize operation, but if you call setOpaqueResize( TRUE ), the
203 widgets are resized as often as possible. 199 widgets are resized as often as possible.
204 200
205 The initial distribution of size between the widgets is determined 201 The initial distribution of size between the widgets is determined
206 by the initial size of each widget. You can also use setSizes() to 202 by the initial size of each widget. You can also use setSizes() to
207 set the sizes of all the widgets. The function sizes() returns the 203 set the sizes of all the widgets. The function sizes() returns the
208 sizes set by the user. 204 sizes set by the user.
209 205
210 If you hide() a child, its space will be distributed among the other 206 If you hide() a child, its space will be distributed among the other
211 children. When you show() it again, it will be reinstated. 207 children. When you show() it again, it will be reinstated.
212 208
213 <img src=qsplitter-m.png> <img src=qsplitter-w.png> 209 <img src=qsplitter-m.png> <img src=qsplitter-w.png>
214 210
215 \sa QTabBar 211 \sa QTabBar
216*/ 212*/
217 213
218 214
219 215
220static QSize minSize( const QWidget *w ) 216static QSize minSize( const QWidget *w )
221{ 217{
222 QSize min = w->minimumSize(); 218 QSize min = w->minimumSize();
223 QSize s; 219 QSize s;
224 if ( min.height() <= 0 || min.width() <= 0 ) 220 if ( min.height() <= 0 || min.width() <= 0 )
225 s = w->minimumSizeHint(); 221 s = w->minimumSizeHint();
226 if ( min.height() > 0 ) 222 if ( min.height() > 0 )
227 s.setHeight( min.height() ); 223 s.setHeight( min.height() );
228 if ( min.width() > 0 ) 224 if ( min.width() > 0 )
229 s.setWidth( min.width() ); 225 s.setWidth( min.width() );
230 return s.expandedTo(QSize(0,0)); 226 return s.expandedTo(QSize(0,0));
231} 227}
232 228
233/*! 229/*!
234 Constructs a horizontal splitter. 230 Constructs a horizontal splitter.
235*/ 231*/
236 232
237QSplitter::QSplitter( QWidget *parent, const char *name ) 233QSplitter::QSplitter( QWidget *parent, const char *name )
238 :QFrame(parent,name,WPaintUnclipped) 234 :QFrame(parent,name,WPaintUnclipped)
239{ 235{
240 orient = Horizontal; 236 orient = Horizontal;
241 init(); 237 init();
242} 238}
243 239
244 240
245/*! 241/*!
246 Constructs splitter with orientation \a o. 242 Constructs splitter with orientation \a o.
247*/ 243*/
248 244
249QSplitter::QSplitter( Orientation o, QWidget *parent, const char *name ) 245QSplitter::QSplitter( Orientation o, QWidget *parent, const char *name )
250 :QFrame(parent,name,WPaintUnclipped) 246 :QFrame(parent,name,WPaintUnclipped)
251{ 247{
252 orient = o; 248 orient = o;
253 init(); 249 init();
254} 250}
255 251
256 252
257/*! 253/*!
258 Destructs the splitter. 254 Destructs the splitter.
259*/ 255*/
260 256
261QSplitter::~QSplitter() 257QSplitter::~QSplitter()
262{ 258{
263 data->list.setAutoDelete( TRUE ); 259 data->list.setAutoDelete( TRUE );
264 delete data; 260 delete data;
265} 261}
266 262
267 263
268void QSplitter::init() 264void QSplitter::init()
269{ 265{
270 data = new QSplitterData; 266 data = new QSplitterData;
271 if ( orient == Horizontal ) 267 if ( orient == Horizontal )
272 setSizePolicy( QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Minimum) ); 268 setSizePolicy( QSizePolicy(QSizePolicy::Fixed,QSizePolicy::Minimum) );
273 else 269 else
274 setSizePolicy( QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Fixed) ); 270 setSizePolicy( QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Fixed) );
275} 271}
276 272
277 273
278/*! 274/*!
279 \fn void QSplitter::refresh() 275 \fn void QSplitter::refresh()
280 276
281 Updates the splitter state. You should not need to call this 277 Updates the splitter state. You should not need to call this
282 function during normal use of the splitter. 278 function during normal use of the splitter.
283*/ 279*/
284 280
285 281
286/*! Sets the orientation to \a o. By default the orientation is 282/*! Sets the orientation to \a o. By default the orientation is
287 horizontal (the widgets are side by side). 283 horizontal (the widgets are side by side).
288 284
289 \sa orientation() 285 \sa orientation()
290*/ 286*/
291 287
292void QSplitter::setOrientation( Orientation o ) 288void QSplitter::setOrientation( Orientation o )
293{ 289{
294 if ( orient == o ) 290 if ( orient == o )
295 return; 291 return;
296 orient = o; 292 orient = o;
297 293
298 if ( orient == Horizontal ) 294 if ( orient == Horizontal )
299 setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Minimum ) ); 295 setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Minimum ) );
300 else 296 else
301 setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed ) ); 297 setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Fixed ) );
302 298
303 QSplitterLayoutStruct *s = data->list.first(); 299 QSplitterLayoutStruct *s = data->list.first();
304 while ( s ) { 300 while ( s ) {
305 if ( s->isSplitter ) 301 if ( s->isSplitter )
306 ((QSplitterHandle*)s->wid)->setOrientation( o ); 302 ((QSplitterHandle*)s->wid)->setOrientation( o );
307 s = data->list.next(); // ### next at end of loop, no iterator 303 s = data->list.next(); // ### next at end of loop, no iterator
308 } 304 }
309 recalc( isVisible() ); 305 recalc( isVisible() );
310} 306}
311 307
312 308
313/*! 309/*!
314 \fn Orientation QSplitter::orientation() const 310 \fn Orientation QSplitter::orientation() const
315 311
316 Returns the orientation (\c Horizontal or \c Vertical) of the splitter. 312 Returns the orientation (\c Horizontal or \c Vertical) of the splitter.
317 \sa setOrientation() 313 \sa setOrientation()
318*/ 314*/
319 315
320/*! 316/*!
321 \reimp 317 \reimp
322*/ 318*/
323void QSplitter::resizeEvent( QResizeEvent * ) 319void QSplitter::resizeEvent( QResizeEvent * )
324{ 320{
325 doResize(); 321 doResize();
326} 322}
327 323
328 324
329/*! 325/*!
330 Inserts the widget \a w at the end, or at the beginning if \a first is TRUE 326 Inserts the widget \a w at the end, or at the beginning if \a first is TRUE
331 327
332 It is the responsibility of the caller of this function to make sure 328 It is the responsibility of the caller of this function to make sure
333 that \a w is not already in the splitter, and to call recalcId if 329 that \a w is not already in the splitter, and to call recalcId if
334 needed. (If \a first is TRUE, then recalcId is very probably 330 needed. (If \a first is TRUE, then recalcId is very probably
335 needed.) 331 needed.)
336*/ 332*/
337 333
338QSplitterLayoutStruct *QSplitter::addWidget( QWidget *w, bool first ) 334QSplitterLayoutStruct *QSplitter::addWidget( QWidget *w, bool first )
339{ 335{
340 QSplitterLayoutStruct *s; 336 QSplitterLayoutStruct *s;
341 QSplitterHandle *newHandle = 0; 337 QSplitterHandle *newHandle = 0;
342 if ( data->list.count() > 0 ) { 338 if ( data->list.count() > 0 ) {
343 s = new QSplitterLayoutStruct; 339 s = new QSplitterLayoutStruct;
344 s->mode = KeepSize; 340 s->mode = KeepSize;
345 newHandle = new QSplitterHandle( orientation(), this ); 341 newHandle = new QSplitterHandle( orientation(), this );
346 s->wid = newHandle; 342 s->wid = newHandle;
347 newHandle->setId(data->list.count()); 343 newHandle->setId(data->list.count());
348 s->isSplitter = TRUE; 344 s->isSplitter = TRUE;
349 s->sizer = pick( newHandle->sizeHint() ); 345 s->sizer = pick( newHandle->sizeHint() );
350 if ( first ) 346 if ( first )
351 data->list.insert( 0, s ); 347 data->list.insert( 0, s );
352 else 348 else
353 data->list.append( s ); 349 data->list.append( s );
354 } 350 }
355 s = new QSplitterLayoutStruct; 351 s = new QSplitterLayoutStruct;
356 s->mode = Stretch; 352 s->mode = Stretch;
357 s->wid = w; 353 s->wid = w;
358 if ( !testWState( WState_Resized ) && w->sizeHint().isValid() ) 354 if ( !testWState( WState_Resized ) && w->sizeHint().isValid() )
359 s->sizer = pick( w->sizeHint() ); 355 s->sizer = pick( w->sizeHint() );
360 else 356 else
361 s->sizer = pick( w->size() ); 357 s->sizer = pick( w->size() );
362 s->isSplitter = FALSE; 358 s->isSplitter = FALSE;
363 if ( first ) 359 if ( first )
364 data->list.insert( 0, s ); 360 data->list.insert( 0, s );
365 else 361 else
366 data->list.append( s ); 362 data->list.append( s );
367 if ( newHandle && isVisible() ) 363 if ( newHandle && isVisible() )
368 newHandle->show(); //will trigger sending of post events 364 newHandle->show(); //will trigger sending of post events
369 return s; 365 return s;
370} 366}
371 367
372 368
373/*! 369/*!
374 Tells the splitter that a child widget has been inserted/removed. 370 Tells the splitter that a child widget has been inserted/removed.
375*/ 371*/
376 372
377void QSplitter::childEvent( QChildEvent *c ) 373void QSplitter::childEvent( QChildEvent *c )
378{ 374{
379 if ( c->type() == QEvent::ChildInserted ) { 375 if ( c->type() == QEvent::ChildInserted ) {
380 if ( !c->child()->isWidgetType() ) 376 if ( !c->child()->isWidgetType() )
381 return; 377 return;
382 378
383 if ( ((QWidget*)c->child())->testWFlags( WType_TopLevel ) ) 379 if ( ((QWidget*)c->child())->testWFlags( WType_TopLevel ) )
384 return; 380 return;
385 381
386 QSplitterLayoutStruct *s = data->list.first(); 382 QSplitterLayoutStruct *s = data->list.first();
387 while ( s ) { 383 while ( s ) {
388 if ( s->wid == c->child() ) 384 if ( s->wid == c->child() )
389 return; 385 return;
390 s = data->list.next(); 386 s = data->list.next();
391 } 387 }
392 addWidget( (QWidget*)c->child() ); 388 addWidget( (QWidget*)c->child() );
393 recalc( isVisible() ); 389 recalc( isVisible() );
394 390
395 } else if ( c->type() == QEvent::ChildRemoved ) { 391 } else if ( c->type() == QEvent::ChildRemoved ) {
396 QSplitterLayoutStruct *p = 0; 392 QSplitterLayoutStruct *p = 0;
397 if ( data->list.count() > 1 ) 393 if ( data->list.count() > 1 )
398 p = data->list.at(1); //remove handle _after_ first widget. 394 p = data->list.at(1); //remove handle _after_ first widget.
399 QSplitterLayoutStruct *s = data->list.first(); 395 QSplitterLayoutStruct *s = data->list.first();
400 while ( s ) { 396 while ( s ) {
401 if ( s->wid == c->child() ) { 397 if ( s->wid == c->child() ) {
402 data->list.removeRef( s ); 398 data->list.removeRef( s );
403 delete s; 399 delete s;
404 if ( p && p->isSplitter ) { 400 if ( p && p->isSplitter ) {
405 data->list.removeRef( p ); 401 data->list.removeRef( p );
406 delete p->wid; //will call childEvent 402 delete p->wid; //will call childEvent
407 delete p; 403 delete p;
408 } 404 }
409 recalcId(); 405 recalcId();
410 doResize(); 406 doResize();
411 return; 407 return;
412 } 408 }
413 p = s; 409 p = s;
414 s = data->list.next(); 410 s = data->list.next();
415 } 411 }
416 } 412 }
417} 413}
418 414
419 415
420/*! 416/*!
421 Shows a rubber band at position \a p. If \a p is negative, the 417 Shows a rubber band at position \a p. If \a p is negative, the
422 rubber band is removed. 418 rubber band is removed.
423*/ 419*/
424 420
425void QSplitter::setRubberband( int p ) 421void QSplitter::setRubberband( int p )
426{ 422{
427 QPainter paint( this ); 423 QPainter paint( this );
428 paint.setPen( gray ); 424 paint.setPen( gray );