author | erik <erik> | 2007-01-29 22:00:04 (UTC) |
---|---|---|
committer | erik <erik> | 2007-01-29 22:00:04 (UTC) |
commit | 9a3875c32922a322d991e67b13e89242f71a862c (patch) (side-by-side diff) | |
tree | 4f5c7c79f7e1ee70f19b5cc3d75131b8151ad9cd /libqtaux/qsplitter.cpp | |
parent | 02ef45be75a3024df11365956e1cce6392d9103c (diff) | |
download | opie-9a3875c32922a322d991e67b13e89242f71a862c.zip opie-9a3875c32922a322d991e67b13e89242f71a862c.tar.gz opie-9a3875c32922a322d991e67b13e89242f71a862c.tar.bz2 |
Each file in this commit exhibits a problem where a variable is made in
some way but never used. This is a tricky problem with Qt since almost all
UI forms are made but not used (like QLabel). But I am pretty confident that
these changes are correct and do not have any aspect of a change to the UI.
In most cases, there are just variables that are made and then copied over
(like in iteration over lists or assignment of pointers based on
conditionals).
-rw-r--r-- | libqtaux/qsplitter.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libqtaux/qsplitter.cpp b/libqtaux/qsplitter.cpp index 39321f8..959d5e1 100644 --- a/libqtaux/qsplitter.cpp +++ b/libqtaux/qsplitter.cpp @@ -538,385 +538,385 @@ void QSplitter::moveBefore( int pos, int id, bool upLeft ) moveBefore( pos, id-1, upLeft ); } else if ( s->isSplitter ) { int dd = s->sizer; if ( upLeft ) { setG( w, pos-dd+1, dd ); moveBefore( pos-dd, id-1, upLeft ); } else { moveBefore( pos-dd, id-1, upLeft ); setG( w, pos-dd+1, dd ); } } else { int left = pick( w->pos() ); int dd = pos - left + 1; dd = QMAX( pick(minSize(w)), QMIN(dd, pick(w->maximumSize()))); int newLeft = pos-dd+1; setG( w, newLeft, dd ); if ( left != newLeft ) moveBefore( newLeft-1, id-1, upLeft ); } } /*! Places the left/top edge of the widget at \a id at position \a pos. \sa idAfter() */ void QSplitter::moveAfter( int pos, int id, bool upLeft ) { QSplitterLayoutStruct *s = id < int(data->list.count()) ? data->list.at(id) : 0; if ( !s ) return; QWidget *w = s->wid; if ( w->isHidden() ) { moveAfter( pos, id+1, upLeft ); } else if ( pick( w->pos() ) == pos ) { //No need to do anything if it's already there. return; } else if ( s->isSplitter ) { int dd = s->sizer; if ( upLeft ) { setG( w, pos, dd ); moveAfter( pos+dd, id+1, upLeft ); } else { moveAfter( pos+dd, id+1, upLeft ); setG( w, pos, dd ); } } else { int right = pick( w->geometry().bottomRight() ); int dd = right - pos + 1; dd = QMAX( pick(minSize(w)), QMIN(dd, pick(w->maximumSize()))); int newRight = pos+dd-1; setG( w, pos, dd ); moveAfter( newRight+1, id+1, upLeft ); } } /*! Returns the valid range of the splitter with id \a id in \a min and \a max. \sa idAfter() */ void QSplitter::getRange( int id, int *min, int *max ) { int minB = 0; //before int maxB = 0; int minA = 0; int maxA = 0; //after int n = data->list.count(); if ( id < 0 || id >= n ) return; int i; for ( i = 0; i < id; i++ ) { QSplitterLayoutStruct *s = data->list.at(i); if ( s->wid->isHidden() ) { //ignore } else if ( s->isSplitter ) { minB += s->sizer; maxB += s->sizer; } else { minB += pick( minSize(s->wid) ); maxB += pick( s->wid->maximumSize() ); } } for ( i = id; i < n; i++ ) { QSplitterLayoutStruct *s = data->list.at(i); if ( s->wid->isHidden() ) { //ignore } else if ( s->isSplitter ) { minA += s->sizer; maxA += s->sizer; } else { minA += pick( minSize(s->wid) ); maxA += pick( s->wid->maximumSize() ); } } QRect r = contentsRect(); if ( min ) *min = pick(r.topLeft()) + QMAX( minB, pick(r.size())-maxA ); if ( max ) *max = pick(r.topLeft()) + QMIN( maxB, pick(r.size())-minA ); } /*! Returns the legal position closest to \a p of the splitter with id \a id. \sa idAfter() */ int QSplitter::adjustPos( int p, int id ) { int min = 0; int max = 0; getRange( id, &min, &max ); p = QMAX( min, QMIN( p, max ) ); return p; } void QSplitter::doResize() { QRect r = contentsRect(); int i; int n = data->list.count(); QArray<QLayoutStruct> a( n ); for ( i = 0; i< n; i++ ) { a[i].init(); QSplitterLayoutStruct *s = data->list.at(i); if ( s->wid->isHidden() ) { a[i].stretch = 0; a[i].sizeHint = a[i].minimumSize = 0; a[i].maximumSize = 0; } else if ( s->isSplitter ) { a[i].stretch = 0; a[i].sizeHint = a[i].minimumSize = a[i].maximumSize = s->sizer; a[i].empty = FALSE; } else if ( s->mode == KeepSize ) { a[i].stretch = 0; a[i].minimumSize = pick( minSize(s->wid) ); a[i].sizeHint = s->sizer; a[i].maximumSize = pick( s->wid->maximumSize() ); a[i].empty = FALSE; } else if ( s->mode == FollowSizeHint ) { a[i].stretch = 0; a[i].minimumSize = a[i].sizeHint = pick( s->wid->sizeHint() ); a[i].maximumSize = pick( s->wid->maximumSize() ); a[i].empty = FALSE; } else { //proportional a[i].stretch = s->sizer; a[i].maximumSize = pick( s->wid->maximumSize() ); a[i].sizeHint = a[i].minimumSize = pick( minSize(s->wid) ); a[i].empty = FALSE; } } qGeomCalc( a, 0, n, pick( r.topLeft() ), pick( r.size() ), 0 ); for ( i = 0; i< n; i++ ) { QSplitterLayoutStruct *s = data->list.at(i); if ( orient == Horizontal ) s->wid->setGeometry( a[i].pos, r.top(), a[i].size, r.height() ); else s->wid->setGeometry( r.left(), a[i].pos, r.width(), a[i].size ); } } void QSplitter::recalc( bool update ) { int fi = 2*frameWidth(); int maxl = fi; int minl = fi; int maxt = QWIDGETSIZE_MAX; int mint = fi; int n = data->list.count(); bool first = TRUE; /* The splitter before a hidden widget is always hidden. The splitter before the first visible widget is hidden. The splitter before any other visible widget is visible. */ for ( int i = 0; i< n; i++ ) { QSplitterLayoutStruct *s = data->list.at(i); if ( !s->isSplitter ) { - QSplitterLayoutStruct *p = (i > 0) ? p = data->list.at( i-1 ) : 0; + QSplitterLayoutStruct *p = (i > 0) ? data->list.at( i-1 ) : 0; if ( p && p->isSplitter ) if ( first || s->wid->isHidden() ) p->wid->hide(); //may trigger new recalc else p->wid->show(); //may trigger new recalc if ( !s->wid->isHidden() ) first = FALSE; } } bool empty=TRUE; for ( int j = 0; j< n; j++ ) { QSplitterLayoutStruct *s = data->list.at(j); if ( !s->wid->isHidden() ) { empty = FALSE; if ( s->isSplitter ) { minl += s->sizer; maxl += s->sizer; } else { QSize minS = minSize(s->wid); minl += pick( minS ); maxl += pick( s->wid->maximumSize() ); mint = QMAX( mint, trans( minS )); int tm = trans( s->wid->maximumSize() ); if ( tm > 0 ) maxt = QMIN( maxt, tm ); } } } if ( empty ) maxl = maxt = 0; else maxl = QMIN( maxl, QWIDGETSIZE_MAX ); if ( maxt < mint ) maxt = mint; if ( orient == Horizontal ) { setMaximumSize( maxl, maxt ); setMinimumSize( minl, mint ); } else { setMaximumSize( maxt, maxl ); setMinimumSize( mint, minl ); } if ( update ) doResize(); } /*! \enum QSplitter::ResizeMode This enum type describes how QSplitter will resize each of its child widgets. The currently defined values are: <ul> <li> \c Stretch - the widget will be resized when the splitter itself is resized. <li> \c KeepSize - QSplitter will try to keep this widget's size unchanged. <li> \c FollowSizeHint - QSplitter will resize the widget when its size hint changes. </ul> */ /*! Sets resize mode of \a w to \a mode. \sa ResizeMode */ void QSplitter::setResizeMode( QWidget *w, ResizeMode mode ) { processChildEvents(); QSplitterLayoutStruct *s = data->list.first(); while ( s ) { if ( s->wid == w ) { s->mode = mode; return; } s = data->list.next(); } s = addWidget( w, TRUE ); s->mode = mode; } /*! Returns TRUE if opaque resize is on, FALSE otherwise. \sa setOpaqueResize() */ bool QSplitter::opaqueResize() const { return data->opaque; } /*! Sets opaque resize to \a on. Opaque resize is initially turned off. \sa opaqueResize() */ void QSplitter::setOpaqueResize( bool on ) { data->opaque = on; } /*! Moves \a w to the leftmost/top position. */ void QSplitter::moveToFirst( QWidget *w ) { processChildEvents(); bool found = FALSE; QSplitterLayoutStruct *s = data->list.first(); while ( s ) { if ( s->wid == w ) { found = TRUE; QSplitterLayoutStruct *p = data->list.prev(); if ( p ) { // not already at first place data->list.take(); //take p data->list.take(); // take s data->list.insert( 0, p ); data->list.insert( 0, s ); } break; } s = data->list.next(); } if ( !found ) addWidget( w, TRUE ); recalcId(); } /*! Moves \a w to the rightmost/bottom position. */ void QSplitter::moveToLast( QWidget *w ) { processChildEvents(); bool found = FALSE; QSplitterLayoutStruct *s = data->list.first(); while ( s ) { if ( s->wid == w ) { found = TRUE; data->list.take(); // take s QSplitterLayoutStruct *p = data->list.current(); if ( p ) { // the splitter handle after s data->list.take(); //take p data->list.append( p ); } data->list.append( s ); break; } s = data->list.next(); } if ( !found ) addWidget( w); recalcId(); } void QSplitter::recalcId() { int n = data->list.count(); for ( int i = 0; i < n; i++ ) { QSplitterLayoutStruct *s = data->list.at(i); if ( s->isSplitter ) ((QSplitterHandle*)s->wid)->setId(i); } } /*!\reimp */ QSize QSplitter::sizeHint() const { constPolish(); int l = 0; int t = 0; if ( children() ) { const QObjectList * c = children(); QObjectListIt it( *c ); QObject * o; while( (o=it.current()) != 0 ) { |