[Interest] QtWebKit and open URL in new tab window

neel patel neel5481 at gmail.com
Tue Nov 21 07:18:27 CET 2017


Hi,

I want to create new window in my QTabWidget when we get "target=_new" from
HTML file.

We are getting "createWindow" call from Qt when user click on any link with
attribute "target=_new" and I am handling that and open in new tab in
QTabWidget.

BUT when we close the opened tab and again click on same link then second
time i am not getting the "createWindow" call so not able to open in new
tab. Any idea why ?


Below code for reference.

#################################

class MyWebView : public QWebView

{

    Q_OBJECT

public:

   MyWebView (QWidget *parent = NULL);

private:

    QString m_url;

 };

class MyWebViewPage : public QWebPage

{

    Q_OBJECT

public:

    MyWebViewPage (QObject *parent = 0);

    ~ MyWebViewPage();


protected:

    virtual bool acceptNavigationRequest(QWebFrame *frame, const
QNetworkRequest &request, NavigationType type);

    QWebPage *createWindow(QWebPage::WebWindowType type);

    bool javaScriptConfirm(QWebFrame * frame, const QString & msg);

};

#################################


Can anyone suggest - why "createWindow" is not getting called when we close
and open the new tab window ?

Thanks in Advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20171121/d38f99fa/attachment.html>


More information about the Interest mailing list