Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
how to update QTableWidget in non-mainThread?
how to update QTableWidget in non-mainThread(ie. a callback function in the other thread).
QTableWidget need to update(many items should setText) use the data got in that callback fun in the other thread.
You should really read https://doc.qt.io/qt-5/signalsandslots.html
This is essential for a Qt programmer and will help you to synchronize threads.
Apropos threads: That is advanced stuff and will require a deep understanding. I recommend starting with something simpler.
thanks, i know it.
so i just set the 5th param of connect by default value? and the sender & reciever are in different threads?
@opengpu For signals/slots across different threads use Qt::QueedConnection as connection type. Usually Qt will recognise that sender and receiver are in different threads and use the queued connection, but to be on the safe side you can specify the connection type explicitly.
One very important rule: NEVER change UI related stuff from other thread than main thread!
So, emit a signal from the other thread and update your UI in the main thread (in the slot).
ok, got it. thanks!