Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Beginner in need of guidance



  • Hi all. I'm mainly a C programmer with some C++ as well. I need guidance with integrating QT into my applications. I have an application that polls a data file and populates an internal data structure(array of opjects), and sends any changes that are found between consecutive pollings out the serial port(it also does some other stuff behind the scenes). How do I even begin adding an interface to visualize and possibly change data in that internal data structure? I didn't decide on adding a gui till the application was completed and I don't really want to rewrite from scratch. I have never used QT before so I'm a little lost. Any advice would be greatly appreciated.

    Thanks,
    Michael


  • Moderators

    @Mike105105
    you may want to start with a QSerialPort example.
    File access is handled with QFile. You internal data structure can be anything you like.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Beside the good advice from @raven-worx, how did you implement your file polling ?



  • I have a thread that periodically locks the json file and reads it in with fopen and fread. The data buffer gets decoded using json-c and entered into the data structure. The objects in the data structure keep tabs on whether the data given to them has changed since the last update. Another thread periodically increments through the array of objects and triggers their send update function and if that object has registered a change it transmits out the serial port. The application also writes a json file out with information on the systems network status like IP address. There is also a system config file that gets read to set up which serial port and a few other things.

    I just wish I had thought about a local gui when I started writing everything.

    Thanks,
    Michael


Log in to reply