To be honest your code doesn't make much sense and is invalid and won't work... Those methods you have to implement are there for a reason, you can't leave them empty.
Why not do it this way?
int main(int argc, char **argv){
view.setScene(scene);
QGraphicsProxyWidget *wgtItem = scene->addWidget(wgt);
wgtItem->setPos(100,100);
txtItem->setPos(200, 300);
view.show();
return app.exec();
}
int main(int argc, char **argv){
QApplication app(argc, argv);
QGraphicsView view;
QGraphicsScene *scene = new QGraphicsScene(&view);
view.setScene(scene);
QWidget *wgt = new QWidget;
QHBoxLayout *l = new QHBoxLayout(wgt);
l->addWidget(new QPushButton("play"));
l->addWidget(new QPushButton("stop"));
QGraphicsProxyWidget *wgtItem = scene->addWidget(wgt);
QGraphicsTextItem *txtItem = scene->addText("salman");
wgtItem->setPos(100,100);
txtItem->setPos(200, 300);
view.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks