It's fine. Just to confirm something - implement it using Graphics View.
It's fine. Just to confirm something - implement it using Graphics View.
ruakuu (2nd October 2009)
Thanks, yeah, Graphics View is what I had in mind for the first approach:
- Create a canvas widget derived from QWidget
- Define a scene (QGraphicsScene)
- Put the canvas widget in the scene (QGraphicsScene::addWidget())
- Define a View (QGraphicsView) and rotate scene with it
Oh, you mean I can paint(draw) directly in the scene with the mouse or tablet? As far as I know, you could only do that with classes derived from QPaintDevice, you can add items to the scene but not draw directly in it, that is what I readed in the documentation, or am I missing something here?
Unless Im not explaining myself correctly, I want to actually use the mouse or tablet to scketch there.
I was going to make a class derived from QWidget (also using QImage for loading images), to make me a drawing canvas Widget, then put that in the scene and rotate it with a view. I saw this canvas approach in the Scribble and Tablet examples that comes with Qt. Both make a canvas that derives from QWidget.
I want to make something like the little japanese program called Opencanvas.
Last edited by ruakuu; 2nd October 2009 at 18:25.
You can add your scribbling as items to the scene. You'd have to do it when subclassing QWidget too, just without any dedicated infrastructure.
And how would your paintEvent() for the widget look like?I was going to make a class derived from QWidget (also using QImage for loading images), to make me a drawing canvas Widget, then put that in the scene and rotate it with a view. I saw this canvas approach in the Scribble and Tablet examples that comes with Qt.
For now it will look like this:
Qt Code:
{ }To copy to clipboard, switch view to plain text mode
After looking at the Pencil animation software I will implement a better aproach, since this is going to be an animation software too.
Rather than use graphic views Im just us a QMatrix on the widget to do the transforms and a combination QPixmap and QImage for the temp image storing. All this because of performance.
And how do you create the image? So far your widget is equivalent to QGraphicsPixmapItem. What about providing undo/redo functionality?
Bookmarks