从 QThread 显示 QMessageBox
我想从单独的线程显示消息框,但是,我收到此错误:
QThread: Destroyed while thread is still running
谁能解释如何从线程显示消息框?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
我想从单独的线程显示消息框,但是,我收到此错误:
QThread: Destroyed while thread is still running
谁能解释如何从线程显示消息框?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(1)
发出信号。由于您无法在 Qthread 中执行 UI 操作,因此请将消息作为信号的参数发送。
qthread 中的信号声明:
从 qthread 发出信号:
QMainWindow 中的槽声明/定义:
槽和信号的连接:
Emit a signal. Since you cannot do UI stuff in a
Qthread
, instead send your message as an argument of your signal.signal decalaration in your qthread:
emitting the signal from the qthread:
slot declaration/definition in QMainWindow:
connecting of the slot and signal: