Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QPlainTextEdit autosave to database
squinky86 last edited by squinky86
I have a QPlainTextEdit that retrieves from and sends its modifications to a database. I've connected the textChanged() signal to the database updating routine. Everything works, but efficiency is terrible. The saving routine has to do a read from and a write to the database, so every character entered causes 2 additional queries.
Is there a way to update the database only after the last textChanged() signal is emitted? Or is there a better way to think out this problem?
Hi and welcome to devnet,
One possible way to do that is to use a QTimer that you reset at each
textChangedand that will only trigger the synchronisation when it times out.
squinky86 last edited by
@SGaist That did it! Thanks for introducing me to QTimer!