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 f11832f37..09f0b8528 100644 --- a/kdgantt/KDGanttMinimizeSplitter.cpp +++ b/kdgantt/KDGanttMinimizeSplitter.cpp @@ -64,7 +64,7 @@ KDGanttSplitterHandle::KDGanttSplitterHandle( Qt::Orientation o, setMouseTracking( true ); } -TQSize KDGanttSplitterHandle::tqsizeHint() const +TQSize KDGanttSplitterHandle::sizeHint() const { return TQSize(8,8); } @@ -238,16 +238,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 ); @@ -256,13 +256,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++; } @@ -364,10 +364,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 ) @@ -413,9 +413,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) ); } @@ -433,9 +433,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 ) ); TQSplitterLayoutStruct *s = data->list.first(); while ( s ) { @@ -478,7 +478,7 @@ TQSplitterLayoutStruct *KDGanttMinimizeSplitter::addWidget( TQWidget *w, bool fi 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 @@ -487,8 +487,8 @@ TQSplitterLayoutStruct *KDGanttMinimizeSplitter::addWidget( TQWidget *w, bool fi s = new TQSplitterLayoutStruct; 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; @@ -561,7 +561,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(), @@ -601,7 +601,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)); } @@ -706,12 +706,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; } @@ -760,13 +760,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; @@ -820,7 +820,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++ ) { @@ -832,12 +832,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 ) @@ -879,27 +879,27 @@ void KDGanttMinimizeSplitter::doResize() TQSplitterLayoutStruct *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; } } @@ -953,9 +953,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 ); } @@ -1105,7 +1105,7 @@ void KDGanttMinimizeSplitter::recalcId() /*! Reimplemented from superclass. */ -TQSize KDGanttMinimizeSplitter::tqsizeHint() const +TQSize KDGanttMinimizeSplitter::sizeHint() const { constPolish(); int l = 0; @@ -1119,7 +1119,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 ) ); @@ -1135,7 +1135,7 @@ TQSize KDGanttMinimizeSplitter::tqsizeHint() const \reimp */ -TQSize KDGanttMinimizeSplitter::tqminimumSizeHint() const +TQSize KDGanttMinimizeSplitter::minimumSizeHint() const { constPolish(); int l = 0; @@ -1309,7 +1309,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); TQSplitterLayoutStruct *s = data->list.first(); while ( s ) { if ( s->isSplitter ) @@ -1364,9 +1364,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++; @@ -1379,11 +1379,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; @@ -1391,10 +1391,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--; } @@ -1413,13 +1413,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; @@ -1431,11 +1431,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--; } @@ -1467,20 +1467,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--; } @@ -1490,10 +1490,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--; } |