How to use QtWebview for Google Maps - c++

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?

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.

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

Related

Why Qt remove QFtp library start from Qt5?

I just want to know why Qt remove QFtp start from Qt version 5.
Of course I can still install QtFtp manually on Qt5 but I cannot find any official answer about why they remove this library. For now, I should use QNetworkAccessManager, but it's having limited feature.
Thank you!
Edit:
More explanation about this sentence "... I should use QNetworkAccessManager, but it's having limited feature."
For example, I can get list of the content from FTP server using QtFtp, but I cannot do this with QNetworkAccessManager.

Add GUI to a QT Project with Arduino

So here is my question I have been trying to create a small "software" which would control my arduino card. For this I decide to use qt so I used this tutorial to add arduino to qt :
http://www.lucidarme.me/?p=3287
I am very sorry the page is only in French. I basicly get 3 files config files and includes for my arduino. And a Makefile. The problem I have is that I want to add GUI such as Windows but whenever I add a gui file to my project it says it cannot find the "QMainWindow". However I think the problem is deeper and that it doesn't find any Qt class.
I think this is because I don't have any pro files but I tried adding one and it didn't work. I hope you guys understood my problem I am very new to QT ...
Thank you !
The GUI project is completely unrelated to anything Arduino. The page you linked to shows how to use Qt Creator as an IDE to work on Arduino projects, as a replacement to the Arduino IDE. This has nothing to do with GUIs or Qt, you'd be reusing Qt Creator as a general-purpose IDE that it is.
What you need and want is to create a standard Qt project in Qt Creator and go from there. You can also leverage Qt to "simulate" Arduino code without running real Arduino hardware, see this answer for an example.

How to open a .pdf file from QML?

Is there any way to open a .pdf file from QML or I have to do it in C++ via QDesktopServices , and if I used QDesktopServices would it work without any problem in Android.
Thanks.
Is there any way to open a .pdf file from QML or I have to do it in C++ via QDesktopServices
The only thing I am aware of is the following:
Qt.openUrlExternally("http://stackoverflow.com/questions/23001582/how-to-open-a-pdf-file-from-qml/23002658");
Based on the comments, it seems to work on Android
In your particular case, it would become:
Qt.openUrlExternally("path/to/my/foo.pdf");
and if I used QDesktopServices would it work without any problem in Android
The question lacks a question mark, but nitpicking aside, this oughta work. This bug was also fixed in Qt 5.2.0. That is why I asked about the version, but other than this, I am not aware of any other critical issues:
QDesktopServices::openUrl crashes Application
You can do this from QML using the V-Play FileUtils: https://v-play.net/doc/fileutils/
fileUtils.openFile("<path to pdf file>")
Here is an example code that downloads a PDF from the web and opens it using the default application on Android and iOS: https://v-play.net/web-editor/?snippet=ce64a995

Header location issues while porting Qt code from Windows to Ubuntu

I'm trying to port code written in Qt on Windows to Qt on Ubuntu. The problem I'm facing is that it gives me this error for my ui_windowform.h header:
error: QtWidgets/QApplication: No such file or directory
I searched on Google for solutions but didn't find anything relevant. I've also added INCLUDEPATH += $QTDIR/include/qt4/QtGuito .pro file.
I mostly of agree with LukasT, but Qt 4 does still have QApplication, however it is located in a slightly different location :) .... or maybe :(
You should find it here: .../qt4/QtGui/QApplication .... or somthing like that, I can't quite recall now...
But I would definatley try to keep your Qt version the same on each platform then you garantee that you will have no Qt lib issues... compiler on the other hand is not garanteed :o (but I would not worry too much about that)
It looks like the original Qt code uses Qt5, QtWidgets/QApplication rings the bell from me [1] and you are pointing to Qt4 in Ubuntu. You should try to install Qt5 in Ubuntu.
[1] http://qt-project.org/doc/qt-5.0/qtwidgets/qtwidgets-index.html

WebBrowser component in Dev-C++

I want to use a WebBrowser control in a Dev-C++ project. Ages ago, when I was using VB6, I just added the WebBrowser control (C:\Windows\System32\shdocvw.dll) to my form and it worked, but I'm lost in C++.
Should I load it dynamically with LoadLibrary, then somehow add it to my dialog window? I want to have standard features like page navigation, dynamic HTML elements, submittable forms, view page source, etc.
Update:
I installed Qt Maker and downloaded a test project from the official site. But when running/compiling I get this error:
Could not find make command: make in the build environment
Error while building project betalabsclient (target: Desktop)
When executing build step 'Make'
Does anyone have any ideas? Mingw is installed, of course.
This is not the answer for your question, but you may want to try and use Qt and the webkit browser component in it.
There are several webkit-related samples and I assume that they may actually suit for your needs "as they are".
Web Browser Example (ActiveQt)
HOWTO: Get QT working with Dev-C++