Update QGridLayout ?
Unsolved
General and Desktop
-
I placed the pushbuttons in gridlayout after creating them in Qt. then stored the buttons data's in a sqlite database.
QSqlQuery query; query.prepare("SELECT name FROM table"); query.exec(); int count=0; while(query.next()) { QString s=query.value(0).toString(); array[count]=s; count++; //qDebug()<<s; } int count1=0; const QSize btnSize = QSize(150, 50); for (int i=0;i<15 ;i++ ) { for (int j=0;j<5 ;j++ ) { if(count1==count) break; else { QPushButton *button = new QPushButton(array[count1]); button->setFixedSize(btnSize); button->setObjectName(array[count1]); connect(button, &QPushButton::clicked, this,&MainWindow::cald); ui->gridLayout->addWidget(button,i,j); count1++; } } }
I'm removing a pushbutton from another gridlayout. How do you update a different grid layout?
I tried but , I don't know how, if you know please tell me .Thank you
-
@Ramkumar-Mohan said in Update QGridLayout ?:
I'm removing a pushbutton from another gridlayout.
No you're not, you're adding a
new
ed button.How do you update a different grid layout?
What do you mean? Here you are changing
ui->gridLayout
, obviously if you have another grid layout,ui->gridlayout2
, then use that instead.