I’m having an issue. My textEditBox doesn’t seem to be updating when my Addtext function is called.
Here’s my Addtext:
void CTextBox::AddText(QString string, QString spriteString)
{
textBrowser->setText(string + spriteString);
update();
}
Another class then calls the function and it should add text to the textbox but it doesn’t.
How do you call CTextBox::AddText()?
update()only schedules apaintEvent()for later, when the program returns to the event loop. That means thatyou actually need to have an event loop, ie. at some point you need to call
qApp->exec();you need to allow the programm some time to
qApp->processEvents()(insert that afterupdate()), if you want any paining done within a blockingwhile() {...}or something like that.Edit: Come to think of it, you shouldn’t even need to call
update()norprocessEvents()if your program returns to the event loop some time afterAddText, so there really seems to be an issue with the event loop. Post your main.cpp, will you?