Important: Please read the Qt Code of Conduct -

Dynamic Creating forms

  • Sorry, I'm new at this. I just recently started seriously working on QT. I'm creating an application to monitor several circuits, my first attempt used a form where i can read the voltage of each circuit and display it on the screen. Worked fine. Now the problem is that i may not know how many sensors are connected to the micro controller, I know that i can have the micro controller tell the application the number of sensors, i want to use this number to create the necessary windows to display the voltage of each sensor.
    The main application is constantly checking for data on the com port this data represents the voltages of the sensors on each circuit.
    I understand that i will not get step by step instructions, i just need a little guidance in how to do this and where to get information about doing it.

    Thanks for the help.

  • Updating the thread if anyone is interested.

    Searching the internet i fund the following article [](link url) which describes how to create sub windows on a MDI area. Using that information i was able to dynamically create windows that are within the main window. Now i have to learn how to communicate with the sub windows.

  • @Dan3460 Hi,
    if you mean passing the data I would recommend signals/slots connections.

  • Lifetime Qt Champion

    @Dan3460 Well, you can create as many windows/widgets as you like at runtime. How exactly to do this depends on how you want to present the information to the user. Do you really want to use MDI? This concept as actually outdated.
    If you want to show same type of information then you can simply create a custom widget for it and then create as may instances of it as needed. Then put each instance in a layout and call show().

Log in to reply