문제

code

  News::News(QWidget *parent) :
   QDialog(parent),
  ui(new Ui::News)
  {
   ui->setupUi(this);
   ui->webView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks);
   connect(ui->webView,SIGNAL(linkClicked(QUrl)),this,SLOT(openUrl(QUrl)));
  }

void News::openUrl(QUrl url){
  if(the new window)
        QDesktopServices::openUrl(url);
  }else{
    ui->webView->load(url);
  }
}

How do I judge instead of a new window link function openUrl? How I'm going to write this code、? thanks!!!

도움이 되었습니까?

해결책

You need to inherit your own class from QWebView and reimplement the createWindow() method. http://doc.qt.digia.com/qt/qwebview.html#createWindow

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top