2 Attachment(s)
scrolling graphicsWidget using mouse
hi friends,expert,
im adding QGraphicsLayoutItem in a QGraphicsWidget in run time using QGraphicsLinearLayout.
i have to add more items to the layout that exceeds the height of the viewport height and items shown outside the viewport area.so is it possible to pan or scroll in QGraphicsWidget like QGraphicsView. QGraphicsView i can pan using centerOn and showing only a visible rect.
the normal view
Attachment 10823
and and when more item added
Attachment 10824
i have done panning in qgraphicsview using centerOn and visibleViewport but how i can do for the QGraphicsWidget and show only a certain part of the QGraphicsWidget having layout items added in vertical layout .
how to show only a visible region or rect of QGraphicsItem
please help me
thanks in advance .
Re: scrolling graphicsWidget using mouse
You could put it into a "viewport" item and make that item clip to its shape.
Then implement mouse handling in that viewport item to move the child/content accordingly
Cheers,
_
Re: scrolling graphicsWidget using mouse
you mean to say . create a qgraphicsitem and add the graphicsWidget with layout item as a child and clip the rect of the parent item to the required rect and add to the scene .?
it is a very good idea thanks .
but one more doubt .. how i can scroll in the qgraphicsitem (parent) ..?
Re: scrolling graphicsWidget using mouse
Quote:
Originally Posted by
wagmare
but one more doubt .. how i can scroll in the qgraphicsitem (parent) ..?
By moving the child. Its position is relative to the parent and the parent clips.
Cheers,
_