Home > Mobile >  Qt LineEdit build thread after get the text contents program crashes
Qt LineEdit build thread after get the text contents program crashes

Time:09-17


Help ~
Qt LineEdit text, text directly so that create a button to get no problem
But after I created another thread can program crashes, no hint,,
The test problem in the cap - & gt; Start (), without the code that's ok, bosses, genuflect is begged solve ~

CodePudding user response:

I am a novice, the first two days as if said in a video to see the child thread operation in the UI object will go wrong,

CodePudding user response:

refer to the second floor cjyyj response:
I am a novice, as if in a couple of days ago said in the video to see the child thread operation in the UI object will go wrong,

I came out, inside the thread run function to launch a signal can do print groove,,,
I found in the UI thread is not calling UI things
But why would put my button place cap threads, and I am not in the UI created under yao,,, don't understand,,

CodePudding user response:

reference 3 floor ahhh drink many response:
Quote: refer to the second floor cjyyj response:
I am a novice, as if in a couple of days ago said in the video to see the child thread operation in the UI object will go wrong,

I came out, inside the thread run function to launch a signal can do print groove,,,
I found in the UI thread is not calling UI things
But why would put my button place cap threads, and I am not in the UI created under yao,,, don't understand,,

I see in the video said that connect with the fifth parameter related (connection)
If it is a direct connection, so you are in which thread transmitting, slot is run in which thread
If the connection is the queue, then signals and slots can belong to different threads, but this will depend on the event loop,

Below is I look at the video tutorials, if you just want to see about the signals and slots connections related content, can start from 7 to see
https://www.bilibili.com/video/av4056436? The from=search& Seid=16059050830503275436

CodePudding user response:

reference 3 floor ahhh drink many response:
Quote: refer to the second floor cjyyj response:
I am a novice, as if in a couple of days ago said in the video to see the child thread operation in the UI object will go wrong,

I came out, inside the thread run function to launch a signal can do print groove,,,
I found in the UI thread is not calling UI things
But why would put my button place cap threads, and I am not in the UI created under yao,,, don't understand,,


Button is not belongs to the thread of cap, cap is just a thread of managers,
The button, the cap is attached to the UI thread (where new which is attached to the thread)
Cap run function that executes code is another thread to perform the content of the

Reference: https://blog.csdn.net/lc250123/article/details/84101219

CodePudding user response:

Upstairs said cap attached to the UI thread, you add a this try when the new thread
  •  Tags:  
  • Qt
  • Related