Results 1 to 2 of 2

Thread: QGraphicsView

  1. #1
    Join Date
    Jul 2007
    Posts
    166
    Thanks
    25
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QGraphicsView

    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));

    }

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QGraphicsView

    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
    Last edited by marcel; 26th July 2007 at 09:08.

Similar Threads

  1. Speed, transparency, and drop issues with QGraphicsView
    By jefferai in forum Qt Programming
    Replies: 16
    Last Post: 30th June 2007, 17:14
  2. no image displayed on QGraphicsView
    By sincnarf in forum Qt Programming
    Replies: 9
    Last Post: 28th June 2007, 13:33
  3. QGraphicsView and item focus
    By Micawber in forum Qt Programming
    Replies: 3
    Last Post: 22nd June 2007, 21:36
  4. QGraphicsScene and QGraphicsView
    By rossd in forum Qt Programming
    Replies: 2
    Last Post: 25th April 2007, 15:43
  5. Using QGraphicsView with model/view programming
    By JLP in forum Qt Programming
    Replies: 3
    Last Post: 29th January 2007, 12:04

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.