Home > Mobile >  QT5.8 thread USES the main interface control, to make the main interface related controls inside the
QT5.8 thread USES the main interface control, to make the main interface related controls inside the

Time:09-29

Use graphicsView control display images, but can't change by thread operation function display images, is always an error, by slot function display video delay is too high, frames one gao hang up,

What I need is posted in a thread while modifying interface controls image directly,

Attached function operation code:
# include "MyThread. H"
# include & lt; QDebug>
# include & lt; QMutex>
# include & lt; QThread>

MyThread: : MyThread (MainWindow * UI)
{
This - & gt; Win=UI;
The connect (this, SIGNAL (bar_sig ()), and this, SLOT (bar_slot ()));
IsStop=false;
}
MyThread: : ~ MyThread ()
{

}

Void MyThread: : closeThread ()
{
IsStop=true;
}

Void MyThread: : pauses ()
{
This - & gt; The lock (); pause.
}

Void MyThread: : resume ()
{
This - & gt; Pause. Unlock ();
}

Void MyThread: : run ()
{
While (true)
{
The lock (); pause.
Emit bar_sig ();
If (isStop)
return;
Msleep (420);
Pause. Unlock ();

}
}

Void MyThread: : bar_slot () {

Win - & gt; Videorun ();
//in the groove function calls the MainWindow class controls operating function

}



Hope, let us know how to run it,,,,,,,,

CodePudding user response:

Top, although use other controls to solve, but I still want to know what use to control how to solve

CodePudding user response:

reference 1st floor yang_xiaobai response:
top, although use other controls to solve, but I still want to know how with change control solution

Can car machine is QT5.8.0 installing third-party software? And a tutorial

CodePudding user response:

The original poster with problems what controls are used to solve of, please

CodePudding user response:

reference 3/f, yiyi response:
the original poster with problems could you tell me what controls are used to solve

Qlabel

CodePudding user response:

Qt mechanism is only operate in the main thread UI, other threads prohibited operating the main UI,
In the new thread to establish QApplication don't know can line, but even if the establishment of a new thread message loop, two UI is not each other

CodePudding user response:

Establish a QObject object, and then use moveToThread transferred to the thread, so use signals slot is no problem,
  •  Tags:  
  • Qt
  • Related