Good afternoon. Such problem: the function opens the file, creates a thread, reads from it a string and returns. Data are recorded in a TreeWidget. And so to the end. Then the file is closed.
Created a button in the app, which first clears TreeWidget (tested, all works correctly), and the second calls the function above.
When the application is started, all normal reads and writes in the TreeWidget. Then I open the file in which the data lie, change a couple of lines, save and close. Press the button and nothing happens. When you launch the app again, all changes become visible. Please help. Here is the code:
Function:
if(!m_stream.atEnd())
{
m_stream.setCodec("utf-8");
QString line = m_stream.readLine();
return line;
}
return "";
m_stream is created in another function, there is bound to the file.
As I said above, after the completion of this function, the file I close.
Then I change the contents of the file, save and close. When you press the button, the file is opened again, a thread is created new, but somehow it reads the old data... - neoma.Bauch80 commented on April 19th 20 at 12:37
Here is the full code:
File .h:
- neoma.Bauch80 commented on April 19th 20 at 12:43