我在 /examples/activeqt/webbrowser 中使用 qt 内置示例,并且我正在尝试使用 DocumentComplete SIGNAL。我的目的是在 QAxWidget 中使用嵌入式 Internet Explorer,并在 DocumentComplete 之后弹出一条消息(带有来自网站的内容)。NavigateComplete 信号对我来说不够好......
代码可以在这里看到:qt Web browser Example
class MainWindow : public QMainWindow, public Ui::MainWindow
{
Q_OBJECT
public:
MainWindow();
public slots:
void on_WebBrowser_TitleChange(const QString &title);
void on_WebBrowser_ProgressChange(int a, int b);
void on_WebBrowser_CommandStateChange(int cmd, bool on);
void on_WebBrowser_BeforeNavigate();
void on_WebBrowser_NavigateComplete(const QString &address);
void on_WebBrowser_DocumentComplete(IDispatch*,QVariant&)
void on_actionGo_triggered();
void on_actionNewWindow_triggered();
void on_actionAddBookmark_triggered();
void on_actionAbout_triggered();
void on_actionAboutQt_triggered();
void on_actionFileClose_triggered();
private:
QProgressBar *m_progressBar;
};
MainWindow::MainWindow()
{
setupUi(this);
connect(m_addressEdit, SIGNAL(returnPressed()), actionGo, SLOT(trigger()));
connect(actionBack, SIGNAL(triggered()), WebBrowser, SLOT(GoBack()));
connect(actionForward, SIGNAL(triggered()), WebBrowser, SLOT(GoForward()));
connect(actionStop, SIGNAL(triggered()), WebBrowser, SLOT(Stop()));
connect(actionRefresh, SIGNAL(triggered()), WebBrowser, SLOT(Refresh()));
connect(actionHome, SIGNAL(triggered()), WebBrowser, SLOT(GoHome()));
connect(actionSearch, SIGNAL(triggered()), WebBrowser, SLOT(GoSearch()));
connect(WebBrowser,SIGNAL(DocumentComplete(IDispatch*,QVariant&), this, SLOT(on_WebBrowser_DocumentComplete(IDispatch*,QVariant&)))
}
void MainWindow::on_WebBrowser_DocumentComplete(IDispatch*,QVariant&)
{
QMessangeBox x;
x.setText("pop-up");
x.exec();
}
配音员说:没有这样的插槽 MainWindow::on_WebBrowser_DocumentComplete(IDispatch*,QVariant&)