使用QAxWidget在qt中记录文档完成信号 [英] Document Completed Signal inside qt using QAxWidget

查看:344
本文介绍了使用QAxWidget在qt中记录文档完成信号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在/examples/activeqt/webbrowser中使用qt内置示例,并且正在尝试使用DocumentComplete SIGNAL. 我的目的是在QAxWidget中使用嵌入式Internet Explorer,并在DocumentComplete之后弹出一条消息(带有网站上的内容). NavigateComplete Signal不够好,我无法使用...

I'm Using qt Built-in Examples in /examples/activeqt/webbrowser, and i'm trying to use DocumentComplete SIGNAL. my purpose is using embedded Internet explorer inside QAxWidget and popup a message (with contetnt from the website) after DocumentComplete. NavigateComplete Signal is not good enough for me use...

可以在此处查看代码: qt Web浏览器示例

the code can be seen here : 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();
}

dubbuger说:没有这样的插槽MainWindow :: on_WebBrowser_DocumentComplete(IDispatch *,QVaria‌nt&)

the dubbuger says: No such slot MainWindow::on_WebBrowser_DocumentComplete(IDispatch*,QVaria‌​nt&)

推荐答案

我通过重新生成.moc文件解决了该问题.在构建配置下,qmake的文件夹位置错误.通过将其更正为项目位置可以解决我的问题.现在可以识别该插槽.谢谢大家的帮助.

i solved the issue by regenerating the .moc file. under build configuration the folder location of qmake was wrong. by correcting it to project location fixed my problem. the slot is now recognized. thank all for you help.

Qt构建配置

这篇关于使用QAxWidget在qt中记录文档完成信号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆