The situation is as follows:
- There is MainWindow.cpp and test.cpp
- In MainWindow, there is a signal-slot
connect(test, SIGNAL(SendLog(QString, QString)), this, SLOT(setLogs(QString, QString)));
In test.cpp there is a work class that sends a request to the POST and performs a result based on it:
emit SendLog("1", "222");
MainWindow is a QTextBrowser into which setLogs inserts data.
Further in MainWindow, I do the following:
test *testDo = new test (); setLogs ("0", "111"); testDo->work (); setLogs ("0", "333");
Everything works fine, the POST is executed, but in QTextBrowser it is displayed
111 333 222
Although the logic should go in order.
Tell me, what could be the snag and how to correctly implement message logging
testDo->work()
,emit SendLog("1", "222");
is called in a separate threademit SendLog("1", "222");
? - Vladimir GamalyanПОСТ запрос
" can be in more detail what it is. If it is executed asynchronously, then the output of the log is quite logical. - Vladimir Gamalyan