[webkit-qt] Extending the hybrid support of QtWebkit to more types: feedback please!

noam.rosenthal at nokia.com noam.rosenthal at nokia.com
Tue Dec 29 14:22:45 PST 2009


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?

Cheers
No'am

>
>
>Simon
>


More information about the webkit-qt mailing list