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.
Asked
Active
Viewed 3,711 times
0
-
http://doc.qt.nokia.com/latest/qfile.html – Brian Roach Nov 13 '11 at 19:54
2 Answers
3
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.

gspr
- 11,144
- 3
- 41
- 74
-
-
1why won't you try to think a little bit, try your own code and then if it doesn't do what you want come back and ask another question? Asking for "example (ready and working) code" isn't best way to learn anything. Qt has realy great documentation that explains a lot of things – Kamil Klimek Nov 14 '11 at 08:04
0
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.

Silas Parker
- 8,017
- 1
- 28
- 43