Qt - How to convert from QObject to UI elements?
问题 I am working in Qt 4.7, and I have a QWidget object in my dialog. I need to go through each of the children and extract the current text into a QStringList. Every other object is a QCheckBox, and the rest are QComboBoxes (I would just need the text portion of both). So far the only way I could think of to do this would be to use the children() function to get them as QObject*'s and cast them, like this: QStringList textlist; for(int i = 0; i < ui->myWidget->children().size(); i++) { if(i % 2