[Qtwebengine] Off-the-record QWebEngineProfiles

Akkana Peck akkana at shallowsky.com
Wed May 24 17:51:00 CEST 2017


Allan Sandfeld Jensen writes:
> On Wednesday 24 May 2017, Akkana Peck wrote:
> >         self.page = QWebEnginePage(None, self.profile)
> > self.page.profile().isOffTheRecord() still prints as False.
> > 
> Wrong order, profile is first argument parent is second

Whoops! Blush, you're right. And it does work if I call
QWebEnginePage(self.profile, None). Thanks!

Florian had wondered:
| This makes me wonder if C++ handles this differently though - does it
| select the second overload because it's a more specific match? If it
| does, this might be a "bug" in how PyQt selects which overload to run.

It did seem unusual that adding "None" as a second argument
argument would be required to make the first argument work -- that
the optional argument would be the first one, not the second. Not
sure I've ever seen that before in a Python API. I don't know how
hard it would be to make the Python bindings smarter about choosing
which overload to use, or perhaps to make profile a keyword argument
(I did try QWebEnginePage(profile=self.profile) first, but it didn't
accept it since profile isn't a keyword argument). But that's a
question for whoever does the Python bindings.

It would definitely be something to note in the documentation,
though, if there's ever going to be documentation written for
the Python version of QtWebEngine. Who does the Python documentation?
Is that something I could help with? (Once I understand it better,
anyway.)

        ...Akkana



More information about the QtWebEngine mailing list