summaryrefslogtreecommitdiffstats
path: root/libkdchart/KDChartPiePainter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libkdchart/KDChartPiePainter.cpp')
-rw-r--r--libkdchart/KDChartPiePainter.cpp124
1 files changed, 62 insertions, 62 deletions
diff --git a/libkdchart/KDChartPiePainter.cpp b/libkdchart/KDChartPiePainter.cpp
index f1715f1..dd00f62 100644
--- a/libkdchart/KDChartPiePainter.cpp
+++ b/libkdchart/KDChartPiePainter.cpp
@@ -30,9 +30,9 @@
#include "KDChartPiePainter.h"
#include "KDChartParams.h"
-#include <qpainter.h>
-#include <qvaluestack.h>
-#include <qmessagebox.h>
+#include <tqpainter.h>
+#include <tqvaluestack.h>
+#include <tqmessagebox.h>
#define DEGTORAD(d) (d)*M_PI/180
@@ -55,7 +55,7 @@
KDChartPainter( params )
{
// This constructor intentionally left blank so far; we cannot setup the
- // geometry yet since we do not know the size of the painter.
+ // tqgeometry yet since we do not know the size of the painter.
}
@@ -72,13 +72,13 @@ KDChartPiePainter::~KDChartPiePainter()
/**
Paints the actual data area.
- \param painter the QPainter onto which the chart should be painted
+ \param painter the TQPainter onto which the chart should be painted
\param data the data that will be displayed as a chart
\param paint2nd specifies whether the main chart or the additional chart is to be drawn now
\param regions a pointer to a list of regions that will be filled
with regions representing the data segments, if not null
*/
-void KDChartPiePainter::paintData( QPainter* painter,
+void KDChartPiePainter::paintData( TQPainter* painter,
KDChartTableDataBase* data,
bool paint2nd,
KDChartDataRegionList* regions )
@@ -86,12 +86,12 @@ void KDChartPiePainter::paintData( QPainter* painter,
//bHelp=true;
uint chart = paint2nd ? 1 : 0;
- QRect ourClipRect( _dataRect );
+ TQRect ourClipRect( _dataRect );
ourClipRect.addCoords( -1,-1,1,1 );
- const QWMatrix & world = painter->worldMatrix();
+ const TQWMatrix & world = painter->tqworldMatrix();
ourClipRect =
-#if COMPAT_QT_VERSION >= 0x030000
+#if COMPAT_TQT_VERSION >= 0x030000
world.mapRect( ourClipRect );
#else
world.map( ourClipRect );
@@ -125,7 +125,7 @@ void KDChartPiePainter::paintData( QPainter* painter,
_angleLens.resize( _numValues );
// compute position
- _size = QMIN( _dataRect.width(), _dataRect.height() ); // initial size
+ _size = TQMIN( _dataRect.width(), _dataRect.height() ); // initial size
// if the pies explode, we need to give them additional space =>
// make the basic size smaller
if ( params()->explode() ) {
@@ -139,7 +139,7 @@ void KDChartPiePainter::paintData( QPainter* painter,
int x = ( _dataRect.width() == _size ) ? 0 : ( ( _dataRect.width() - _size ) / 2 );
int y = ( _dataRect.height() == _size ) ? 0 : ( ( _dataRect.height() - _size ) / 2 );
- _position = QRect( x, y, _size, _size );
+ _position = TQRect( x, y, _size, _size );
_position.moveBy( _dataRect.left(), _dataRect.top() );
} else {
// threeD: width is the maximum possible width; height is 1/2 of that
@@ -158,7 +158,7 @@ void KDChartPiePainter::paintData( QPainter* painter,
}
int y = ( _dataRect.height() == height ) ? 0 : ( ( _dataRect.height() - height - sizeFor3DEffect ) / 2 );
- _position = QRect( _dataRect.left() + x, _dataRect.top() + y,
+ _position = TQRect( _dataRect.left() + x, _dataRect.top() + y,
_size, height );
// _position.moveBy( _dataRect.left(), _dataRect.top() );
}
@@ -166,17 +166,17 @@ void KDChartPiePainter::paintData( QPainter* painter,
double sum = data->rowAbsSum( dataset );
if( sum==0 ) //nothing to draw
return;
- double sectorsPerValue = 5760.0 / sum; // 5760 == 16*360, number of sections in Qt circle
+ double sectorsPerValue = 5760.0 / sum; // 5760 == 16*360, number of sections in TQt circle
int currentValue = params()->pieStart() * 16;
bool atLeastOneValue = false; // guard against completely empty tables
- QVariant vValY;
+ TQVariant vValY;
for ( int value = 0; value < _numValues; value++ ) {
// is there anything at all at this value
/* see above for meaning of 16 */
if( data->cellCoord( dataset, value, vValY, 1 ) &&
- QVariant::Double == vValY.type() ){
+ TQVariant::Double == vValY.type() ){
_startAngles[ value ] = currentValue;
const double cellValue = fabs( vValY.toDouble() );
_angleLens[ value ] = ( int ) floor( cellValue * sectorsPerValue + 0.5 );
@@ -205,7 +205,7 @@ void KDChartPiePainter::paintData( QPainter* painter,
int frontmostpie = findPieAt( 270 * 16 );
// and put the backmost pie on the TODO stack to initialize it,
// but only if it is not the frontmostpie
- QValueStack < int > todostack;
+ TQValueStack < int > todostack;
if ( backmostpie != frontmostpie )
todostack.push( backmostpie );
else {
@@ -225,7 +225,7 @@ void KDChartPiePainter::paintData( QPainter* painter,
// The list with pies that have already been drawn
- QValueList < int > donelist;
+ TQValueList < int > donelist;
// Draw pies until the todostack is empty or only the frontmost
// pie is there
@@ -241,7 +241,7 @@ void KDChartPiePainter::paintData( QPainter* painter,
// take one pie from the stack
int currentpie = todostack.pop();
// if this pie was already drawn, ignore it
- if ( donelist.find( currentpie ) != donelist.end() )
+ if ( donelist.tqfind( currentpie ) != donelist.end() )
continue;
// If this pie is the frontmost pie, put it back, but at the
@@ -251,7 +251,7 @@ void KDChartPiePainter::paintData( QPainter* painter,
// been terminated by the loop condition.
if ( currentpie == frontmostpie ) {
Q_ASSERT( !todostack.isEmpty() );
- // QValueStack::exchange() would be nice here...
+ // TQValueStack::exchange() would be nice here...
int secondpie = todostack.pop();
if ( currentpie == secondpie )
// no need to have the second pie twice on the stack,
@@ -278,10 +278,10 @@ void KDChartPiePainter::paintData( QPainter* painter,
// whether these have not been painted already, and put them
// on the stack.
int leftOfCurrent = findLeftPie( currentpie );
- if ( donelist.find( leftOfCurrent ) == donelist.end() )
+ if ( donelist.tqfind( leftOfCurrent ) == donelist.end() )
todostack.push( leftOfCurrent );
int rightOfCurrent = findRightPie( currentpie );
- if ( donelist.find( rightOfCurrent ) == donelist.end() )
+ if ( donelist.tqfind( rightOfCurrent ) == donelist.end() )
todostack.push( rightOfCurrent );
}
@@ -295,14 +295,14 @@ void KDChartPiePainter::paintData( QPainter* painter,
/**
Internal method that draws one of the pies in a pie chart.
- \param painter the QPainter to draw in
+ \param painter the TQPainter to draw in
\param dataset the dataset to draw the pie for
\param pie the pie to draw
\param the chart to draw the pie in
\param regions a pointer to a list of regions that will be filled
with regions representing the data segments, if not null
*/
-void KDChartPiePainter::drawOnePie( QPainter* painter,
+void KDChartPiePainter::drawOnePie( TQPainter* painter,
KDChartTableDataBase* /*data*/,
uint dataset, uint pie, uint chart,
uint threeDPieHeight,
@@ -314,19 +314,19 @@ void KDChartPiePainter::drawOnePie( QPainter* painter,
int startAngle = _startAngles[ ( int ) pie ];
KDChartDataRegion* datReg = 0;
- QRegion* region = 0;
+ TQRegion* region = 0;
bool mustDeleteRegion = false;
if ( regions ){
- region = new QRegion();
+ region = new TQRegion();
mustDeleteRegion = true;
}
- QRect drawPosition = _position;
+ TQRect drawPosition = _position;
if ( params()->explode() ) {
// need to compute a new position for each or some of the pie
- QValueList<int> explodeList = params()->explodeValues();
+ TQValueList<int> explodeList = params()->explodeValues();
if( explodeList.count() == 0 || // nothing on list, explode all
- explodeList.find( pie ) != explodeList.end() ) {
+ explodeList.tqfind( pie ) != explodeList.end() ) {
double explodeAngle = ( startAngle + angleLen / 2 ) / 16;
double explodeAngleRad = DEGTORAD( explodeAngle );
double cosAngle = cos( explodeAngleRad );
@@ -334,8 +334,8 @@ void KDChartPiePainter::drawOnePie( QPainter* painter,
// find the explode factor for this particular pie
double explodeFactor = 0.0;
- QMap<int,double> explodeFactors = params()->explodeFactors();
- if( !explodeFactors.contains( pie ) ) // not on factors list, use default
+ TQMap<int,double> explodeFactors = params()->explodeFactors();
+ if( !explodeFactors.tqcontains( pie ) ) // not on factors list, use default
explodeFactor = params()->explodeFactor();
else // on factors list, use segment-specific value
explodeFactor = explodeFactors[pie];
@@ -361,11 +361,11 @@ void KDChartPiePainter::drawOnePie( QPainter* painter,
// full circle, avoid nasty line in the middle
painter->drawEllipse( drawPosition );
if ( regions ) {
- QPointArray hitregion;
+ TQPointArray hitregion;
hitregion.makeEllipse( drawPosition.x(), drawPosition.y(),
drawPosition.width(),
drawPosition.height() );
- datReg = new KDChartDataRegion( region->unite( QRegion( hitregion ) ),
+ datReg = new KDChartDataRegion( region->unite( TQRegion( hitregion ) ),
dataset,
pie,
chart );
@@ -395,7 +395,7 @@ void KDChartPiePainter::drawOnePie( QPainter* painter,
// draw the top of this piece
// Start with getting the points for the arc.
const int arcPoints = angleLen;
- QPointArray collect(arcPoints+2);
+ TQPointArray collect(arcPoints+2);
int i=0;
for ( ; i<=angleLen; ++i){
collect.setPoint(i, pointOnCircle( drawPosition, startAngle+i ));
@@ -415,7 +415,7 @@ void KDChartPiePainter::drawOnePie( QPainter* painter,
if ( regions ) {
- QPointArray hitregion;
+ TQPointArray hitregion;
hitregion.makeArc( drawPosition.x(), drawPosition.y(),
drawPosition.width(),
drawPosition.height(),
@@ -423,7 +423,7 @@ void KDChartPiePainter::drawOnePie( QPainter* painter,
hitregion.resize( hitregion.size() + 1 );
hitregion.setPoint( hitregion.size() - 1,
drawPosition.center() );
- datReg = new KDChartDataRegion( region->unite( QRegion( hitregion ) ),
+ datReg = new KDChartDataRegion( region->unite( TQRegion( hitregion ) ),
dataset,
pie,
chart );
@@ -442,17 +442,17 @@ void KDChartPiePainter::drawOnePie( QPainter* painter,
= datReg->points[ KDChartEnums::PosBottomLeft ];
datReg->points[ KDChartEnums::PosCenterLeft ]
- = QPoint( ( datReg->points[ KDChartEnums::PosTopLeft ].x()
+ = TQPoint( ( datReg->points[ KDChartEnums::PosTopLeft ].x()
+ datReg->points[ KDChartEnums::PosBottomLeft ].x() ) / 2,
( datReg->points[ KDChartEnums::PosTopLeft ].y()
+ datReg->points[ KDChartEnums::PosBottomLeft ].y() ) / 2 );
datReg->points[ KDChartEnums::PosCenter ]
- = QPoint( ( datReg->points[ KDChartEnums::PosTopCenter ].x()
+ = TQPoint( ( datReg->points[ KDChartEnums::PosTopCenter ].x()
+ datReg->points[ KDChartEnums::PosBottomCenter ].x() ) / 2,
( datReg->points[ KDChartEnums::PosTopCenter ].y()
+ datReg->points[ KDChartEnums::PosBottomCenter ].y() ) / 2 );
datReg->points[ KDChartEnums::PosCenterRight ]
- = QPoint( ( datReg->points[ KDChartEnums::PosTopRight ].x()
+ = TQPoint( ( datReg->points[ KDChartEnums::PosTopRight ].x()
+ datReg->points[ KDChartEnums::PosBottomRight ].x() ) / 2,
( datReg->points[ KDChartEnums::PosTopRight ].y()
+ datReg->points[ KDChartEnums::PosBottomRight ].y() ) / 2 );
@@ -471,7 +471,7 @@ void KDChartPiePainter::drawOnePie( QPainter* painter,
/**
Internal method that draws the shadow creating the 3D effect of a pie
- \param painter the QPainter to draw in
+ \param painter the TQPainter to draw in
\param rect the position to draw at
\param dataset the dataset to draw the pie for
\param pie the pie to draw the shadow for
@@ -480,12 +480,12 @@ void KDChartPiePainter::drawOnePie( QPainter* painter,
\param regions a pointer to a list of regions that will be filled
with regions representing the data segments, if not null
*/
-void KDChartPiePainter::draw3DEffect( QPainter* painter,
- const QRect& drawPosition,
+void KDChartPiePainter::draw3DEffect( TQPainter* painter,
+ const TQRect& drawPosition,
uint dataset, uint pie, uint chart,
uint threeDHeight,
bool /*explode*/,
- QRegion* region )
+ TQRegion* region )
{
// NOTE: We cannot optimize away drawing some of the effects (even
// when not exploding), because some of the pies might be left out
@@ -495,7 +495,7 @@ void KDChartPiePainter::draw3DEffect( QPainter* painter,
// No need to save the brush, will be changed on return from this
// method anyway.
- painter->setBrush( QBrush( params()->dataShadow1Color( pie ),
+ painter->setBrush( TQBrush( params()->dataShadow1Color( pie ),
params()->shadowPattern() ) );
int startAngle = _startAngles[ ( int ) pie ];
@@ -671,23 +671,23 @@ void KDChartPiePainter::draw3DEffect( QPainter* painter,
/**
Internal method that draws a segment with a straight 3D effect
- \param painter the QPainter to draw in
+ \param painter the TQPainter to draw in
\param rect the position to draw at
\param threeDHeight the height of the shadow
\param angle the angle of the segment
\param regions a pointer to a list of regions that will be filled
with regions representing the data segments, if not null
*/
-void KDChartPiePainter::drawStraightEffectSegment( QPainter* painter,
- const QRect& rect,
+void KDChartPiePainter::drawStraightEffectSegment( TQPainter* painter,
+ const TQRect& rect,
uint /*dataset*/, uint /*pie*/, uint /*chart*/,
int threeDHeight,
int angle,
- QRegion* region )
+ TQRegion* region )
{
- QPoint center = rect.center();
- QPointArray points( 4 );
- QPoint circlePoint = pointOnCircle( rect, angle );
+ TQPoint center = rect.center();
+ TQPointArray points( 4 );
+ TQPoint circlePoint = pointOnCircle( rect, angle );
points.setPoint( 0, center );
points.setPoint( 1, circlePoint );
points.setPoint( 2, circlePoint.x(), circlePoint.y() + threeDHeight );
@@ -695,14 +695,14 @@ void KDChartPiePainter::drawStraightEffectSegment( QPainter* painter,
center.y() + threeDHeight );
painter->drawPolygon( points );
if ( region )
- *region += QRegion( points );
+ *region += TQRegion( points );
}
/**
Internal method that draws a segment with an arc 3D effect
- \param painter the QPainter to draw in
+ \param painter the TQPainter to draw in
\param rect the position to draw at
\param threeDHeight the height of the shadow
\param startAngle the starting angle of the segment
@@ -710,19 +710,19 @@ void KDChartPiePainter::drawStraightEffectSegment( QPainter* painter,
\param regions a pointer to a list of regions that will be filled
with regions representing the data segments, if not null
*/
-void KDChartPiePainter::drawArcEffectSegment( QPainter* painter,
- const QRect& rect,
+void KDChartPiePainter::drawArcEffectSegment( TQPainter* painter,
+ const TQRect& rect,
uint /*dataset*/, uint /*pie*/, uint /*chart*/,
int threeDHeight,
int startAngle,
int endAngle,
- QRegion* region )
+ TQRegion* region )
{
// Start with getting the points for the inner arc.
- const int startA = QMIN(startAngle, endAngle);
- const int endA = QMAX(startAngle, endAngle);
+ const int startA = TQMIN(startAngle, endAngle);
+ const int endA = TQMAX(startAngle, endAngle);
const int arcPoints = endA-startA+1;
- QPointArray collect(arcPoints * 2);
+ TQPointArray collect(arcPoints * 2);
for ( int angle=endA; angle>=startA; --angle){
collect.setPoint(endA-angle, pointOnCircle( rect, angle ));
}
@@ -730,13 +730,13 @@ void KDChartPiePainter::drawArcEffectSegment( QPainter* painter,
// Now copy these arcs again into the same array, but in the
// opposite direction and moved down by the 3D height.
for ( int i = arcPoints - 1; i >= 0; --i ) {
- QPoint pointOnFirstArc = collect.point( i );
+ TQPoint pointOnFirstArc = collect.point( i );
pointOnFirstArc.setY( pointOnFirstArc.y() + threeDHeight );
collect.setPoint( arcPoints * 2 - i - 1, pointOnFirstArc );
}
painter->drawPolygon( collect );
if ( region )
- *region += QRegion( collect );
+ *region += TQRegion( collect );
}
@@ -810,9 +810,9 @@ uint KDChartPiePainter::findRightPie( uint pie )
\return the fallback text to use for describing the specified
dataset in the legend
*/
-QString KDChartPiePainter::fallbackLegendText( uint dataset ) const
+TQString KDChartPiePainter::fallbackLegendText( uint dataset ) const
{
- return QObject::tr( "Item " ) + QString::number( dataset + 1 );
+ return TQObject::tr( "Item " ) + TQString::number( dataset + 1 );
}