This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How to add Qt GUI project and code in C code in Code Composer studio

Hi,

I need help on following

1) I have one application written C, its a big application and don't want to rewrite. Now I want to add GUI support for that application for functions like Start/Stop/reconfigure same task.

2) Can it possible to share data between such QT and C

Can any one tell me how to add QT project in current C project in Code Composer studio.

Regards,

Dattatray

  • Hi Dattatray,

    Are you running Linux on whatever hardware platform you are using? Qt will allow you to develop GUI appliations within Linux. The best environment to develop a Qt application in is Qt creator. A guide for setting this up to when using the Sitara Linux EZSDK can be found here(http://processors.wiki.ti.com/index.php/Sitara_Linux_Training:_Hands_on_with_QT). It may be advisable to create a new GUI project in this environment and then move the appropriate code into the new project.

    It is also possible to create a Qt project within code composer. You can find information on configuring Qt within Code Composer here (http://processors.wiki.ti.com/index.php/Code_Composer_Studio_v5_Users_Guide#Importing_Qt_Projects). With this method you must code the GUI by hand using the Qt Widget classes rather than with the drag and drop development that is possible with QtCreator.

    If your code can build as a C++ application than there should be no issue integrating it with Qt as Qt is a C++ library.

    Regards,

    Dave

  • Hi Dave, Thanks for reply.

    Yes, I am using Linux on AM335X  with CCS5.3. I already have C project and QT gui created in CCS5.3 and both project are different.

    But I want to init my GUI through main() used in C project and want to share some data between GUI and C project.

    Is this possible or do I need to do other way.

    One more thing I try to add my code in QT project in CCS5.3 but I got some error releated to lib, I think c lib not found.

  • Hello,

    Your best bet will be to start a Qt project and then integrate your existing code into it. You can learn more about Qt here: http://qt-project.org/doc/qt-4.8/. Although Qt is C++ the way programs are set up requires them to be able to process messages received from the various GUI elements, so you will need to keep this in mind when integrating your code. It is possible to set up a timer to execute periodically to run your code or to create a separate thread that runs your code and communicates with the GUI.

    Regards,

    Dave

  • Thanks Dave,

    But my all code is C (no C++) as we have to port over to many type of embedded platform and to keep as close as to machine language.

    Two keep the project simple, the GUI that we want to add has to be part of C project so we can easily switch off or change the GUI code according to os and platform.

    Do have any suggestion?

  • Hello,

    One of the main benefits of Qt is that it is designed to be cross platform, so it may be able to meet your portability needs. My recommendation for Qt moving forward would be to review some of the example applications and get a feel for how Qt applications are written. The general idea is that you set up your GUI and then actions occur based on events whether they are triggered by a timer or GUI event like a button press. One key point is that Qt has an event loop and must be able to process these events regularly in order for the GUI to be responsive so blocking code will cause issues directly in a Qt application. One more recommendation I would make is to review the QThread class and consider entering your code into the thread and allowing portions of it to be triggered by these previously mentioned events so that your code can run however it wants without interfering with GUI responsiveness.

    Regards,

    Dave