1

I have a QGridLayout, that consists of buttons. Then, after pressing another button (which is not in this QGridLayout), all buttons should be removed from this Grid(e.g. there were 20 buttons) and new quantity of buttons should be added (e.g. there will be 40 buttons). Everything is running Ok, but when I close my App, the "APPCRASH" error appears with exclusion code c0000005. I have searched for solution, but with no results. This is the code I use for deleting buttons from Grid:

if (layout) {
        QLayoutItem *item;
        while((item = layout->takeAt(0)) != 0) {
            if (item->widget()) {
                layout->removeWidget(item->widget());
                delete item->widget();
            }
            delete item;
        }
    }

I hope, that you will help me to solve this problem.

0 Answers0