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: [email protected] > >[mailto:[email protected]] On Behalf Of > >Hausmann Simon (Nokia-D-Qt/Oslo) > >Sent: Tuesday, December 29, 2009 7:40 AM > >To: [email protected] > >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
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ webkit-qt mailing list [email protected] http://lists.webkit.org/mailman/listinfo.cgi/webkit-qt
