estanisgeyer
25th January 2008, 13:06
Good day,
I have a function that formats the decimal places. I created a slot that makes this format, but the problem is that we have to create a slot for each QLineEdit, how do I get around that? Below part of the code:
connect(ui.lineEdit_ProductValue, SIGNAL(lostFocus()), this, SLOT(formatValueProduct()))
connect(ui.lineEdit_PValue, SIGNAL(lostFocus()), this, SLOT(formatValueP()));
void Product::formatValueProduct()
{
ui.lineEdit_ProductValue->setText(customFormat(ui.lineEdit_ProductValue->text(), CURRENCY));
}
void Product::formatValueP()
{
ui.lineEdit_PValue->setText(customFormat(ui.lineEdit_PValue->text(), 3));
}
Thanks,
Marcelo E. Geyer
I have a function that formats the decimal places. I created a slot that makes this format, but the problem is that we have to create a slot for each QLineEdit, how do I get around that? Below part of the code:
connect(ui.lineEdit_ProductValue, SIGNAL(lostFocus()), this, SLOT(formatValueProduct()))
connect(ui.lineEdit_PValue, SIGNAL(lostFocus()), this, SLOT(formatValueP()));
void Product::formatValueProduct()
{
ui.lineEdit_ProductValue->setText(customFormat(ui.lineEdit_ProductValue->text(), CURRENCY));
}
void Product::formatValueP()
{
ui.lineEdit_PValue->setText(customFormat(ui.lineEdit_PValue->text(), 3));
}
Thanks,
Marcelo E. Geyer