PDA

View Full Version : Put figure in a grid



dreamer
3rd March 2008, 20:09
I'd like to write an application(QMainWindow) where i have some geometric figure on a toolbar that i can drag and drop on central widget.
What kind of widget (or QPaintDevice in general) can i put as central widget?
The central widget may contain a grid(i'd like to riceive the x,y coordinate), where i can move my object(rectangle, square) throw it.

jpn
3rd March 2008, 20:32
Did you see the Drag and Drop Puzzle Example (http://doc.trolltech.com/4.3/draganddrop-puzzle.html)?

niko
3rd March 2008, 20:35
Or you could use QGraphicsView, take a look at Diagram Scene (http://doc.trolltech.com/4.3/graphicsview-diagramscene.html)

dreamer
4th March 2008, 01:33
I looked Qgraphview and Qgraphscene and i'd like to have a simplest kind of widget where i can drag and drop my Rectangolar object.
I also desire a grid:
. . . . . . . . . . . . .
. . . . . . . . . . . . .
. . . . . . . . . . . . .
. . . . . . . . . . . . .
. . . . . . . . . . . . .
. . . . . . . . . . . . .
. . . . . . . . . . . . .
. . . . . . . . . . . . .

where i can move my geometric figure and resize it....(my figure have to follow just the points on the grid.....)
Any idea?

pherthyl
4th March 2008, 04:01
You pretty much described a typical use case for the graphics view framework.

You could do it without graphicsview, but why go to the extra work?