Is it possible to set priority to the main GUI thread so it has higher priority comparing to the other threads (QThread)?
My aim is to not to freeze up the GUI while
Change the priority of the current thread when the current thread is the gui thread:
int main(int argc, char ** argv) {
QApplication app(argc, argv);
QThread::currentThread()->setPriority(QThread::HighPriority);
...
}
You can submit the change from any other thread, too – as long as the main (GUI) thread has a running event loop:
QMetaObject::invokeMethod(qApp, []{
QThread::currentThread()->setPriority(QThread::HighPriority);
});