summaryrefslogtreecommitdiffstats
path: root/kchart/kdchart/KDChartTableBase.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
commitf008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch)
tree8e9244c4d4957c36be81e15b566b4aa5ea26c982 /kchart/kdchart/KDChartTableBase.cpp
parent1210f27b660efb7b37ff43ec68763e85a403471f (diff)
downloadkoffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz
koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kchart/kdchart/KDChartTableBase.cpp')
-rw-r--r--kchart/kdchart/KDChartTableBase.cpp178
1 files changed, 89 insertions, 89 deletions
diff --git a/kchart/kdchart/KDChartTableBase.cpp b/kchart/kdchart/KDChartTableBase.cpp
index d25e13fc..da0d1d92 100644
--- a/kchart/kdchart/KDChartTableBase.cpp
+++ b/kchart/kdchart/KDChartTableBase.cpp
@@ -28,7 +28,7 @@
**********************************************************************/
#include <math.h>
#include <limits.h>
-#include <qtable.h>
+#include <tqtable.h>
#include <KDChartTableBase.h>
@@ -40,7 +40,7 @@
\note To create your data table you would <em>not</em> use a
\c KDChartTableDataBase but instantiate the class \c KDChartTableData.
The \c KDChartTableData class is an auxiliary class: depending on your
- Qt version it will be mapped onto a \c KDChartVectorTableData or onto
+ TQt version it will be mapped onto a \c KDChartVectorTableData or onto
a \c KDChartListTableData both of which are derived from
\c KDChartTableDataBase and implement all of its functions.
Thus you would create a table of 3 datasets with 25 cells each like this:
@@ -56,7 +56,7 @@
You may adjust or modify your table like this:
\li Entering the data can be done either manually using \c setCell()
- or by passing a QTable to the \c importFromQTable() function.
+ or by passing a TQTable to the \c importFromTQTable() function.
\li Performance of KD Chart can be increased by specifying the number
of rows and or the number of columns actually used: \c setUsedRows()
@@ -74,7 +74,7 @@
future absicssa axis value:
\verbatim
- const QDateTime currentTime( QDateTime::currentDateTime() );
+ const TQDateTime currentTime( TQDateTime::tqcurrentDateTime() );
for( int iCell = 0; iCell < usedValues; ++iCell ){
KDChartData& cell = myData.cell( 0, iCell );
// assign special property set ID if X value is in the future
@@ -107,7 +107,7 @@ uint KDChartTableDataBase::usedCols() const {
bool KDChartTableDataBase::cellsHaveSeveralCoordinates(
- QVariant::Type* type2Ref ) const
+ TQVariant::Type* type2Ref ) const
{
return cellsHaveSeveralCoordinates( 0, UINT_MAX, type2Ref );
}
@@ -116,7 +116,7 @@ bool KDChartTableDataBase::cellsHaveSeveralCoordinates(
bool KDChartTableDataBase::cellsHaveSeveralCoordinates(
uint row1,
uint row2,
- QVariant::Type* type2Ref ) const
+ TQVariant::Type* type2Ref ) const
{
// return true if all wanted datasets have at least two coordinates
// stored in all of their cells - BUT only if these coordinates are
@@ -126,17 +126,17 @@ bool KDChartTableDataBase::cellsHaveSeveralCoordinates(
bool severalCoordinates = row1 < usedRows();
if( severalCoordinates ) {
severalCoordinates = false;
- QVariant::Type testType = QVariant::Invalid;
+ TQVariant::Type testType = TQVariant::Invalid;
const uint r2 = (UINT_MAX == row2)
? usedRows()
- : QMIN( row2+1, usedRows() );
- QVariant value1;
- QVariant value2;
+ : TQMIN( row2+1, usedRows() );
+ TQVariant value1;
+ TQVariant value2;
for ( uint row = row1; row < r2; ++row ){
for ( uint col = 0; col < usedCols(); ++col ){
if( cellCoords( row, col, value1, value2 ) ){
- if( QVariant::Invalid != value2.type() ){
- if( (QVariant::Invalid != testType) &&
+ if( TQVariant::Invalid != value2.type() ){
+ if( (TQVariant::Invalid != testType) &&
(value2.type() != testType) ){
severalCoordinates = false;
break;
@@ -146,7 +146,7 @@ bool KDChartTableDataBase::cellsHaveSeveralCoordinates(
*type2Ref = testType;
severalCoordinates = true;
}
- }else if( QVariant::Invalid != value1.type() ){
+ }else if( TQVariant::Invalid != value1.type() ){
severalCoordinates = false;
break;
}
@@ -158,27 +158,27 @@ bool KDChartTableDataBase::cellsHaveSeveralCoordinates(
}
-QVariant::Type KDChartTableDataBase::cellsValueType(
+TQVariant::Type KDChartTableDataBase::cellsValueType(
uint row1,
uint row2,
int coordinate ) const
{
- QVariant::Type res = QVariant::Invalid;
+ TQVariant::Type res = TQVariant::Invalid;
const uint r2 = (UINT_MAX == row2)
? usedRows()
- : QMIN( row2+1, usedRows() );
+ : TQMIN( row2+1, usedRows() );
- QVariant value;
+ TQVariant value;
for ( uint row = row1; row < r2; ++row )
for ( uint col = 0; col < usedCols(); ++col )
if( cellCoord( row, col, value, coordinate ) )
- if( QVariant::Invalid != value.type() )
+ if( TQVariant::Invalid != value.type() )
res = value.type();
return res;
}
-QVariant::Type KDChartTableDataBase::cellsValueType(
+TQVariant::Type KDChartTableDataBase::cellsValueType(
int coordinate ) const
{
return cellsValueType( 0, UINT_MAX, coordinate );
@@ -189,19 +189,19 @@ double KDChartTableDataBase::maxValue( int coordinate ) const
{
double maxValue = 0.0;
bool bStart = true;
- QVariant value;
+ TQVariant value;
double dVal;
for ( uint row = 0; row < usedRows(); row++ ) {
for ( uint col = 0; col < usedCols(); col++ ) {
if( cellCoord( row, col, value, coordinate ) &&
- QVariant::Double == value.type() ) {
+ TQVariant::Double == value.type() ) {
dVal = value.toDouble();
if( isNormalDouble( dVal ) ){
if ( bStart ) {
maxValue = dVal;
bStart = false;
} else
- maxValue = QMAX( maxValue, dVal );
+ maxValue = TQMAX( maxValue, dVal );
}
}
}
@@ -215,19 +215,19 @@ double KDChartTableDataBase::minValue( int coordinate, bool bOnlyGTZero ) const
{
double minValue = 0.0;
bool bStart = true;
- QVariant value;
+ TQVariant value;
double dVal;
for ( uint row = 0; row < usedRows(); row++ ) {
for ( uint col = 0; col < usedCols(); col++ ) {
if( cellCoord( row, col, value, coordinate ) &&
- QVariant::Double == value.type() ) {
+ TQVariant::Double == value.type() ) {
dVal = value.toDouble();
if( !bOnlyGTZero || 0.0 < dVal ){
if ( bStart ) {
minValue = dVal;
bStart = false;
}else{
- minValue = QMIN( minValue, dVal );
+ minValue = TQMIN( minValue, dVal );
}
}
}
@@ -237,22 +237,22 @@ double KDChartTableDataBase::minValue( int coordinate, bool bOnlyGTZero ) const
}
-QDateTime KDChartTableDataBase::maxDtValue( int coordinate ) const
+TQDateTime KDChartTableDataBase::maxDtValue( int coordinate ) const
{
- QDateTime maxValue = QDateTime( QDate(1970,1,1) );
+ TQDateTime maxValue = TQDateTime( TQDate(1970,1,1) );
bool bStart = true;
- QVariant value;
- QDateTime dtVal;
+ TQVariant value;
+ TQDateTime dtVal;
for ( uint row = 0; row < usedRows(); row++ ) {
for ( uint col = 0; col < usedCols(); col++ ) {
if( cellCoord( row, col, value, coordinate ) &&
- QVariant::DateTime == value.type() ) {
+ TQVariant::DateTime == value.type() ) {
dtVal = value.toDateTime();
if ( bStart ) {
maxValue = dtVal;
bStart = false;
} else
- maxValue = QMAX(maxValue, dtVal);
+ maxValue = TQMAX(maxValue, dtVal);
}
}
}
@@ -261,22 +261,22 @@ QDateTime KDChartTableDataBase::maxDtValue( int coordinate ) const
-QDateTime KDChartTableDataBase::minDtValue( int coordinate ) const
+TQDateTime KDChartTableDataBase::minDtValue( int coordinate ) const
{
- QDateTime minValue = QDateTime( QDate(1970,1,1) );
+ TQDateTime minValue = TQDateTime( TQDate(1970,1,1) );
bool bStart = true;
- QVariant value;
- QDateTime dtVal;
+ TQVariant value;
+ TQDateTime dtVal;
for ( uint row = 0; row < usedRows(); row++ ) {
for ( uint col = 0; col < usedCols(); col++ ) {
if( cellCoord( row, col, value, coordinate ) &&
- QVariant::DateTime == value.type() ) {
+ TQVariant::DateTime == value.type() ) {
dtVal = value.toDateTime();
if ( bStart ) {
minValue = dtVal;
bStart = false;
} else
- minValue = QMIN(minValue, dtVal);
+ minValue = TQMIN(minValue, dtVal);
}
}
}
@@ -294,7 +294,7 @@ double KDChartTableDataBase::maxColSum( int coordinate ) const
maxValue = colValue;
bStart = false;
} else
- maxValue = QMAX( maxValue, colValue );
+ maxValue = TQMAX( maxValue, colValue );
}
return maxValue;
}
@@ -310,7 +310,7 @@ double KDChartTableDataBase::minColSum( int coordinate ) const
minValue = colValue;
bStart = false;
} else
- minValue = QMIN( minValue, colValue );
+ minValue = TQMIN( minValue, colValue );
}
return minValue;
@@ -330,11 +330,11 @@ double KDChartTableDataBase::maxColSum( uint row, uint row2, int coordinate ) co
z = usedRows() - 1;
for ( uint col = 0; col < usedCols(); col++ ) {
double valueValue = 0.0;
- QVariant value;
+ TQVariant value;
double dVal;
for ( uint row = a; row <= z; row++ ) {
if( cellCoord( row, col, value, coordinate ) &&
- QVariant::Double == value.type() ) {
+ TQVariant::Double == value.type() ) {
dVal = value.toDouble();
if( isNormalDouble( dVal ) )
valueValue += dVal;
@@ -344,7 +344,7 @@ double KDChartTableDataBase::maxColSum( uint row, uint row2, int coordinate ) co
maxValue = valueValue;
bStart = false;
} else
- maxValue = QMAX( maxValue, valueValue );
+ maxValue = TQMAX( maxValue, valueValue );
}
}
return maxValue;
@@ -364,11 +364,11 @@ double KDChartTableDataBase::minColSum( uint row, uint row2, int coordinate ) co
z = usedRows() - 1;
for ( uint col = 0; col < usedCols(); col++ ) {
double valueValue = 0.0;
- QVariant value;
+ TQVariant value;
double dVal;
for ( uint row = a; row <= z; row++ ) {
if( cellCoord( row, col, value, coordinate ) &&
- QVariant::Double == value.type() ) {
+ TQVariant::Double == value.type() ) {
dVal = value.toDouble();
if( isNormalDouble( dVal ) )
valueValue += dVal;
@@ -378,7 +378,7 @@ double KDChartTableDataBase::minColSum( uint row, uint row2, int coordinate ) co
minValue = valueValue;
bStart = false;
} else
- minValue = QMIN( minValue, valueValue );
+ minValue = TQMIN( minValue, valueValue );
}
}
return minValue;
@@ -388,11 +388,11 @@ double KDChartTableDataBase::minColSum( uint row, uint row2, int coordinate ) co
double KDChartTableDataBase::colSum( uint col, int coordinate ) const
{
double sum = 0.0;
- QVariant value;
+ TQVariant value;
double dVal;
for ( uint row = 0; row < usedRows(); row++ ) {
if( cellCoord( row, col, value, coordinate ) &&
- QVariant::Double == value.type() ) {
+ TQVariant::Double == value.type() ) {
dVal = value.toDouble();
if( isNormalDouble( dVal ) )
sum += dVal;
@@ -406,11 +406,11 @@ double KDChartTableDataBase::colSum( uint col, int coordinate ) const
double KDChartTableDataBase::colAbsSum( uint col, int coordinate ) const
{
double sum = 0.0;
- QVariant value;
+ TQVariant value;
double dVal;
for ( uint row = 0; row < usedRows(); row++ ) {
if( cellCoord( row, col, value, coordinate ) &&
- QVariant::Double == value.type() ) {
+ TQVariant::Double == value.type() ) {
dVal = value.toDouble();
if( isNormalDouble( dVal ) )
sum += fabs( dVal );
@@ -431,7 +431,7 @@ double KDChartTableDataBase::maxRowSum( int coordinate ) const
maxValue = rowValue;
bStart = false;
} else
- maxValue = QMAX( maxValue, rowValue );
+ maxValue = TQMAX( maxValue, rowValue );
}
return maxValue;
}
@@ -447,7 +447,7 @@ double KDChartTableDataBase::minRowSum( int coordinate ) const
minValue = rowValue;
bStart = false;
} else
- minValue = QMIN( minValue, rowValue );
+ minValue = TQMIN( minValue, rowValue );
}
return minValue;
@@ -457,11 +457,11 @@ double KDChartTableDataBase::minRowSum( int coordinate ) const
double KDChartTableDataBase::rowSum( uint row, int coordinate ) const
{
double sum = 0.0;
- QVariant value;
+ TQVariant value;
double dVal;
for ( uint col = 0; col < usedCols(); col++ ) {
if( cellCoord( row, col, value, coordinate ) &&
- QVariant::Double == value.type() ) {
+ TQVariant::Double == value.type() ) {
dVal = value.toDouble();
if( isNormalDouble( dVal ) )
sum += dVal;
@@ -474,11 +474,11 @@ double KDChartTableDataBase::rowSum( uint row, int coordinate ) const
double KDChartTableDataBase::rowAbsSum( uint row, int coordinate ) const
{
double sum = 0.0;
- QVariant value;
+ TQVariant value;
double dVal;
for ( uint col = 0; col < usedCols(); col++ ) {
if( cellCoord( row, col, value, coordinate ) &&
- QVariant::Double == value.type() ) {
+ TQVariant::Double == value.type() ) {
dVal = value.toDouble();
if( isNormalDouble( dVal ) )
sum += fabs( dVal );
@@ -492,18 +492,18 @@ double KDChartTableDataBase::maxInColumn( uint col, int coordinate ) const
{
double maxValue = 0.0;
bool bStart = true;
- QVariant value;
+ TQVariant value;
double dVal;
for ( uint row = 0; row < usedRows(); row++ ) {
if( cellCoord( row, col, value, coordinate ) &&
- QVariant::Double == value.type() ) {
+ TQVariant::Double == value.type() ) {
dVal = value.toDouble();
if( isNormalDouble( dVal ) ){
if ( bStart ) {
maxValue = dVal;
bStart = false;
} else
- maxValue = QMAX( maxValue, dVal );
+ maxValue = TQMAX( maxValue, dVal );
}
}
}
@@ -516,18 +516,18 @@ double KDChartTableDataBase::minInColumn( uint col, int coordinate ) const
{
double minValue = 0.0;
bool bStart = true;
- QVariant value;
+ TQVariant value;
double dVal;
for ( uint row = 0; row < usedRows(); row++ ) {
if( cellCoord( row, col, value, coordinate ) &&
- QVariant::Double == value.type() ) {
+ TQVariant::Double == value.type() ) {
dVal = value.toDouble();
if( isNormalDouble( dVal ) ){
if ( bStart ) {
minValue = dVal;
bStart = false;
} else
- minValue = QMIN( minValue, dVal );
+ minValue = TQMIN( minValue, dVal );
}
}
}
@@ -540,19 +540,19 @@ double KDChartTableDataBase::maxInRow( uint row, int coordinate ) const
{
double maxValue = DBL_MIN;
bool bStart = true;
- QVariant value;
+ TQVariant value;
double dVal;
if ( UINT_MAX > row ) {
for ( uint col = 0; col < usedCols(); col++ ) {
if( cellCoord( row, col, value, coordinate ) &&
- QVariant::Double == value.type() ) {
+ TQVariant::Double == value.type() ) {
dVal = value.toDouble();
if( isNormalDouble( dVal ) ){
if ( bStart ) {
maxValue = dVal;
bStart = false;
} else
- maxValue = QMAX( maxValue, dVal );
+ maxValue = TQMAX( maxValue, dVal );
}
}
}
@@ -565,19 +565,19 @@ double KDChartTableDataBase::minInRow( uint row, int coordinate ) const
{
double minValue = DBL_MAX;
bool bStart = true;
- QVariant value;
+ TQVariant value;
double dVal;
if ( UINT_MAX > row ) {
for ( uint col = 0; col < usedCols(); col++ ) {
if( cellCoord( row, col, value, coordinate ) &&
- QVariant::Double == value.type() ) {
+ TQVariant::Double == value.type() ) {
dVal = value.toDouble();
if( isNormalDouble( dVal ) ){
if ( bStart ) {
minValue = dVal;
bStart = false;
} else
- minValue = QMIN( minValue, dVal );
+ minValue = TQMIN( minValue, dVal );
}
}
}
@@ -600,18 +600,18 @@ double KDChartTableDataBase::maxInRows( uint row, uint row2, int coordinate ) co
z = usedRows() - 1;
// qDebug("KDChartTableDataBase::maxInRows() (2) a: %u z: %u", a, z);
for ( uint row = a; row <= z; ++row ) {
- QVariant value;
+ TQVariant value;
double dVal;
for ( uint col = 0; col < usedCols(); ++col ) {
if( cellCoord( row, col, value, coordinate ) &&
- QVariant::Double == value.type() ) {
+ TQVariant::Double == value.type() ) {
dVal = value.toDouble();
if( isNormalDouble( dVal ) ){
if ( bStart ) {
maxValue = dVal;
bStart = false;
} else
- maxValue = QMAX( maxValue, dVal );
+ maxValue = TQMAX( maxValue, dVal );
}
}
}
@@ -635,11 +635,11 @@ double KDChartTableDataBase::minInRows( uint row, uint row2, int coordinate, boo
z = usedRows() - 1;
//qDebug("KDChartTableDataBase::minInRows() (2) a: %u z: %u", a, z);
for ( uint row = a; row <= z; ++row ) {
- QVariant value;
+ TQVariant value;
double dVal;
for ( uint col = 0; col < usedCols(); ++col ) {
if( cellCoord( row, col, value, coordinate ) &&
- QVariant::Double == value.type() ) {
+ TQVariant::Double == value.type() ) {
dVal = value.toDouble();
if( isNormalDouble( dVal ) ){
if( !bOnlyGTZero || 0.0 < dVal ){
@@ -647,7 +647,7 @@ double KDChartTableDataBase::minInRows( uint row, uint row2, int coordinate, boo
minValue = dVal;
bStart = false;
}else{
- minValue = QMIN( minValue, dVal );
+ minValue = TQMIN( minValue, dVal );
}
}
}
@@ -659,10 +659,10 @@ double KDChartTableDataBase::minInRows( uint row, uint row2, int coordinate, boo
}
-QDateTime KDChartTableDataBase::maxDtInRows( uint row, uint row2,
+TQDateTime KDChartTableDataBase::maxDtInRows( uint row, uint row2,
int coordinate ) const
{
- QDateTime maxValue = QDateTime( QDate(1970,1,1) );
+ TQDateTime maxValue = TQDateTime( TQDate(1970,1,1) );
bool bStart = true;
if ( 0 < usedRows() ) {
uint a = row;
@@ -672,17 +672,17 @@ QDateTime KDChartTableDataBase::maxDtInRows( uint row, uint row2,
if ( usedRows() <= z )
z = usedRows() - 1;
for ( uint row = a; row <= z; ++row ) {
- QVariant value;
- QDateTime dtVal;
+ TQVariant value;
+ TQDateTime dtVal;
for ( uint col = 0; col < usedCols(); ++col ) {
if( cellCoord( row, col, value, coordinate ) &&
- QVariant::DateTime == value.type() ) {
+ TQVariant::DateTime == value.type() ) {
dtVal = value.toDateTime();
if ( bStart ) {
maxValue = dtVal;
bStart = false;
} else
- maxValue = QMAX( maxValue, dtVal );
+ maxValue = TQMAX( maxValue, dtVal );
}
}
}
@@ -691,10 +691,10 @@ QDateTime KDChartTableDataBase::maxDtInRows( uint row, uint row2,
}
-QDateTime KDChartTableDataBase::minDtInRows( uint row, uint row2,
+TQDateTime KDChartTableDataBase::minDtInRows( uint row, uint row2,
int coordinate ) const
{
- QDateTime minValue = QDateTime( QDate(1970,1,1) );
+ TQDateTime minValue = TQDateTime( TQDate(1970,1,1) );
bool bStart = true;
if ( 0 < usedRows() ) {
uint a = row;
@@ -704,17 +704,17 @@ QDateTime KDChartTableDataBase::minDtInRows( uint row, uint row2,
if ( usedRows() <= z )
z = usedRows() - 1;
for ( uint row = a; row <= z; ++row ) {
- QVariant value;
- QDateTime dtVal;
+ TQVariant value;
+ TQDateTime dtVal;
for ( uint col = 0; col < usedCols(); ++col ) {
if( cellCoord( row, col, value, coordinate ) &&
- QVariant::DateTime == value.type() ) {
+ TQVariant::DateTime == value.type() ) {
dtVal = value.toDateTime();
if ( bStart ) {
minValue = dtVal;
bStart = false;
} else
- minValue = QMIN( minValue, dtVal );
+ minValue = TQMIN( minValue, dtVal );
}
}
}
@@ -726,11 +726,11 @@ QDateTime KDChartTableDataBase::minDtInRows( uint row, uint row2,
uint KDChartTableDataBase::lastPositiveCellInColumn( uint col, int coordinate ) const
{
uint ret = UINT_MAX;
- QVariant value;
+ TQVariant value;
double dVal;
for ( uint row = 0; row < usedRows(); row++ ) {
if( cellCoord( row, col, value, coordinate ) &&
- QVariant::Double == value.type() ) {
+ TQVariant::Double == value.type() ) {
dVal = value.toDouble();
if( isNormalDouble( dVal ) && 0 < dVal )
ret = row;
@@ -740,7 +740,7 @@ uint KDChartTableDataBase::lastPositiveCellInColumn( uint col, int coordinate )
}
-void KDChartTableDataBase::importFromQTable( QTable* table )
+void KDChartTableDataBase::importFromTQTable( TQTable* table )
{
if( table->numRows() > (int)rows() ||
table->numCols() > (int)cols() )
@@ -749,7 +749,7 @@ void KDChartTableDataBase::importFromQTable( QTable* table )
setUsedCols( table->numCols() );
for( int row = 0; row < table->numRows(); row++ )
for( int col = 0; col < table->numCols(); col++ ) {
- QString cellContents = table->text( row, col );
+ TQString cellContents = table->text( row, col );
if( !cellContents.isEmpty() ) {
// First try to parse a double
bool ok = false;