PDA

View Full Version : QWebView not compatible with many websites?



aRestless
23rd April 2010, 14:45
Hi there,

I've got problems getting several websites working in Qt's built in browser. I'm using PyQt4, but that shouldn't make a difference, should it?



def __init__(self, parent = None):
super(MapViewer, self).__init__(parent)
self.load(QUrl("http://qt.nokia.com))


That's everything I do with my subclass of QWebView (instead of initializing it from another class of course). Works fine for HTML, but JavaScript, like in the samplepage, doesn't work correctly:

http://wgkarlsruhe.de/Screenshot1.JPG
That's how it looks like, and that's how it should look like:
http://wgkarlsruhe.de/Screenshot2.JPG

Is that a known issue? I heard that executing JavaScript via QWebView works fine, why shouldn't it work when implemented in the displayed website itself?


Hope you guys can help me,
aRestless

wysota
23rd April 2010, 20:43
What does javascript have to do with images you posted?

Scott Shiff
24th April 2010, 07:11
set the attribute QWebSettings::JavascriptEnabled to true

wysota - the images are loaded on that web page from js

aRestless
27th April 2010, 12:55
JavaScript is enabled. As you can see in the first picture, the menu's text is loaded, but not scaled correctly. This Non-correct-scaling seems to be the problem on most websites. Maybe QWebView offers wrong information about the resolution for example so the built in JS scales to the wrong size?

aRestless
4th May 2010, 13:02
Problem solved. I had the wrong version of PyQt4 for my Python installation. I expected Python 2.6 to be installed, but it was 2.5 instead. I didn't have any compatibility problems before, so I didn't expect the source of the problem there. Anyway, thanks for the help.