
Originally Posted by
wysota
QFuture and
QThread have nothing to do with multi-processing. If you want multiprocessing then you need to implement a master process that will act as a container for all the pages and you need to implement the slave that will let itself be embedded into the master process. There is nothing in Qt that can help you with that directly. It is not something that you can do in 10 minutes. If you want, have a look at Chromium sources.
I could use QFuture with QWebPage::acceptNavigationRequest, the problem is that I want to do this with QWebPage::createWindow, but I do not know how to "rewrite" the QWebPage::createWindow to work with QFuture.
See what I got:
class myWebPage : public QWebPage
{
QWebPage *p;
void Test
(const QUrl & url
){ QWebView *p = new QWebView;
p->show();
p->setUrl(url);
}
bool acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, NavigationType type) {
QUrl url
= request.
url();
if(parentFrame==false){
firstFrame = frame;
parentFrame = true;
} else {
if(frame != firstFrame){
QtConcurrent::run(this,&myWebPage::Teste,url);
}
}
return QWebPage::acceptNavigationRequest(frame,request,type);
}
};
class myWebPage : public QWebPage
{
QWebPage *p;
void Test(const QUrl & url){
QWebView *p = new QWebView;
p->show();
p->setUrl(url);
}
bool acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &request, NavigationType type) {
QUrl url = request.url();
if(parentFrame==false){
firstFrame = frame;
parentFrame = true;
} else {
if(frame != firstFrame){
QtConcurrent::run(this,&myWebPage::Teste,url);
}
}
return QWebPage::acceptNavigationRequest(frame,request,type);
}
};
To copy to clipboard, switch view to plain text mode
This code works with target="" but does not work with window.open, so I need to understand how to rewrite the QWebPage::createWindow
Could you help me with this?
Bookmarks