Important: Please read the Qt Code of Conduct -

Creating editable UI and linking it with C/C++ library fucntions

  • Hi All,

    I want to create a UI, through which the user can add nodes and link them by drawing lines thus creating a tree. Once user is done with drawing the tree, I should be able to use the data for my computation. User should be able to delete any nodes at a later point too.
    For eg:

    1. After drawing tree, the data could be saved in file with adjacent node info format.
    2. When user clicks "Find Shortest Path" in the gui my algorithm can compute it from the saved data.
    3. The Algorithm function then saves the Shortest Path info which could be picked up by the UI to display it.

    This is just an example,I can also write a wrapper over my library as the interface between GUI and library.
    I want to write my algorithms in C or C++ and link my library to the GUI for input/Output. The efficiency of my library is paramount and GUI comes second.
    I got a lead that QT is the best way to do this. Right now i am using ubuntu and installed QT3 interface designer. So i just wanted to clarify a few things and get some pointers to where to start before i dig my heels in to QT3.

    1. Can i code my functions in C++ and link them to QT3.
    2. From my requirements can i have suggestions on how to go about doing this.
    3. Is their really a need for a separate C++ library or should i be writing my functions in QT framework only using C++.

    I am totally new to QT so any help is appreciated.


  • Hello,

    for may experience, I can confirm you that QT is the best way to do this. To answer to your three questions:

    1. What I can advice about is that you should consider the option to work with QT 4.x against QT3, because you simplify your work and your life a lot.

    2. To do what you need I think that you can create a physical separation between the graphics and interface and the algorithms and code. All that is related to UI / GUI you can develop with QML (QT-Quick). This declarative language can integrate java functions for a lot of interface management while is exactly created to develop simple editable source (a sort of interpreted high level javascript environment) that uses the strong elements of C++ classes. Your algorithms should be done under C++ and QT Creator already support this integration without problems.

    3. Using this method, another thing that is simplified in your work if the separation you need between algorithms code and user interface. In this context, feel free to create libraries and / or code program only independently by the needs of the User Interface: QT-Quick can work in all the two choices you can do.

Log in to reply