PDA

View Full Version : scrolling graphicsWidget using mouse



wagmare
18th December 2014, 08:50
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
10823

and and when more item added
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 .

anda_skoa
18th December 2014, 12:33
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,
_

wagmare
19th December 2014, 06:23
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) ..?

anda_skoa
19th December 2014, 08:37
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,
_