Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Unsolved Beginner in need of guidance

    General and Desktop
    3
    4
    72
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      Mike105105 last edited by

      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

      raven-worx 1 Reply Last reply Reply Quote 0
      • raven-worx
        raven-worx Moderators @Mike105105 last edited by

        @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.

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        1 Reply Last reply Reply Quote 1
        • SGaist
          SGaist Lifetime Qt Champion last edited by

          Hi and welcome to devnet,

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

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply Reply Quote 0
          • M
            Mike105105 last edited by Mike105105

            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

            1 Reply Last reply Reply Quote 0
            • First post
              Last post