PDA

View Full Version : QGraphicsView



sabeesh
26th July 2007, 07:39
Hi,
I am using QT 4.2.2. I add a QGraphicsView in my main window using the following code. When i run my program, then the QGraphicsView display in my mainwindow at the particular location. I need to draw a line in this QGraphicsView. How can I do this? Please help me.

MainWindow::MainWindow {

QGraphicsView *view = new QGraphicsView(this);
view->setGeometry(QRect(410, 40, 141, 511));

}

marcel
26th July 2007, 08:00
You also have to add set a scene to the view.
Then you can use QGraphicsLineItem to draw a line in the scene.

Search the forums for QGraphicsView. There are a lot of examples.
Also check the Qt Demos and read about the Graphics View Framework in the Assistant( or the online docs). You can learn a lot from there and you shouldn't start doing any drawin until you have read those.

Regards