PDA

View Full Version : How Coulld I create a Grid Layout on a QGraphicsScene



c_srikanth1984
10th January 2009, 05:47
Hi,
I am Planning to develop an application, where i want to place custom QGraphicsItems on that scene and save it, till here i am succeeded. Now I want to Place those items on a matrix like veiw like rows and columns and retrive those items on scene using their row and column number, for this what class i need to use. or can i place a grid layout kind of thing on a scene.
thank u,
with regards,
srikanth

wysota
10th January 2009, 09:47
If these are regular items, you have to position them yourself by reacting on changes in scene/view dimensions. If they are graphics widgets items then there is a layout class for them available.

c_srikanth1984
12th January 2009, 06:33
hi,
First of all thanks for replying, ya they r normal QGraphicItems, I am finding difficulties to create a row&column like structure on a scene so that when a user bring his pointer in a particular cell i should able to highlight that cell so that the user can place his item in that particular cell.
Plz suggest me the method to follow.
with regards,
srikanth

jpn
12th January 2009, 11:18
How about changing the base class as QGraphicsWidget? If they are custom graphics items in the sense that you're not using various built-in types like QGraphicsRectItem, QGraphicsPixmapItem etc. but they're direct subclasses of QGraphicsItem, it's only a matter of changing the base class type. Then you could easily start using QGraphicsGridLayout.