Instead of overloading the update function you should create a simple slot and connect it to the change signal of your QLineEdit's. (or as you currently do with your ok button). Then all should work? Or what exactly do you want? To be "updated" whenever a value has changes just connect the textChanged signal for the QLineEdit's to your "update"-slot.
//connect(okButton, SIGNAL(clicked()), this, SLOT(recalculate()));
connect(knownTemperatureLineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(recalculate()));
connect(knowDensityLineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(recalculate()));
//...
void Dencaler::recalculate()
{
double sum=knownTemperatureLineEdit->text().toDouble() + knowDensityLineEdit->text().toDouble();
label20
->setText
(QString::number(sum
));
sum+=0.3;
label15
->setText
(QString::number(sum
));
}
//connect(okButton, SIGNAL(clicked()), this, SLOT(recalculate()));
connect(knownTemperatureLineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(recalculate()));
connect(knowDensityLineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(recalculate()));
//...
void Dencaler::recalculate()
{
double sum=knownTemperatureLineEdit->text().toDouble() + knowDensityLineEdit->text().toDouble();
label20->setText(QString::number(sum));
sum+=0.3;
label15->setText(QString::number(sum));
}
To copy to clipboard, switch view to plain text mode
Bookmarks