Two Ways to create QGraphicsProxyWidget

The QGraphicsProxyWidget class provides a proxy layer for embedding a QWidget in a QGraphicsScene. There are two ways to create QGraphicsProxyWidget:

  • use QGraphicsScene::addWidget. Obviously, you need available QGraphicsScene object by hand. See bellow
QGraphicsScene scene;
QGraphicsProxyWidget *proxy = scene.addWidget(groupBox);
  • Use QGraphicsProxyWidge::setWidget. And you can add this QGraphicsProxyWidget to scene afterwards
QGraphicsProxyWidget *proxy = new QGraphicsProxyWidget;

No comments:

Post a Comment