Thanks for all replies,
bool MyObject::sum()
{
qdouble s=0.0;
for(int j=0;j<=tblwValues->rowCount()-1;++j) {
dtValor = tblwValues->item(j,1);
if(!dtValor)
continue;
s += dtValor->data(0).toDouble();
}
if(s < leValor->text().toDouble()) {
qDebug
() <<
"less" <<
QString::number(s,
'f',
6) <<
QString::number(leValor
->text
().
toDouble(),
'f',
6);
return(FALSE);
}
if(s > leValor->text().toDouble()) {
qDebug
() <<
"bigger" <<
QString::number(s,
'f',
6) <<
QString::number(leValor
->text
().
toDouble(),
'f',
6);
return(FALSE);
}
return(TRUE);
}
bool MyObject::sum()
{
qdouble s=0.0;
for(int j=0;j<=tblwValues->rowCount()-1;++j) {
QTableWidgetItem *dtValor = new QTableWidgetItem;
dtValor = tblwValues->item(j,1);
if(!dtValor)
continue;
s += dtValor->data(0).toDouble();
}
if(s < leValor->text().toDouble()) {
qDebug() << "less" << QString::number(s,'f',6) << QString::number(leValor->text().toDouble(),'f',6);
return(FALSE);
}
if(s > leValor->text().toDouble()) {
qDebug() << "bigger" << QString::number(s,'f',6) << QString::number(leValor->text().toDouble(),'f',6);
return(FALSE);
}
return(TRUE);
}
To copy to clipboard, switch view to plain text mode
example:
item 0: 12545.28
item 1: 12545.28
item 2: 12545.28
Sum: 37635.84 // leValor->text().toDouble()
Always returns FALSE: qDebug() << "bigger" << QString::number(s,'f',6) << QString::number(leValor->text().toDouble(),'f',6);
I really don't I know I'm doing something of wrong
Bookmarks