You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 12, 2023. It is now read-only.
I guess you could do this but I would suggest allocating QWidgets on the main thread instead. It seems inefficient and odd that you're creating and using 50000 plots. Also accessing ui isn't thread safe and you'll likely have undefined behaviour.
QObjects have thread affinity. For you code to work you need to push the newly created QWidgets to the main thread QObject::moveToThread(QCoreApplication::instance()->thread()). Then you need to call anotherwdtlay->addWidget(plot) in the main thread.
I guess you could do this but I would suggest allocating QWidgets on the main thread instead. It seems inefficient and odd that you're creating and using 50000 plots. Also accessing ui isn't thread safe and you'll likely have undefined behaviour.
QObjects have thread affinity. For you code to work you need to push the newly created QWidgets to the main thread QObject::moveToThread(QCoreApplication::instance()->thread()). Then you need to call anotherwdtlay->addWidget(plot) in the main thread.
I have payed two week to understand your answer. you are very right, I am now try to do as you said!
thank you very much!
I have a test , but got some errors.
TaskCenter.h TaskCenter.cpp
SnapshotWidget.h SnapshotWidget.cpp
the error messages are in dynamic_update_snapshot:
QObject::setParent: Cannot set parent, new parent is in a different thread
and the child widgets din't change.
please help me how to modify the codes?
thanks!
The text was updated successfully, but these errors were encountered: