I’m teaching myself stuff like the astar algorithm, and working with small-ish matrices. To this end, I want to have a direct way of seeding the matrices I’m sending into the function, and I thought a small app that allowed to do limited-color pixel-by-pixel painting would be great.
Basically this: http://www.youtube.com/watch?v=19h1g22hby8
What is a good widget to use, as both the pixels themselves and the canvas for them? I’m very comfortable with QPushButtons and the like, but I’m not that used to a graphics scene. Is that the way to go?
I’d guess something that has built-in methods for detecting when the mouth is hovering on top, and that changes colors quickly… but that makes it seem like a giant QGridLayout with flat QPushButtons might do the trick and yet it seems way unoptimal.
The QGraphicsView with underlying QGraphicsScene would be perfect for this. I would start by adding a whole bunch of QGraphicsRectItem instances to the QGraphicsScene.
Qt does already does drawing, moving and selection of the QGraphicsRectItem instances. You can catch other events, or change the default handling (for example disabling moving), by overriding mouseMoveEvent() and others.