Solved QGraphicsView is embedded into the QGraphicsView,QGraphicsItem incomplete
-
I have a QGraphicsView embedded into the QGraphicsView view via the QGraphicsProxyWidget, and the QGraphicsItem displayed on the embedded QGraphicsView is incomplete. Is there any way to display the scene content of embedded QGraphicsView properly?
-
Hi
By incomplete - you mean not all of the inner QGraphicsView is visible ?
Or that the QGraphicsView is smaller than it should be ?
Im wondering if you need to use
http://doc.qt.io/qt-5/qgraphicsview.html#fitInView -
@mrjj
Thank you .
I don't think I have expressed it clearly. Still come to a picture to explain.
What caused this? Is it related to the transform of QGraphicsProxyWidget? -
Hi
Super with pictures.
So its not drawn at all it seems.
and you are sure its located as shown on second image ?
I mean, it has that size etc?the purple rect is a normal QGraphicsRectItem ?
Im not 100% sure that QGraphicsProxyWidget can handle a QGraphicsView due the event
and coordinates propagation/handling.
On the other hand, it is a Widget so no apparent reason why not.ps. btw, welcome to the forums :)
-
@mrjj
Hi
Thanks for your helpI am sure its were created and size are correct.
yes, the purple rect is a normal QGraphicsRectItem.I find QGraphicsProxyWidget pos is (0,0) ,
All item and widget under QGraphicsView can be displayed.
But I still don't know why.
maybe the transform of QGraphicsProxyWidget causes the render area of the item to be incorrect.ps. I am very happy to join the forums.
-
@wangcj
I also suspect the coordinates mapping might be incorrect for the nested QGraphicsView .
In theory it should work but seems not from your actual code.
The docs
http://doc.qt.io/qt-5/graphicsview.html
says
" You can even embed a new QGraphicsView into your scene to provide complex nested scenes."so it sounds like it should work. :)
What Qt version are you using ?
-
@mrjj
The Qt version I use is Qt5.6.1. -
Would it be possible to test if it works in Qt5.11?
else i think you found a bug. -
@mrjj
You are right,It works normally in Qt5.11.
thank you very much for your help. :)