C++ (Qt)#include <QApplication>#include <QGraphicsView>#include <QGraphicsScene>#include <QGraphicsProxyWidget>#include <QPushButton> int main(int argc, char *argv[]) { QApplication app(argc, argv); QGraphicsScene *scene = new QGraphicsScene(); QGraphicsView *view = new QGraphicsView(); view->setDragMode(QGraphicsView::ScrollHandDrag); view->setRenderHint(QPainter::Antialiasing, true); view->setSceneRect(-200, -200, 400, 400); view->setScene(scene); view->show(); QPushButton *button = new QPushButton("TEST BUTTON", NULL); QObject::connect(button, SIGNAL(clicked()), scene, SLOT(clear())); QGraphicsProxyWidget *gWidget = scene->addWidget(button); scene->setSceneRect(scene->itemsBoundingRect()); return app.exec();}
QList<QGraphicsItem *> items () const// и в цикле по списку QGraphicsScene::removeItem ( QGraphicsItem * item )deleteitem