Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Qt have a C interface?

Tags:

c

qt

I've found conflicting answers on the web - some say it does, some say it doesn't. I was unable to find any details in the official Qt documentation either. So does Qt have C bindings or not?

like image 272
Ree Avatar asked Nov 13 '09 10:11

Ree


People also ask

What is a Qt interface?

Qt is a cross-platform application and graphical user interface (GUI) framework, a toolkit, that is used for developing software that can be run on different hardware platforms and operating systems.

Does Qt work with C++?

Qt Creator is yet another IDE for C++, but it is very well suited for coding Qt applications. It provides a doc browser and the "designer", which makes creation of windows easier, all wrapped in a well-designed user interface. It's also one of the fastest IDE's available.

Is Qt GUI?

Qt is used for developing graphical user interfaces (GUIs) and multi-platform applications that run on all major desktop platforms and most mobile or embedded platforms. Most GUI programs created with Qt have a native-looking interface, in which case Qt is classified as a widget toolkit.

How does Qt GUI work?

A GUI framework like Qt generally works by taking the existing OS's primitive objects (windows, fonts, bitmaps, etc), wrapping them in more platform-neutral and less clunky classes/structures/handles, and giving you the functionality you'll need to manipulate them.


2 Answers

Short answer: no.

If you need a comprehensive GUI toolkit for C, you can use GTK+.

To use Qt, you must have a C++ compiler. But it doesn't mean that your "application logic" can't be written in C, compiled with a C compiler and carefully linked to the C++ part (the GUI with Qt). This application logic can be generic, linkable into other executables (pure-C, mixed C/C++, etc.) It all depends on what you need.

Qt is great for C++, though, and it's a good reason to decide using C++ for a particular project, even if you still want to keep parts in C.

like image 177
Eli Bendersky Avatar answered Oct 22 '22 06:10

Eli Bendersky


Unfortunately not, but you may shape your program as set of libraries achiving your business logic and write them in C, then you can use a little C++ to bind what you wrote as library with a GUI using QT.

This is a good approach also because later you can reuse your library and implement many other front-ends with different toolkits or languages!

like image 41
Dacav Avatar answered Oct 22 '22 06:10

Dacav