Hi All,


I want to use a QScrollArea as a container of several buttons[or other 
components], and then I need to replace all of these buttons with new(also the 
amount of buttons is different). 
Current, I just  add buttons to the QScrollArea, but can not remove all of them 
and update with new buttons...


    groupBox = new QGroupBox(ui->GCultureDetailedScrollArea);
    groupLayout = new QGridLayout(groupBox);
    groupBox->setLayout(groupLayout);
    groupLayout->setVerticalSpacing(15);
    groupLayout->setHorizontalSpacing(10);


    for(int i = 0; i < 50; i++){
        for(int j = 0; j < 3; j++){
            QString buttonName = QString("button%1").arg(i+1);
            QPushButton *pbutton = new QPushButton(buttonName);
            //pbutton->resize(130, 40);
            pbutton->setMinimumWidth(140);
            pbutton->setMinimumHeight(40);
            pbutton->setStyleSheet("\
                                   QPushButton{\
                                    border-image: 
url(./pictures/button_groupactivities.png);\
                                   }\
                                   QPushButton:pressed {\
                                    border-image: 
url(./pictures/button_groupactivities_clicked.png);\
                                   }\
                                   ");
            groupLayout->addWidget(pbutton, i, j);
        }
    }


So now how can I remove all of buttons in groupLayout and add new ones.


Anyone can give some suggestions?   Thanks in advance!



--

 Best Regards,




_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to