[Qtwebengine] Off-the-record QWebEngineProfiles

Florian Bruhin me at the-compiler.org
Wed May 24 17:18:56 CEST 2017

On Wed, May 24, 2017 at 09:04:06AM -0600, Akkana Peck wrote:
> 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.

I couldn't reproduce it anymore after doing that change in your
quickbrowse script. Can you push the updated code?

> 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.

No, I tried with your example, and it also works fine in my PyQt5 +
QtWebEngine project.

Yes, you'll need to pass an actual parent object, any valid QObject.
Passing the view worked fine for me in your example, and it makes sense
for the view to be the parent of the page.

Also see the overview here:


https://www.qutebrowser.org  | me at the-compiler.org (Mail/XMPP)
   GPG: 916E B0C8 FD55 A072  | https://the-compiler.org/pubkey.asc
         I love long mails!  | https://email.is-not-s.ms/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/qtwebengine/attachments/20170524/6da59276/attachment.sig>

More information about the QtWebEngine mailing list