Help with QList of Groupboxes and Checkboxes
-
I am creating a form with over 100 groupboxes, and inside each of those groupboxes has 6 checkboxes. This is to control some hardware I built. This configuration is really the best option. I have created a QList of checkboxes for each groupbox. Now I would like to incorporate those 100 QLists in to another QList, presumable of groupboxes ie a 2d QList. I have done this and I check the size and it returns with the correct size. Now I am having trouble access each individual checkbox. Below is the code I am using.
//Groups all the checkboxes in to a QList. Eventuall end up with 100 Qlists QList<QCheckBox *> allCheckBox1 = ui->groupBox_1->findChildren<QCheckBox *>(); QList<QCheckBox *> allCheckBox2 = ui->groupBox_2->findChildren<QCheckBox *>(); . .. ... //shortened for brevity //This I believe is making a QList of all the above items. It returns the correct size when //when I call "qDebug()<<mybox.size();" QList<QGroupBox *> mybox = ui->centralWidget->findChildren<QGroupBox *>();
Now my problem is accessing the individual checkboxes to see what state they are at, how do I do this?
I get as far as
mybox.at(i)->
But don't know where to go after that.
Thank you for your time.
-
I am creating a form with over 100 groupboxes, and inside each of those groupboxes has 6 checkboxes. This is to control some hardware I built. This configuration is really the best option. I have created a QList of checkboxes for each groupbox. Now I would like to incorporate those 100 QLists in to another QList, presumable of groupboxes ie a 2d QList. I have done this and I check the size and it returns with the correct size. Now I am having trouble access each individual checkbox. Below is the code I am using.
//Groups all the checkboxes in to a QList. Eventuall end up with 100 Qlists QList<QCheckBox *> allCheckBox1 = ui->groupBox_1->findChildren<QCheckBox *>(); QList<QCheckBox *> allCheckBox2 = ui->groupBox_2->findChildren<QCheckBox *>(); . .. ... //shortened for brevity //This I believe is making a QList of all the above items. It returns the correct size when //when I call "qDebug()<<mybox.size();" QList<QGroupBox *> mybox = ui->centralWidget->findChildren<QGroupBox *>();
Now my problem is accessing the individual checkboxes to see what state they are at, how do I do this?
I get as far as
mybox.at(i)->
But don't know where to go after that.
Thank you for your time.
@bwcal1999 said in Help with QList of Groupboxes and Checkboxes:
->findChildren<QGroupBox *>();
do the same with
QCheckBox*
on the groupbox? -
@bwcal1999 said in Help with QList of Groupboxes and Checkboxes:
->findChildren<QGroupBox *>();
do the same with
QCheckBox*
on the groupbox?@raven-worx
aren’t I? -
@raven-worx
aren’t I?@bwcal1999 said in Help with QList of Groupboxes and Checkboxes:
aren’t I?
you wrote:
@bwcal1999 said in Help with QList of Groupboxes and Checkboxes:
I get as far as
mybox.at(i)->
But don't know where to go after that.
-
@bwcal1999 said in Help with QList of Groupboxes and Checkboxes:
aren’t I?
you wrote:
@bwcal1999 said in Help with QList of Groupboxes and Checkboxes:
I get as far as
mybox.at(i)->
But don't know where to go after that.
-
@bwcal1999
Hi unless the groupbox has a layout assigned
I think checkboxes are just just members of mainwindow. (owned by)
Not inside QGroupBox. IF it has layout, you can ask Layout for them. -
@bwcal1999
Hi unless the groupbox has a layout assigned
I think checkboxes are just just members of mainwindow. (owned by)
Not inside QGroupBox. IF it has layout, you can ask Layout for them. -
@raven-worx
Yes it should, even if in layout as far as i know.
:)