![]() |
Maemo 5 APIs with Qt
How can I use glib libs like liblocation from Qt app?
I want to write applications using the liblocation using Qt.But I do not know how it will work with the GLib to Qt type casting. |
Re: Maemo 5 APIs with Qt
You can't directly convert GLib and Qt types. You would need to convert a GString to a char pointer, and pass it to QString's constructor, for example, but as far as I know there's also no easy way to do this via GTK's API (other than g_string_free(), which looks dangerous and inefficient for these purposes), so you'd have to go digging in GString's struct for the right member.
[edit: this was just an example, not an exhaustive tutorial] |
Re: Maemo 5 APIs with Qt
Check the PDF in this page: http://wiki.forum.nokia.com/index.ph...velopers_Guide
Chapter 5.1: Using Maemo APIs in Qt applications - Liblocation The example that comes there is with Gtk though (weird thing being Qt documentation). |
Re: Maemo 5 APIs with Qt
This looks useful, though I'm a bit confused why they've written a Gtk example application using liblocation in a "Qt for Maemo" howto.
Seems kind of strange... |
Re: Maemo 5 APIs with Qt
Quote:
|
Re: Maemo 5 APIs with Qt
I'm not sure what you mean.
If you mean that Qt doesn't store/accept scalar types, well, they do in a lot of places (or indirectly, via e.g. QString constructor overloads), and it is also possible to extract those types using things like QString::toLatin1() |
Re: Maemo 5 APIs with Qt
Quote:
|
Re: Maemo 5 APIs with Qt
Quote:
My Qt application run qt events loop and it seems that for liblocation to work properly it needs a running gtk events loop. If I use liblocation without gtk events loop started the location_gpsd_control_start function never returns. And callbacks are never called. Is there somework around to this? Writting pure gtk application works fine (Using Location API). Please correct me if I am missing something very obvious. |
Re: Maemo 5 APIs with Qt
|
Re: Maemo 5 APIs with Qt
Quote:
I have grep'ed your code for g_ (glib function) several times and it seems you don't start any gtk event loops (I have read you code from begginging to and few times also :D). As far as I understand you just register "changed" callback. And call location_gpsd_control_start on the button click event. In my application the location_gpsd_control_start function call is triggered by http request finished event. The only difference I see between yours and mine applications is that yours uses GUI. Is there any special trick that you do for liblocation to work? I think I am missing something really obvious. Any help would be really appreciated. I am sorry to bother you, but would it be possible to discuss it with you via IM? P.S. I have written you an email with a bit longer description of my problem. |
| All times are GMT. The time now is 00:45. |
vBulletin® Version 3.8.8