[Qt-interest] object based image editor? QGraphicsView? Or QLabel?Or QWidget?

Ross Bencina rossb-lists at audiomulch.com
Sat Apr 10 16:54:57 CEST 2010


> What's the best QWidgets to use for an image editor?  Sort of like 
> mspaint, but with a greater emphasize on objects.  For example, you can 
> load an existing png / bmp.  And you can draw objects, such as rectangles. 
> The rectangles are objects that you can select, resize, delete, move, 
> maybe change colors, etc.
>
> Is the Qt Graphics View the right thing for this?

I would say so yes.


> Rather than, for example, starting from just a simple QLabel or QWidget?

You could do that, but then you'd have to implement something like 
QGraphicsView. There might be an argument for that, but based on what you've 
described I don't think so.


> Or something else entirely?

You could perhaps look into some other non-Qt 2d scene graph frameworks and 
embed them in Qt (sorry not suggestions other than that I know they're out 
there).


I think you'll be fine with QGraphicsView. Take a look at the QGraphicsView 
examples. There's a simple diagram editor there which does some of what you 
want to do.

Another hint: don't depend on Qt's QGraphicsItem subclasses working the way 
you want (they might, they might not). I ended up writing a lot of my own 
custom QGraphicsItem subclasses -- don't worry, it's easy.

Ross. 




More information about the Qt-interest-old mailing list