Including Qt into C program??



  • Hello,

    i need to write an c program. i'm writing an plugin and for some reason the interface is given in c and i'm not sure if there is a away to write it in c++ instead.

    So the point is, i'd like to use the Qt library (some simple widgets, mainly qlabel), but it does not work with my c code.

    Any ideas about that??

    Or maybe you know an other solution. I mean give a problem to 2 programmer and you'll get 10 solutions right?

    I'm working on an plugin for Teamspeak 3. It's a overlay that displays you who is talking and the chat messages,... maybe some more stuff later.

    So my idea:
    QLabel transparent background over the whole screen, make it display on the top always (i made something like that with an window once)
    And everytime someone talks, print the name (depending on the settings from the user left/right/top/down alignment) and if he stops, remove the name.

    simple right?? But the problem is, it is not that simple XD

    I have an alternative idea, but don't know how to realize that.

    write and c++ qt program that you can pass text to and then the text will be printed/removed.
    But i don't know how to make the communication between the qt program and my plugin. So if you know how i can pass data from my plugin running on TS3 to my qt c++ program it would be fine, too.


  • Moderators

    @QT-static-prgm Qt is written in C++ - you cannot use it in pure C.
    But since C is (more or less) a subset of C++ you can use this C interface easily in your C++ Qt app. So, no need to overcomplicate things :-)



  • @jsulm yeah i got it working :D i just changed the file name ending to c++ and the plugin interface automatically switched to something that inserts the C parts into c++ :D


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.