[webkit-qt] Extending the hybrid support of QtWebkit to more types: feedback please!
Simon Hausmann
simon.hausmann at nokia.com
Wed Dec 30 06:32:33 PST 2009
On Tuesday 29 December 2009 Rosenthal Noam (Nokia-D-Qt/RedwoodCity), wrote:
> Hi Simon
>
> (~btw sorry for re-posting the idea on bugzilla, I got this email late...)
>
> >-----Original Message-----
> >From: webkit-qt-bounces at lists.webkit.org
> >[mailto:webkit-qt-bounces at lists.webkit.org] On Behalf Of
> >Hausmann Simon (Nokia-D-Qt/Oslo)
> >Sent: Tuesday, December 29, 2009 7:40 AM
> >To: webkit-qt at lists.webkit.org
> >Subject: Re: [webkit-qt] Extending the hybrid support of
> >QtWebkit to more types: feedback please!
> >
> >> How about the following alternative:
> >>
> >>
> >> var pxm = myQObject.someQPixmapProperty;
> >>
> >> var img = pxm.createImageElement();
> >> // or
> >> someOtherImg.style.backgroundImage = "url("+
> >> pxm.toDataURL("image/jpeg")+ ")";
> >>
> >> So it's basically a custom JS object that looks like:
> >> {
> >> width: ...,
> >> height: ...,
> >> createImageElement: function() {...},
> >> toDataUrl: function(mimeType) {...}
> >> }
> >>
> >> Is this a workable approach?
> >
> >That looks much better :-), makes it much more explicit what's
> >happening.
>
> OK, will send a patch soon!
>
> >Hmm, the next question for me is then: What's the most
>
> X`x>
>
> >Just prototyping:
> >
> > QVariant data = myPixmap;
> > QUri url =
> >webPage->networkAccessManager()->addResource(data); //
> >mime-type is implied by QVariant type
> >
> > QWebElement img = ...;
> > img.setAttribute("src", url.toEncoded());
>
> Yeh, that should work - though it means objects like BitmapImageQt.cpp need
> to know QNetworkAccessManager in order to access the actual QVariant I
> don't know if I have a better solution though, apart from exposing it
> directly to QTextBrowser the same way I do it with webkit here...
>
> But maybe after we make the webkit use-case work and get it to be more
> mature, we'll know more about what makes sense for other use cases?
I'm sure of the use-cases with QLabel - it's a feature that has been requested
many times.
My main worry about all this is to get the API right - we have only one chance
here.
(although currently the entire bridge is undocumented...)
Simon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.webkit.org/pipermail/webkit-qt/attachments/20091230/6450ecd5/attachment.bin>
More information about the webkit-qt
mailing list