3 ms·
Its a config menu that's in part generated from a config file, and part pre-made in a .UI file. I don't control the config, and it can add or remove options. I
by devwastaken 8y ago
Its a config menu that's in part generated from a config file, and part pre-made in a .UI file. I don't control the config, and it can add or remove options. I premake widgets for known options, but still generate widgets for any options that aren't covered by pre made ones.
To keep things far simpler, the .UI file is meant to be the one that defines the premade widgets, and have properties on them. How UI seems to be usually done in QT is uic generates a header and the object names become members that can be used directly. Then all those members are used directly, and become hard coded.
In this circumstance though, I don't want to hard code in every widget, that way if new options are added, they can be updated in the .ui file and not require recompilation and more hard coding of widgets.
Problem is, you can't do qwidget->find, get the head widget, then get a list of the widgets actual child type. What I've read and have asked others on, you gotta qobject_cast until it sticks. C++ can't get types at runtime and then cast them, it has to know what to do at compile time. Hence having to write out every type and cast it.