728x90
void clearLayout(QLayout *layout) {
    QLayoutItem *item;
    while((item = layout->takeAt(0))) {
        if (item->layout()) {
            clearLayout(item->layout());
            delete item->layout();
        }
        if (item->widget()) {
           delete item->widget();
        }
        delete item;
    }
}

출처 : https://stackoverflow.com/questions/4857188/clearing-a-layout-in-qt

 

Clearing a Layout in Qt

I'm creating an application in Qt that allows users to drag around various "modules" in a QGraphicsView. Whenever one of these modules is selected, it emits a signal which is then picked up by a "

stackoverflow.com

 

728x90

+ Recent posts