Reputation: 59
I have a QPlainTextEdit in my Form and I want to read the whole Resource.txt document which is placed in Other Files of my project and after a timer ticks i want the application save the contents of the QPlainTextEdit in the document. I know it's a dumb question but I can't find a solution.
Upvotes: 0
Views: 3731
Reputation: 8147
The tutorial Getting Started Programming with Qt takes you through building a text editor, once you have followed this, try adding a QTimer
to trigger a save.
Upvotes: 0
Reputation: 11227
QTextStream.readAll() lets you read a file to a QString
. This constructor (or the method setPlainText
) for QPlainTextEdit
lets you set a string displayed in the editor. Use a QTimer to trigger a slot which reads the contents of the QPlainTextEdit
into a QString
with the toPlainText method after a desired amount of time. Write the result to file using a QTextStream
again.
Upvotes: 3