qgraphicswidget

Readjust the Custom QGraphicsWIdget's size on inserting widget

主宰稳场 提交于 2021-01-29 11:11:53
问题 I have created a custom QGraphicsWidget with the ability to resize the widget in the scene. I can also add predefined widgets such as buttons, labels, etc. to my custom widget. I now have two problems. The first being that the widget doesn't change the size (to re-adjust) upon inserting a new label or LineEdit widget as a result newly inserted widget stays out of the custom widget border. The second problem is encountered when I try to change the setContentMargins of the QGraphicsLayout to

Why is the selection border of a QGraphicsWidget not visible in QGraphicsScene?

为君一笑 提交于 2019-12-24 01:29:07
问题 I have added a widget to a graphic scene (QGraphicScene) through a QGraphicsProxyWidget . The problem is that when I select the item it's selected, but the selection border is not visible. Here is the code: QDial *dial= new QDial(); // Widget dial->setGeometry(3,3,100,100);// setting offset for graphicswidget and widget QGraphicsWidget *ParentWidget = new QGraphicsWidget();// created to move and select on scene ParentWidget->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem: