how to capture log data in QTextEdit

Stefan Seefeld stefan at seefeld.name
Sun Feb 21 16:41:58 GMT 2021


Hello,

I'm trying to capture ("redirect") log data generated by a wrapped C++ 
library to a QTextEdit. The internet is full of related questions, but I 
couldn't quite find a working example that matches my needs. I can 
configure my logger to either write to the console (stdout) or to a 
file, so what I'm looking for is a mechanism to attach a "listener" to 
the given file descriptor and let it emit a `readyRead` signal whenever 
data are available. For a reason I don't entirely understand, the 
`QFile` class does *not* emit that signal, and thus is unfortunately 
unsuitable for this.

So, does PyQt5 offer any classes that are equipped to listen to data 
being written to a file descriptor such that I could read them 
asynchronously ? The only examples I could find involve (tcp or udp) 
sockets or serial ports, but not simple files...

Many thanks,

Stefan
-- 

       ...ich hab' noch einen Koffer in Berlin...

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210221/57ae3b2c/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .signature.png
Type: image/png
Size: 2754 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210221/57ae3b2c/attachment-0001.png>


More information about the PyQt mailing list