我主要是网络开发人员,所以我的问题可能是初学者。
我正在编写一个与 QWebView 内容一起使用的函数,这是一种对加载的网页进行操作的宏脚本。
代码是这样的:
somefunction() {
QWebView *webView;
webView->load(QUrl("http://www.google.com"));
<...> here I want to pause the code until the page is loaded <...>
here goes the code of html manipulation, click on another link
<...> here I want to pause the code until the page is loaded <...>
}
好的,所以在我写“<...> 在这里我想暂停代码直到页面加载 <...>”的地方我不知道要做什么来暂停函数并让它等待页面完成加载. 我知道信号和插槽。但是如果我在这里使用 slot,我将不得不在另一个函数中继续 - 在 SLOT 函数中,但我想将所有代码和逻辑留在 somefunction() 中。怎么做?