In my project, I have a QButtonGroup with 256 pushbuttons in it. I also gave each button an id like this:

```
void MainWindow::AddBlocksToGroup()
{
    QButtonGroup* blockGroup = new QButtonGroup(this);
    blockGroup->addButton(ui->Oblock_0, 0);
    ...
    blockGroup->addButton(ui->Oblock_255, 255);
}

```

I am trying to loop through all the buttons in the group and change their text but I keep getting errors when my program reaches the part where I loop through the buttons. This is what I currently have to loop through them:

```
for(int i = 0; i <= 255; i++)
{
    blockGroup->button(i)->setText("Test"); //Read access violation?
}

```

I always get a read access violation in my loop when my program reaches this point. Why is this?

Thanks for your time.