[SOLVED]List of QWidgets * and knowing what is what
-
Hi!
I have a few code design problems.
I Have a list (QList) of widgets (QWidget *), where I've stored all widgets ( QComboBox, QLinedEdit ...) that go on a dialog whenever is called. Adding and showing them on a layout it's not a problem. But I'm stuck when I try to get data out of it. In Qt Docs I haven't found any methods provided for storing data.Does Qt provide any way to do this, without packing another variable for class type and then switch-ing or if-ing through class types and then casting?
Regards,
Jake -
Use "metaObject()":http://doc.qt.digia.com/qt/qobject.html#metaObject
LE: better tell us what are you trying to achieve and maybe someone will give a better idea.
-
Thanks!
That's part of a problem solved :) .
No I only have to get data inputed by user out.I'm trying to dynamically built forms based on XML data (done). That dialog is then shown when user double clicks on graphics item (done). When it closes it, data from widgets must processed.
It stops when I have to get data out of QWidget.
With metaObject() it's now easy to use a bunch of ifs, but if I add another widget, I need to fix code at few other places as well. -
Look further trough "QMetaObject documentation":http://doc.qt.digia.com/qt/qmetaobject.html //see "invokeMethod":http://doc.qt.digia.com/qt/qmetaobject.html#invokeMethod