I am developing a GUI with Qt5, and in the main window of this GUI, it contains at least 4 tab widgets, and each tab widget will contain serval different child QWidgets, such as QLineEdit, QSpinBox, QLCDnumber, etc. Then when I open the tab, all its child widgets will appear.
Thus, for each tab, I decided to create a QVector(or another container type) to contain its all child Widgets,e.g.:
QVector<QWidget*> wids;
for the first tab widget, if it has the following children:
QLineEdit* line=new QLineEdit(this);
QLCDNumber* lcd=new QLCDNumber(this);
QSpinBox* spn=new QSpinBox(this);
then somehow I would like to do
wids.append(line);
wids.append(lcd);
wids.append(spn);
and next,I want to operate each widget inside the tab,e.g.:
wids[0]->setText("good");
wids[1]->display(1);
wids[2]->setRange(0,10);
I know I need to use dynamic_cast<...>, but I DO NOT KNOW how to do that,is ther anyone could give me some advice?
many thanks!