diff options
Diffstat (limited to 'kdgantt/KDGanttMinimizeSplitter.cpp')
-rw-r--r-- | kdgantt/KDGanttMinimizeSplitter.cpp | 136 |
1 files changed, 68 insertions, 68 deletions
diff --git a/kdgantt/KDGanttMinimizeSplitter.cpp b/kdgantt/KDGanttMinimizeSplitter.cpp index 9ba1dbd2..8924ed33 100644 --- a/kdgantt/KDGanttMinimizeSplitter.cpp +++ b/kdgantt/KDGanttMinimizeSplitter.cpp @@ -66,7 +66,7 @@ KDGanttSplitterHandle::KDGanttSplitterHandle( Qt::Orientation o, setMouseTracking( true ); } -TQSize KDGanttSplitterHandle::tqsizeHint() const +TQSize KDGanttSplitterHandle::sizeHint() const { return TQSize(8,8); } @@ -240,16 +240,16 @@ void KDGanttSplitterHandle::paintEvent( TQPaintEvent * ) TQPainter p( &buffer ); // Draw the splitter rectangle - p.setBrush( tqcolorGroup().background() ); - p.setPen( tqcolorGroup().foreground() ); + p.setBrush( colorGroup().background() ); + p.setPen( colorGroup().foreground() ); p.drawRect( rect() ); parentWidget()->tqstyle().tqdrawPrimitive( TQStyle::PE_Panel, &p, rect(), - parentWidget()->tqcolorGroup()); + parentWidget()->colorGroup()); int sw = 8; // Hardcoded, given I didn't use styles anymore, I didn't like to use their size // arrow color - TQColor col = tqcolorGroup().background().dark( 200 ); + TQColor col = colorGroup().background().dark( 200 ); p.setBrush( col ); p.setPen( col ); @@ -258,13 +258,13 @@ void KDGanttSplitterHandle::paintEvent( TQPaintEvent * ) for ( TQValueList<TQPointArray>::Iterator it = list.begin(); it != list.end(); ++it ) { if ( index == _activeButton ) { p.save(); - p.translate( parentWidget()->tqstyle().tqpixelMetric( TQStyle::PM_ButtonShiftHorizontal ), - parentWidget()->tqstyle().tqpixelMetric( TQStyle::PM_ButtonShiftVertical ) ); - p.tqdrawPolygon( *it, true ); + p.translate( parentWidget()->tqstyle().pixelMetric( TQStyle::PM_ButtonShiftHorizontal ), + parentWidget()->tqstyle().pixelMetric( TQStyle::PM_ButtonShiftVertical ) ); + p.drawPolygon( *it, true ); p.restore(); } else { - p.tqdrawPolygon( *it, true ); + p.drawPolygon( *it, true ); } index++; } @@ -366,10 +366,10 @@ static TQSize minSize( const TQWidget* /*w*/ ) // This is the original version of minSize static TQSize minSizeHint( const TQWidget* w ) { - TQSize min = w->tqminimumSize(); + TQSize min = w->minimumSize(); TQSize s; if ( min.height() <= 0 || min.width() <= 0 ) - s = w->tqminimumSizeHint(); + s = w->minimumSizeHint(); if ( min.height() > 0 ) s.setHeight( min.height() ); if ( min.width() > 0 ) @@ -415,9 +415,9 @@ void KDGanttMinimizeSplitter::init() { data = new TQSplitterData; if ( orient ==Qt::Horizontal ) - tqsetSizePolicy( TQSizePolicy(TQSizePolicy::Expanding,TQSizePolicy::Minimum) ); + setSizePolicy( TQSizePolicy(TQSizePolicy::Expanding,TQSizePolicy::Minimum) ); else - tqsetSizePolicy( TQSizePolicy(TQSizePolicy::Minimum,TQSizePolicy::Expanding) ); + setSizePolicy( TQSizePolicy(TQSizePolicy::Minimum,TQSizePolicy::Expanding) ); } @@ -435,9 +435,9 @@ void KDGanttMinimizeSplitter::setOrientation( Qt::Orientation o ) orient = o; if ( orient ==Qt::Horizontal ) - tqsetSizePolicy( TQSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Minimum ) ); + setSizePolicy( TQSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Minimum ) ); else - tqsetSizePolicy( TQSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Expanding ) ); + setSizePolicy( TQSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Expanding ) ); KDGanttSplitterLayoutStruct *s = data->list.first(); while ( s ) { @@ -480,7 +480,7 @@ KDGanttSplitterLayoutStruct *KDGanttMinimizeSplitter::addWidget( TQWidget *w, bo s->wid = newHandle; newHandle->setId(data->list.count()); s->isSplitter = TRUE; - s->sizer = pick( newHandle->tqsizeHint() ); + s->sizer = pick( newHandle->sizeHint() ); if ( first ) data->list.insert( 0, s ); else @@ -489,8 +489,8 @@ KDGanttSplitterLayoutStruct *KDGanttMinimizeSplitter::addWidget( TQWidget *w, bo s = new KDGanttSplitterLayoutStruct; s->mode = Stretch; s->wid = w; - if ( !testWState( WState_Resized ) && w->tqsizeHint().isValid() ) - s->sizer = pick( w->tqsizeHint() ); + if ( !testWState( WState_Resized ) && w->sizeHint().isValid() ) + s->sizer = pick( w->sizeHint() ); else s->sizer = pick( w->size() ); s->isSplitter = FALSE; @@ -563,7 +563,7 @@ void KDGanttMinimizeSplitter::setRubberband( int p ) paint.setRasterOp( XorROP ); TQRect r = contentsRect(); const int rBord = 3; //Themable???? - int sw = tqstyle().tqpixelMetric(TQStyle::PM_SplitterWidth, this); + int sw = tqstyle().pixelMetric(TQStyle::PM_SplitterWidth, this); if ( orient ==Qt::Horizontal ) { if ( opaqueOldPos >= 0 ) paint.drawRect( opaqueOldPos + sw/2 - rBord , r.y(), @@ -603,7 +603,7 @@ bool KDGanttMinimizeSplitter::event( TQEvent *e ) void KDGanttMinimizeSplitter::drawSplitter( TQPainter *p, TQCOORD x, TQCOORD y, TQCOORD w, TQCOORD h ) { - tqstyle().tqdrawPrimitive(TQStyle::PE_Splitter, p, TQRect(x, y, w, h), tqcolorGroup(), + tqstyle().tqdrawPrimitive(TQStyle::PE_Splitter, p, TQRect(x, y, w, h), colorGroup(), (orientation() == Qt::Horizontal ? TQStyle::Style_Horizontal : 0)); } @@ -708,12 +708,12 @@ void KDGanttMinimizeSplitter::moveBefore( int pos, int id, bool upLeft ) int dd, newLeft, nextPos; if( TQApplication::reverseLayout() && orient ==Qt::Horizontal ) { dd = w->tqgeometry().right() - pos; - dd = TQMAX( pick(minSize(w)), TQMIN(dd, pick(w->tqmaximumSize()))); + dd = TQMAX( pick(minSize(w)), TQMIN(dd, pick(w->maximumSize()))); newLeft = pos+1; nextPos = newLeft + dd; } else { dd = pos - pick( w->pos() ) + 1; - dd = TQMAX( pick(minSize(w)), TQMIN(dd, pick(w->tqmaximumSize()))); + dd = TQMAX( pick(minSize(w)), TQMIN(dd, pick(w->maximumSize()))); newLeft = pos-dd+1; nextPos = newLeft - 1; } @@ -762,13 +762,13 @@ void KDGanttMinimizeSplitter::moveAfter( int pos, int id, bool upLeft ) int right, dd,/* newRight,*/ newLeft, nextPos; if ( TQApplication::reverseLayout() && orient ==Qt::Horizontal ) { dd = pos - left + 1; - dd = TQMAX( pick(minSize(w)), TQMIN(dd, pick(w->tqmaximumSize()))); + dd = TQMAX( pick(minSize(w)), TQMIN(dd, pick(w->maximumSize()))); newLeft = pos-dd+1; nextPos = newLeft - 1; } else { right = pick( w->tqgeometry().bottomRight() ); dd = right - pos + 1; - dd = TQMAX( pick(minSize(w)), TQMIN(dd, pick(w->tqmaximumSize()))); + dd = TQMAX( pick(minSize(w)), TQMIN(dd, pick(w->maximumSize()))); /*newRight = pos+dd-1;*/ newLeft = pos; nextPos = newLeft + dd; @@ -822,7 +822,7 @@ void KDGanttMinimizeSplitter::getRange( int id, int *min, int *max ) maxB += s->sizer; } else { minB += pick( minSize(s->wid) ); - maxB += pick( s->wid->tqmaximumSize() ); + maxB += pick( s->wid->maximumSize() ); } } for ( i = id; i < n; i++ ) { @@ -834,12 +834,12 @@ void KDGanttMinimizeSplitter::getRange( int id, int *min, int *max ) maxA += s->sizer; } else { minA += pick( minSize(s->wid) ); - maxA += pick( s->wid->tqmaximumSize() ); + maxA += pick( s->wid->maximumSize() ); } } TQRect r = contentsRect(); if ( orient ==Qt::Horizontal && TQApplication::reverseLayout() ) { - int splitterWidth = tqstyle().tqpixelMetric(TQStyle::PM_SplitterWidth, this); + int splitterWidth = tqstyle().pixelMetric(TQStyle::PM_SplitterWidth, this); if ( min ) *min = pick(r.topRight()) - TQMIN( maxB, pick(r.size())-minA ) - splitterWidth; if ( max ) @@ -881,27 +881,27 @@ void KDGanttMinimizeSplitter::doResize() KDGanttSplitterLayoutStruct *s = data->list.at(i); if ( s->wid->isHidden() ) { a[i].stretch = 0; - a[i].tqsizeHint = a[i].tqminimumSize = 0; - a[i].tqmaximumSize = 0; + a[i].sizeHint = a[i].minimumSize = 0; + a[i].maximumSize = 0; } else if ( s->isSplitter ) { a[i].stretch = 0; - a[i].tqsizeHint = a[i].tqminimumSize = a[i].tqmaximumSize = s->sizer; + 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].tqminimumSize = pick( minSize(s->wid) ); - a[i].tqsizeHint = s->sizer; - a[i].tqmaximumSize = pick( s->wid->tqmaximumSize() ); + 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].tqminimumSize = a[i].tqsizeHint = pick( s->wid->tqsizeHint() ); - a[i].tqmaximumSize = pick( s->wid->tqmaximumSize() ); + 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].tqmaximumSize = pick( s->wid->tqmaximumSize() ); - a[i].tqsizeHint = a[i].tqminimumSize = pick( minSize(s->wid) ); + a[i].maximumSize = pick( s->wid->maximumSize() ); + a[i].sizeHint = a[i].minimumSize = pick( minSize(s->wid) ); a[i].empty = FALSE; } } @@ -955,9 +955,9 @@ void KDGanttMinimizeSplitter::recalc( bool update ) } else { TQSize minS = minSize(s->wid); minl += pick( minS ); - maxl += pick( s->wid->tqmaximumSize() ); + maxl += pick( s->wid->maximumSize() ); mint = TQMAX( mint, trans( minS )); - int tm = trans( s->wid->tqmaximumSize() ); + int tm = trans( s->wid->maximumSize() ); if ( tm > 0 ) maxt = TQMIN( maxt, tm ); } @@ -1107,7 +1107,7 @@ void KDGanttMinimizeSplitter::recalcId() /*! Reimplemented from superclass. */ -TQSize KDGanttMinimizeSplitter::tqsizeHint() const +TQSize KDGanttMinimizeSplitter::sizeHint() const { constPolish(); int l = 0; @@ -1121,7 +1121,7 @@ TQSize KDGanttMinimizeSplitter::tqsizeHint() const ++it; if ( o->isWidgetType() && !((TQWidget*)o)->isHidden() ) { - TQSize s = ((TQWidget*)o)->tqsizeHint(); + TQSize s = ((TQWidget*)o)->sizeHint(); if ( s.isValid() ) { l += pick( s ); t = TQMAX( t, trans( s ) ); @@ -1137,7 +1137,7 @@ TQSize KDGanttMinimizeSplitter::tqsizeHint() const \reimp */ -TQSize KDGanttMinimizeSplitter::tqminimumSizeHint() const +TQSize KDGanttMinimizeSplitter::minimumSizeHint() const { constPolish(); int l = 0; @@ -1311,7 +1311,7 @@ void KDGanttMinimizeSplitter::processChildEvents() void KDGanttMinimizeSplitter::styleChange( TQStyle& old ) { - int sw = tqstyle().tqpixelMetric(TQStyle::PM_SplitterWidth, this); + int sw = tqstyle().pixelMetric(TQStyle::PM_SplitterWidth, this); KDGanttSplitterLayoutStruct *s = data->list.first(); while ( s ) { if ( s->isSplitter ) @@ -1366,9 +1366,9 @@ void kdganttGeomCalc( TQMemArray<TQLayoutStruct> &chain, int start, int count, i int i; for ( i = start; i < start + count; i++ ) { chain[i].done = FALSE; - cHint += chain[i].tqsizeHint; - cMin += chain[i].tqminimumSize; - cMax += chain[i].tqmaximumSize; + cHint += chain[i].sizeHint; + cMin += chain[i].minimumSize; + cMax += chain[i].maximumSize; sumStretch += chain[i].stretch; if ( !chain[i].empty ) spacerCount++; @@ -1381,11 +1381,11 @@ void kdganttGeomCalc( TQMemArray<TQLayoutStruct> &chain, int start, int count, i if ( space < cMin + spacerCount * spacer ) { // qDebug("not enough space"); for ( i = start; i < start+count; i++ ) { - chain[i].size = chain[i].tqminimumSize; + chain[i].size = chain[i].minimumSize; chain[i].done = TRUE; } } else if ( space < cHint + spacerCount*spacer ) { - // Less space than tqsizeHint, but more than minimum. + // Less space than sizeHint, but more than minimum. // Currently take space equally from each, like in TQt 2.x. // Commented-out lines will give more space to stretchier items. int n = count; @@ -1393,10 +1393,10 @@ void kdganttGeomCalc( TQMemArray<TQLayoutStruct> &chain, int start, int count, i int overdraft = cHint - space_left; //first give to the fixed ones: for ( i = start; i < start+count; i++ ) { - if ( !chain[i].done && chain[i].tqminimumSize >= chain[i].tqsizeHint) { - chain[i].size = chain[i].tqsizeHint; + if ( !chain[i].done && chain[i].minimumSize >= chain[i].sizeHint) { + chain[i].size = chain[i].sizeHint; chain[i].done = TRUE; - space_left -= chain[i].tqsizeHint; + space_left -= chain[i].sizeHint; // sumStretch -= chain[i].stretch; n--; } @@ -1415,13 +1415,13 @@ void kdganttGeomCalc( TQMemArray<TQLayoutStruct> &chain, int start, int count, i // else // fp_w += (fp_over * chain[i].stretch) / sumStretch; int w = fRound( fp_w ); - chain[i].size = chain[i].tqsizeHint - w; + chain[i].size = chain[i].sizeHint - w; fp_w -= toFixed( w ); //give the difference to the next - if ( chain[i].size < chain[i].tqminimumSize ) { + if ( chain[i].size < chain[i].minimumSize ) { chain[i].done = TRUE; - chain[i].size = chain[i].tqminimumSize; + chain[i].size = chain[i].minimumSize; finished = FALSE; - overdraft -= chain[i].tqsizeHint - chain[i].tqminimumSize; + overdraft -= chain[i].sizeHint - chain[i].minimumSize; // sumStretch -= chain[i].stretch; n--; break; @@ -1433,11 +1433,11 @@ void kdganttGeomCalc( TQMemArray<TQLayoutStruct> &chain, int start, int count, i int space_left = space - spacerCount*spacer; // first give to the fixed ones, and handle non-expansiveness for ( i = start; i < start + count; i++ ) { - if ( !chain[i].done && (chain[i].tqmaximumSize <= chain[i].tqsizeHint + if ( !chain[i].done && (chain[i].maximumSize <= chain[i].sizeHint || wannaGrow && !chain[i].expansive) ) { - chain[i].size = chain[i].tqsizeHint; + chain[i].size = chain[i].sizeHint; chain[i].done = TRUE; - space_left -= chain[i].tqsizeHint; + space_left -= chain[i].sizeHint; sumStretch -= chain[i].stretch; n--; } @@ -1469,20 +1469,20 @@ void kdganttGeomCalc( TQMemArray<TQLayoutStruct> &chain, int start, int count, i int w = fRound( fp_w ); chain[i].size = w; fp_w -= toFixed( w ); // give the difference to the next - if ( w < chain[i].tqsizeHint ) { - deficit += chain[i].tqsizeHint - w; - } else if ( w > chain[i].tqmaximumSize ) { - surplus += w - chain[i].tqmaximumSize; + if ( w < chain[i].sizeHint ) { + deficit += chain[i].sizeHint - w; + } else if ( w > chain[i].maximumSize ) { + surplus += w - chain[i].maximumSize; } } if ( deficit > 0 && surplus <= deficit ) { // give to the ones that have too little for ( i = start; i < start+count; i++ ) { if ( !chain[i].done && - chain[i].size < chain[i].tqsizeHint ) { - chain[i].size = chain[i].tqsizeHint; + chain[i].size < chain[i].sizeHint ) { + chain[i].size = chain[i].sizeHint; chain[i].done = TRUE; - space_left -= chain[i].tqsizeHint; + space_left -= chain[i].sizeHint; sumStretch -= chain[i].stretch; n--; } @@ -1492,10 +1492,10 @@ void kdganttGeomCalc( TQMemArray<TQLayoutStruct> &chain, int start, int count, i // take from the ones that have too much for ( i = start; i < start+count; i++ ) { if ( !chain[i].done && - chain[i].size > chain[i].tqmaximumSize ) { - chain[i].size = chain[i].tqmaximumSize; + chain[i].size > chain[i].maximumSize ) { + chain[i].size = chain[i].maximumSize; chain[i].done = TRUE; - space_left -= chain[i].tqmaximumSize; + space_left -= chain[i].maximumSize; sumStretch -= chain[i].stretch; n--; } |