Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I've been working on an app in Ubuntu, using C and GTK, I want to switch from GTK to QML, however I can not find anywhere on the internet info on linking QML to C functions, just C++. Is it even possible? And if so, how do I do it?

I already know you can use Javascript and C++, but I'm looking for C. My favourite languages are C and Python and I'd really like to stick with them.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Well, what I'm deciding to do now, after some research on my options, I'm going to just write the GUI in C++, and the rest of my app in C. After looking up how it's done, it doesn't look too difficult to mix C++ and C, the thing is I probably have over a 1000 lines of code in C, rewriting the GTK stuff shouldn't take too long with how streamlined QML is, so the C++ GUI file is going to be pretty minimal. If anyone else is interested this page will show you how to mix C and C++.

share|improve this answer

As far as I know there are no C bindings for QML (I don't think there are C bindings for Qt at all actually). Qt is built in C++ anyway, so you would be better off just going with that, unfortunately. If you are looking to use QML, it may be possible to use Python (writing your back-end in Python and simply using a QML GUI, if it is that kind of application).

Otherwise, your options are rather slim here.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.