Slot is normal class method. So in body call some another method with QByteArray argument to save data to file.
These are the basics of C++.
Slot is normal class method. So in body call some another method with QByteArray argument to save data to file.
These are the basics of C++.
QJak (16th April 2018)
thanks again. you mean i call saving function from body of slot? (i need to do two works (1-reading and processing 2-reading and writing in a file) together like tread.
please explain more
Yes. In slot You need :
1. Read data from port.
2. Process data.
3. Write data in a file.
Steps 2 and 3 can be swapped.
thanks but processing and writing after that is too slow. i need to do 2 jobs in the same time
is this work correct to emit a signal after reading like this:
i define a signal in name of : signal_saving(QByteArray) and connect this signal to the second slot below
then define 2 slots: slot1_readingAndProcessing() , slot2_saving(QByteArray)
after connecting signal_saving(QByteArray) to slot2_saving(QByteArray) i emit this signal after reading data in body of first slot. imean:
slot1_readingAndProcessing()
{
reading data and put in QByteArray
emit signal_saving(QBytArray)
then processing
}
is this correct?
Yes, this is correct under one condition : connection to slot2_saving is in Qt::QueuedConnection. In Qt:irectConnection emiting a signal is equivalent to calling the method. Read documentation.
QJak (16th April 2018)
this way has not my desier result (working paralel). please help me
Please explain why you insist this must be a parallel operation (you say so here and in your other posts). What is your "processing" that makes it so slow? And writing a small amount of data to a log file should be very fast, unless you are opening and closing the file for every write....thanks but processing and writing after that is too slow. i need to do 2 jobs in the same time...
...working paralel...
please help me
Based on what you are asking and how you are asking it, I am not sure you understand enough to write a multi-threaded application that will work correctly.
<=== The Great Pumpkin says ===>
Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.
Bookmarks