Class
class Logger: public QObject{ Q_OBJECT public slots: void write(QString txt); //записываем в файл void process(); public: Logger(); private: void createFile(); QFile LogFile; }; I create a stream of this class:
QThread* thread = new QThread; Logger* log = new Logger(); log->moveToThread(thread); connect(thread, SIGNAL(started()), log , SLOT(process())); connect(this, SIGNAL(write(QString)), log , SLOT(write(QString))); thread->start(); Help with creating a stream that will receive a large number of signals, place them in a queue and process them. If the queue is empty, then the stream should fall asleep for, say, 1 second. And how to call SIGNAL WRITE from any class of the program?
UPD: I figured out the queue. If you call the write signal EventLoop , they will be in the EventLoop queue, since The slot is in another thread.