Qt 中的信号槽:emit 位于 slot 方法中
我正在读一本关于Qt的书,在信号槽函数的一个示例中,槽方法内部有一个emit方法...所以这变成了一个无限循环...我真的不明白如何停止它:
connect(webView, SIGNAL(urlChanged(const QUrl&)),
this, SLOT(urlChange(const QUrl&));
然后我们就有了这个功能:
void BrowserWindow::urlChange(const QUrl &url)
{
emit urlChanged(url);
progressLabel->setText(tr("Loading"));
}
谢谢
i'm reading a book about Qt, in one of the examples of a signal-slot function, there is the emit method located inside the slot method... So this becomes an infinite loop... i don't really understand how to stop it :
connect(webView, SIGNAL(urlChanged(const QUrl&)),
this, SLOT(urlChange(const QUrl&));
and we then have the function :
void BrowserWindow::urlChange(const QUrl &url)
{
emit urlChanged(url);
progressLabel->setText(tr("Loading"));
}
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
什么是网络视图? (它是同一类型吗?)
连接正在将一个实例与此插槽连接 - 它可能没有连接它自己的实例。
如果是的
话那就是无限循环
What is webView? (is it the same type?)
The connect is connecting one instance with this slot - its probably not connecting its own instance.
If it was
then that would be an infinite loop