I'm currently trying to create a single window/page Qt application which has many interacting widgets (important to note), however I'm having difficulty finding a good way to structure the project.
As the title implies and is often suggested, I've tried using the "Promote To" feature in QtDesigner, as well as creating new Qt Designer Form classes for each individual widget to modularize and keep the code clean (is this even a good idea?), however there is no good way to use the QObject::connect method in this case that I am aware of, as you must pass both widgets as arguments, which you cannot do with separate designer form classes, unless you include the generated ui_*.h file, or use something such as a singleton/monostate to create a new object and access it that way, if Qt would even jive with that.
The only other option(s) I am aware of with my current knowledge is to make everything a function member of MainWindow, which seems like a terrible idea, or I could discard designer forms altogether and create widgets entirely in code (undesirable, but I will if needed), and instantiate and connect them in MainWindow.cpp, but seems like it will lead to a single monolithic MainWindow file over time.
I find example code of my problem to be difficult to find. Other projects don't seem to have such issues as they are (seemingly) mostly standalone, isolated widgets. In the end I'm leaning towards the latter option of foregoing the ui files and instantiating & connecting most of the widgets in MainWindow.cpp, but I'm not sure if this is the best solution. Here is a basic flowgraph of my problem: https://albumizr.com/a/a35j
Aucun commentaire:
Enregistrer un commentaire