I'm creating an application that needs to be able to add/locate/delete tags on map locations, be able to go to a specific address, and retrieve an address from an arbitrary point on the map.
I am thinking the google maps API is what I need to use. I tried downloading the following code from GitHub:
https://github.com/tranter/qt-google-maps
but I couldn't get it working nor understand what is going on in it.
I tried creating a QWebView widget and using this code:
ui->webView->setUrl(QUrl("http://maps.google.com"));
but when I run, nothing shows up in the web view and I get a lot of these types of lines in my application output:
qt.network.ssl: QSslSocket: cannot call unresolved function
SSLv23_client_method
I'm pretty much shooting in the dark at this point. Does anyone have a good easy straightforward way to understand how to use google maps in a qt application?
Use google map plugin for QtLocation : https://github.com/vladest/googlemaps
Make sure you have added below in .pro file
QT += network
-lssl -lcrypto SSL libraries (libeay32,ssleay32 .dll or .so depending on your platform)
Related
I am trying to put wkhtmltopdf onto a virtualbox'ed ubuntu 12.04 64bit server. So far no luck.
The package from the repositories wants to have xserver running and the static version:
wkhtmltopdf google.com tesss.pdf
Loading pages (1/6)
QSslSocket: cannot resolve SSLv2_client_method ] 10%
QSslSocket: cannot resolve SSLv2_server_method
Counting pages (2/6)
Resolving links (4/6)
Loading headers and footers (5/6)
Printing pages (6/6)
QPixmap: Cannot create a QPixmap when no GUI is being used===] Page 1 of 1
QPixmap: Cannot create a QPixmap when no GUI is being used
QPixmap: Cannot create a QPixmap when no GUI is being used
QPixmap: Cannot create a QPixmap when no GUI is being used
QPixmap: Cannot create a QPixmap when no GUI is being used
QPixmap: Cannot create a QPixmap when no GUI is being used
QPixmap: Cannot create a QPixmap when no GUI is being used
Segmentation fault
Any ideas how could I approach this?
http://code.google.com/p/wkhtmltopdf/issues/detail?id=730
Basically, it got fixed around a year ago, but has still not been released. What a mess :(
Try using 0.10.0_rc2 version instead, which worked perfectly for me
The QPixmap errors are not causing the segmentation fault. In fact, adding the --disable-javascript option solves the issue. You will still get the warnings but the PDF is generated correctly. HTH.
I had a similar issue (segfault) and found out I had a ulimit -v (virtual memory) limit set when executing wkhtmltopdf from apache. Everything was running fine from command line when using the same command.
I was able to fit it by prepending the command with ulimit like this: "ulimit -v 1073741824; wkhtmltopdf --page-size Letter ...."
Upgrade to 0.12.6.
I know this is an old issue but for those still running into this, try upgrading to the latest version (0.12.6 at the time of writing). A lot of these issues have been fixed in the last few releases.
After that, try adjusting your ulimit on your machine as others have mentioned.
Then finally, if you are showing the current and total pages in your header or footer, see this answer for a good tip and solution.
binary used: wkhtmltopdf 0.11.0 rc1 linux i386
I have seen the segmentation faults when converting pages having Google Maps JS API embedded. In those cases an output file having 0 byte size was generated. Did not find any solution to get this version running by different command line arguments to wkhtmltopdf.
Finally switched to Google Maps Static API in order to prevent the heavy JS work, which seems to cause the problem. This just embeds the map as a static image, which looks quite well when printing if you supply scale=2 as an option.
Is it possible to use GTK without a valid X display?
I want to use GTK with Webkit, but for now I'm only interested in using the DOM functions to experiment, so I have no need to actually display anything. It's very convenient for me to do this over an SSH connection on a server that has no display.
But, without a DISPLAY environment variable, gtk_init() simply fails with the message:
Gtk-WARNING **: cannot open display:
Is there anyway to use GTK without a display?
There is an X server called Xvfb which provides a valid DISPLAY and sends the output to a file instead of to graphics hardware. You can run that on the same machine that's running your gtk client, and gtk will be able to do whatever it wants to do without using any of your network bandwidth. As a bonus, you can read Xvfb's output buffer from the file, allowing you to get a screenshot of what would be on the screen.
While it's not an direct answer to your question, I think what you are looking for is a “headless” web browser. There's one based on WebKit, called PhantomJS. It doesn't require any GUI stack, and you can freely experiment with DOM there.
Gtk+ 3 (well, GDK) has support for multiple backends now, but still requires X11, Wayland, or Broadway (experimental HTML5 backend) to run.
DISPLAY doesn't necessarily need actual hardware; you can run a fake X server such as Xvfb or Xvnc.
I'm glad I read the docs deeper and didn't just believe this answer.
gtk_init_check()
This function does the same work as gtk_init() with only a single change: It does not terminate the program if the windowing system can’t be initialized. Instead it returns FALSE on failure.
This question already has answers here:
Closed 10 years ago.
I wonder how to create an application that would be capable to have only one instance of it running on a host OS at a time.. so to say a singleton app. I wonder how to create such singleton C++ app in Qt?
You could use the QtSingleApplication class from Qt Solutions. Notice that this is not a standard Qt class. You should download it. The QtSingleApplication component provides support for applications
that can be only started once per user.
When the application starts, create a file. When the application ends, remove the file.
If the file exists, exit with an error message.
You don't really need Qt for this, it's a graphics library.
Just use some normal WINAPI method to do this.
You could either create files like suggested (but can get strange when your application will crash, or after a power outage), or use memory mapped files or some other global objects to check if your app is stil running.
You also could just check the process list to see if another copy is running.
Another thing is to do a FindWindow with your window class, that's pretty easy and will work well.
There are a lot of options, just search for this, it's a common question.
(you could use some libraries for this, but since you are only targetting windows, I'd go with FindWindow.)
I am coding one project, which needs to launch some webbrowsers with the given url.
I saw some QT examples, but they explained how to launch the default browser, not a particular browser.
Any helping suggestions will be appreciated.
Edit1:
Below is the code I use currently
QString temp="C:/Program Files/Internet Explorer/iexplore.exe";
process->start(temp.toStdString().c_str());
Edit2
Hi, I found that the problem is not in QProcess->start, Because it works perfectly for "explorer.exe", But not works, for executables which are in Program Files.
So I post a new question about it.
If you know which browser you want to start and where they are located on the system (such as the default installation directories). You should be able to use QProcess
This can usually be done as the following:
iexplore.exe http://www.locationOfUrl.com
or
//path/to/app/firefox.exe http://www.locationOfUrl.com
system("/path/to/the/browser \"http://www.the.com/url\"");
or spawn instead of system (gives you control over environment variables, etc.)
I'm developing a QT application with QTCreator (and QT 4.5.3) on Arch Linux. I'm using KDE 4.3
The project is basically a GUI that let you insert a url and make some web requests to give the user some data back.
The web requests are asynchronous.
I've encountered a weird problem.
If I start the application the first time and click on the button that launches the web requests, it crashes.
On the second time it works as expected.
The third and the fourth time it returns just one of the 900 values I was expecting.
What's strange is that on Windows (and QT 4.6) is working always fine..
Have you ever seen such a thing?
Thanks in advance for your information
Best regards
I've never seen anything exactly like this, but I have seen different behaviours between Linux and Windows where the Windows code seemed to work. In my experience, the code is almost always wrong - it's just much easier to catch it when you run in Linux.
I have two suggestions to make:
run with Valgrind: this will catch the obvious flaws
link with the Qt debug libs (usually QtCored.so, QtGuid.so on Linux)
And a third: look very carefully at the web requests responses in Linux / Windows, possibly in a diff-scanner. Any differences might point you in the right direction
I'd say that has something to do with cookies.
Try to create the smallest possible application that reproduces that bug and then try to determine, if it's your or Trolltech's code that crashes.
The problem was related to an array of elements which weren't set in time