void MyWebView::initEvents() { // 委托页面所有连接在当前视图中打开 myPage->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); connect(myPage, SIGNAL(linkClicked(QUrl)), this, SLOT(onOpenUrl(QUrl))); // 对所有事件添加信号槽 connect(myFrame, SIGNAL(loadFinished(bool)), this, SLOT(onLoadFinished(bool))); connect(myFrame, SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(onJavaScriptWindowObjectCleared())); connect(myFrame, SIGNAL(initialLayoutCompleted()), this, SLOT(onInitialLayoutCompleted())); connect(myFrame, SIGNAL(pageChanged()), this, SLOT(onPageChanged())); connect(myFrame, SIGNAL(contentsSizeChanged(const QSize)), this, SLOT(onContentsSizeChanged(const QSize))); connect(myFrame, SIGNAL(iconChanged()), this, SLOT(onIconChanged())); connect(myFrame, SIGNAL(loadStarted()), this, SLOT(onLoadStarted())); connect(myFrame, SIGNAL(titleChanged(const QString)), this, SLOT(onTitleChanged(const QString))); connect(myFrame, SIGNAL(urlChanged(const QUrl)), this, SLOT(onUrlChanged(const QUrl))); connect(myPage, SIGNAL(loadProgress(int)), this, SLOT(onLoadProgress(int))); connect(myPage, SIGNAL(repaintRequested(const QRect)), this, SLOT(onRepaintRequested(const QRect))); connect(myPage, SIGNAL(geometryChangeRequested(const QRect)), this, SLOT(onGeometryChangeRequested(const QRect))); connect(newManager, SIGNAL(requestFinished(QString)), this, SLOT(onRequestFinished(QString))); connect(newManager, SIGNAL(requestStart(QString)), this, SLOT(onRequestStart(QString))); };
void OpenUrl:: componentComplete() { QQuickItem::componentComplete(); connect(this, SIGNAL(openUrl(QUrl)), this, SLOT(onOpenUrl(QUrl))); LOG_CALLS Log("OpenUrl::componentComplete"); }