How to Add Multiple QPushButton to QGraphicsScene and Set Scene to QGraphics View in QT ?
I want to Add 5 buttons to Graphics Scene but it adds only one button.
int i = 5 ;
btnuser = new QPushButton();
btnuser->setGeometry(QRect(0,0,480,47));
scene = new QGraphicsScene(0,0,480,272);
btnuser->setText("Test User");
for(i = 0 ; i < 5 ; i++ )
{
QGraphicsProxyWidget *proxy = scene->addWidget(btnuser);
}
ui->graphicsView->setScene(scene);
Thanks.
You’ll have to create 5 buttons then:
The proxy pattern acts just as an “interface”.