Qt World Summit: Register Today!

CreateWindow override

  • If I'm using a Qt Creator project & UI file, how do I have use a custom QWebView in order to override CreateWindow? Or how do I dynamically make it use my Createwindow method?

  • Sorry, I do not understand what you want to do.

    Can't you just pull a QWebView into the UI and be done?

  • I'm using Qt Creator and I drag a WebView onto my form. But in order for this web view to open new windows, I need to override the createWindow method of either the QWebView or the QWebPage. But the WebView is created via the .ui file. I'm thinking I need to create my own QWebPage class and then call the QWebView->setPage method.

  • You can do any of those, subclass the view or the page (for many use of WebKit, you'll want a subclass of QWebPage anyway).

    If you subclass QWebView, you can still use QtCreator and designer. You just need to promote the widget to your subclass (see the doc of Qt Designer).

  • As I've been finding out, subclassing the WebPage is the way to go and, like you say, it looks necessary. Thx.

Log in to reply