qt - How to create resizable cusom widget on the QGraphicsScene -
I study the QGraphics framework and want to create custom resizable widgets. For example I created a proxy widget with QTextEdit
QGraphicsLinearLayout * l = new QGraphicsLinearLayout; QGraphicsProxyWidget * Proxy = New QGraphicsProxyWidget; Proxy-> Setviewjet (new qihestad); Proxy-> Setis policies (QSizePolicy :: favorites, QSizePolicy :: favorites); L-> SetSizePolicy (QSizePolicy :: Favorites, QSizePolicy :: Favorites); L- & gt; Idea eTam (Proxy); QGraphicsWidget * w = new QGraphicsWidget; W-> Setout (l); W-> Setis policies (QSizePolicy :: favorites, QSizePolicy :: favorites); W-> Setflag (QGraphicsItem :: ItemIsMovable); View- & gt; Idea Itam (W); The widget looks okay, but I can not seem to know how much it has the ability to resize. I searched in QT examples and Google but found no examples.
The size of a graphics etc., from which QGraphicsProxyWidget turns out, its range is defined by rectangle. I hope the size of the widget will define the initial size of your proxy widget so that you can try to change the actual widget first.
To change the size of QGraphicsItem, you will need to obtain QGraphicsProxyWidget
Then you will be able to create resize function to change the returned rectangle, but make sure that Call you first.
If you come from QGraphicsProxyWidget and make changes, its size can not be sized or shaped according to the implementation of the attached widget.
I suggest that you are trying to resize the attached widget first.
Also keep in mind that there is a set scalable function for QGraphicsItems, which can be an option here, as well as in the Peptune function, if you get from QGraphicsProxyWidget, then scale the QPainter Are capable of.
Comments
Post a Comment