当前位置:网站首页>QObject::connect: Cannot queue arguments of type ‘QTextCursor‘ (Make sure ‘QTextCursor‘ is registere
QObject::connect: Cannot queue arguments of type ‘QTextCursor‘ (Make sure ‘QTextCursor‘ is registere
2022-06-13 08:59:00 【one-rabbit】
About how to solve this problem ; In fact, you are in the slot function when the thread comes back Called ui Code for .
Solution ; The slot function returned from the thread is the same Slot function instead of , instead of use lambda expression
1、//cpp Threads
caiJi=std::thread([=](){
qDebug()<<" Current thread id"<<QThread::currentThreadId();
emit testxx(0);
});
// Signal and slot processing part
connect(this,&MainWindow::testxx,[&](int i){
qDebug()<<" end id"<<QThread::currentThreadId();
ui->textEdit->append(QString::number(i));
}
//2、Qt Threads
myT=new Mythread;
thread=new QThread;
myT->moveToThread(thread);
thread->start();
// Where the signal is sent
void Mythread::Test1()
{
qDebug()<<" Funny :"<<QThread::currentThreadId();
emit test2(" Youth is extraordinary ");
}
// Signal and slot processing part
connect(myT,&Mythread::test2,[=](QString str){
ui->textEdit->append(str);
});
By using signal and slot, we can The execution of the slot function is replaced by Current thread
connect(myT,&Mythread::test2,this,&MainWindow::test2);
void MainWindow::test2(QString str)
{
qDebug()<<" Signal and slot thread id"<<QThread::currentThreadId();
ui->textEdit->append(str);
}

边栏推荐
- 2021-04-16
- A solution to create a new EXCEL workbook on win10 computer and change the suffix to xlsm (normally it should be xlsx)
- redis
- 网上开户安全吗?新手可以开账户吗?
- Brief description of port, domain communication port and domain service
- Message Oriented Middleware
- useRoutes() may be used only in the context of a <Router> component.
- Visual studio tools using shortcut keys (continuous update)
- How excel adds hyperlinks to some text in a cell
- 20211006 线性变换
猜你喜欢

5. Attribute selector

4. Relationship selector (parent-child relationship, ancestor offspring relationship, brother relationship)

redis

Diversified tables through TL table row consolidation

Differences and uses among cookies, localstorage, sessionstorage, and application caching

顺时针打印个数组

File upload JS

Vscode define code block -- define cursor position

What exactly is Huawei cloud desktop saying when it says "smooth"?

關於RSA加密解密原理
随机推荐
An error CV2 is reported when the picture is converted to grayscale cvtColor(img, cv2.COLOR_BGR2GRAY)
Uni app subcontracting loading and optimization
Knowledge points related to system architecture 3
How many TCP connections can a machine create at most?
Opencv gaussianblur() explanation (Sigma value)
What exactly is Huawei cloud desktop saying when it says "smooth"?
A solution to create a new EXCEL workbook on win10 computer and change the suffix to xlsm (normally it should be xlsx)
Redirect vulnerability analysis of network security vulnerability analysis
Void* pointer
pytorch统计模型的参数个数
Cesium common events, including click events, mouse events, and camera movement events
Onnx crop intermediate node
0. some doubts about learning SolidWorks for the first time
torch. How to calculate addmm (m, mat1, mat2)
2021-04-16
【网络安全】SQL注入新思维之webshell提权
7、 JS data type
CentOS installing MySQL and setting up remote access
ERP outlet
Object in ES6 Use of entries()