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

Can i have multiple Qdialog boxes along with my Mainwindow in my application ??



  • i have a QListwidget in my UI , The items of these are foods like
    Pizza
    Turkish Delight
    Pasta
    Cake
    ...
    ...
    i have 22 of items like these

    So when ever i double click on each item, i have a separate modal QDialogbox pop-up which shows its recipe and the QDialog box also takes input with the help of few line edits.

    So my question is that having 22 separate QDialogboxes is okay ?Any downsides to this ? or can i do anything better as an alternative , because for each dialog box, i also have a .h and .cpp file also.



  • @Mr-Workalot
    Although it's possible to have 22 separate dialogs, is there not enough commonality in whatever you are showing on them to have a single, generic dialog and set variables/widgets to control the individual detail of what they display?


  • Lifetime Qt Champion

    Hi
    The downside of having 22 dialogs is all the .cpp and .h you get and also adding new features, say you want to have an image of the
    dish at some later point you would have to add this 22 places.

    For your use case, it sounds like data driver would be much better.
    Meaning you have just one dialog and then based on the data structure where you keep the information about
    the recipes, you add the needed EditLines at runtime.

    SO as @JonB asks, are they that special each of the dishes that you cant handle them very much the same?