[Qtwebengine] Off-the-record QWebEngineProfiles

Akkana Peck akkana at shallowsky.com
Wed May 24 17:04:06 CEST 2017

Florian Bruhin writes:
> Hey Akkana,
> On Tue, May 23, 2017 at 07:58:45PM -0600, Akkana Peck wrote:
> >     self.page = QWebEnginePage(self.profile)
> The QWebEnginePage constructor has two overloads:
>     QWebEnginePage(QObject *parent = Q_NULLPTR)
>     QWebEnginePage(QWebEngineProfile *profile, QObject *parent = Q_NULLPTR)
> Since a QWebEngineProfile is a valid QObject, and you don't pass a
> second argument, the first one gets selected - i.e. you get the default
> profile, and your profile as a parent object for the page.
> If you pass self.webview as a second argument, all works like intended.

Good point! But even if I call
        self.page = QWebEnginePage(None, self.profile)
self.page.profile().isOffTheRecord() still prints as False.

If it works for you in C++, could this be a problem with the
Python bindings? Or does it only work if I pass a non-null parent?
I'm not sure what the parent is supposed to be: the documentation
only says it's a QObject but not what sort of QObject. The
QWebEngineView? Apparently not, that errors with "unexpected
type" even though it supposedly inherits from QObject.


More information about the QtWebEngine mailing list