[Qt-interest] How to call javascript function from qt

Thiago Macieira thiago at kde.org
Fri Jun 11 12:38:49 CEST 2010


Em Sexta-feira 11 Junho 2010, às 10:56:59, Andre Somers escreveu:
> On 10-6-2010 21:42, Thiago Macieira wrote:
> > Em Quinta-feira 10. Junho 2010, às 14.22.09, Frank Lutz escreveu:
> >> What i can remember as i do had the same problem is that you have to
> >> load the text with QUrl:
> >> view->load(QUrl(fileinfo->absoluteFilePath()));
> >> Than you do not explicit activate Javascript.
> > 
> > That code above would be wrong.
> > 
> > You meant:
> > 	QUrl::fromLocalFile(fileInfo->absoluteFilePath());
> > 
> > Starting with Qt 4.8, URLs without a scheme will no longer be considered
> > local files.
> 
> Wouldn't that conceivably break existing programs that upgrade to Qt
> 4.8?

Yes. That's why I am telling you this now.

And those programs are already broken in my view, because URLs without scheme 
do not translate to local files in all circumstances. There is code that checks 
for "file" specifically.

Besides, the code above *was* broken beyond repair. What happens to file:

	/foo/bar/Mambo #5.mp3
?

Remember this:
	QUrl("/foo/bar/Mambo #5.mp3").path() == "/foo/bar/Mambo "

> And if so, how does that relate to the Qt promisse that upgrading
> (minor) releases will be binairy and and source compatible? While it may
> formally be both, it would constitute a regression for those programs,
> would it not?

Not if I declare that the programs were buggy in the first place :-)

Applications relying on bugs don't get behaviour compatibility guarantees.

And that's what I am doing: relying on scheme().isEmpty() == isLocalFile() is 
a bug.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Product Manager - Nokia, Qt Development Frameworks
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100611/bcd933b4/attachment.bin 


More information about the Qt-interest-old mailing list