[PyQt] QWebPage plug-ins
trupill at gmail.com
Sun Jun 14 15:00:51 BST 2009
On Domingo 14 Junio 2009 15:46:35 Phil Thompson escribió:
> On Sun, 14 Jun 2009 15:36:29 +0200, Alejandro Serrano <trupill at gmail.com>
> > On Domingo 14 Junio 2009 14:26:38 Phil Thompson escribió:
> >> On Sun, 14 Jun 2009 12:05:26 +0200, Alejandro Serrano
> <trupill at gmail.com>
> >> wrote:
> >> > ...
> >> It's true that earlier versions of PyQt registered a lot of C++ types
> >> that
> >> Qt didn't register automatically, but that was an implementation detail
> >> and
> >> not documented behavior. As the registration is template based it has to
> >> be
> >> done from C++.
> >> Phil
> > I see... The problem that I'm facing is that I am creating the
> > using plug-ins, and I need them to create different widgets in the
> > QWebPage. I
> > have thought about two solutions, and I would like to know whether they
> > possible:
> > 1. Create some C++ or SIP function that would register a type passed as
> > argument somehow. That way I would only need one C++ library. Maybe just
> > something that would wrap qRegisterMetaType...
> Not easy - it's a template.
> > 2. Make all plug-in derive from some common class and then register the
> > base
> > class. If I do that, could I use the derived classes from QWebPage?
> I've no problem with including additional C++ classes that are then wrapped
> so that particular things can be done from Python - see the various QPy
> classes in PyQt - but somebody will have to say exactly what's needed.
My problems are basically with using things from QtWebKit and QtScript. Maybe
just something like pyqtProperty that would call
http://doc.trolltech.com/4.2/qmetatype.html#qRegisterMetaType when the class
is created in memory (I don't know much about PyQt internals so I don't know
whether that could be possible).
If not, maybe some base class that wraps QObject + MetaType registration, and
other that wraps QWidget + MetaType registration. The second is more important
for me, because I don't mind deriving some classes from QWidget instead of
QObject, but I need QWidgets shown in the web page.
I've also been making some experiments, and I've seen that using QVariant with
a Python-create class works flawlessly, but not with QWebPage.
Once again, thank you very much
More information about the PyQt