How to keep updating QTextEdit from log file
Unsolved
General and Desktop
-
I have a log file that keeps on growing. I want the QTextEdit to show the progress in log like tail -f command. I'm using pyqt
i've tried this
self.logpath = os.path.join(os.getcwd(), logfolder, fec_log.txt)
fs_watcher= QFileSystemWatcher()
fs_watcher.addPath(self.logpath)
fs_watcher.fileChanged.connect(self.logWatcher)def logWatcher(self):
file = open(logpath)
self. textedit.append(file.readline())i know this has a problem that it wouldn;t actually seem like streaming the logfile but it keeps reloading the file. But even that doesnt happen. logWatcher slot doesn get called, What could be the problem
-
Hi and welcome to devnet,
IIRC, QSocketNotifier is a better choice for such activities
-
Using
QFile::handle