1

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.

2 Answers 2

2

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.

1

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++.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .