AngryDuck
AngryDuck

Reputation: 4607

How to use QtWebview for Google Maps

Basically I want to use it for googlemaps but at the moment I can't even get it to compile a simple web page.

I'm using the latest version of Qt creator but the documentation just seems out of date

i have dragged the widget onto my form and set its url to google.com (just for testing purposes)

and when i hit compile i get loads of unresolved external symbol errors, I don't know what to include to use this I just assumed drag and drop the widget and I'm good to go, however this isn't the case.

Any ideas?

Upvotes: 0

Views: 614

Answers (2)

phyatt
phyatt

Reputation: 19112

EDIT: For Qt 4.x, this is what you do:

Go into your .pro file and include the right module for QtWebKit.

http://qt-project.org/wiki/QtWebKit

QT += webkit

And here is an example you can find in the welcome pages of Qt Creator if you want more:

http://qt-project.org/doc/qt-4.8/webkit-fancybrowser.html

Good luck; hope that helps. And btw, I just tested it with Google Maps, and it renders fine with Qt 4.8.4 on Win 7.

EDIT: For Qt 5.x+, this is what you do:

QT += webkitwidgets

Like it shows in the .pro file of any of the examples here:

http://qt-project.org/doc/qt-5.0/qtwebkitexamples/webkitwidgets-browser-browser-pro.html

http://qt-project.org/doc/qt-5.0/qtwebkitexamples/qtwebkitexamples-index.html

And you may want to consider also adding the network module in the pro file, too.

Upvotes: 1

AngryDuck
AngryDuck

Reputation: 4607

Ok so iv seen the QT +=webkit solution all over the place which for the record doesnt work if you have just dragged a dropped a webview into a widget using qt designer.

the solution i finally found that worked was

QT+=webkitwidgets

all working now thought id answer my own question after solving it to help anyone else who might be having the same problem

Upvotes: 0

Related Questions