Hi everyone,
Real n00b question here... I'm developing a simple calculator (just for addition). Have 2 QLineEdits for entering two numbers, a QPushButton to initiate the addition and a third QLineEdit to display the answer.
Now everything is going grand, all the connects are good etc but I can't set the answer to display in the third QLineEdit.
Here's the pseudo code
Now this tells me "error C2664: 'QLineEdit::setText' : cannot convert parameter 1 from 'QString *' to 'const QString &'" so I change the line to// firstNum and secondNum are the two input QLineEdits
void addition::add()
{
int num1, num2, r;
num1 = firstNum->text().toInt();
num2 = secondNum->text().toInt();
r = num1 + num2;
result = new QString(r);
answer->setText(result);
}
answer->setText(*result)
which compiles but nothing will display in the answer section. I'm at wits end here, seems like I've tried everything! I've gotten other text in there (just debugging) but how do I get the result?
Cheers, any help appreciated.
Bookmarks