Results 1 to 1 of 1

Thread: free hand draw in qgraphicsview

  1. #1
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default free hand draw in qgraphicsview

    I have gone through the scribble example for how to draw free form . i want the same free form draw using QGraphicsitem on qgraphicsview. i should draw it as a graphicsitem as i can move the selected free form every where in the scene. i tried this

    Qt Code:
    1. DrawnPathItem = this->scene()->addPath(QPainterPath());
    2. void view::drawLineTo(const QPointF &startPoint, const QPointF &endPoint)
    3. liner.setLine( QLineF(startPoint, endPoint) );
    4. liner.setPen(QPen(Qt::red));
    5.  
    6. QPainterPath path = DrawnPathItem->path();
    7. path.setFillRule(Qt::WindingFill);
    8. path.addPath( liner.shape() );
    9. path = path.simplified();
    10.  
    11. DrawnPathItem->setPath(path);
    To copy to clipboard, switch view to plain text mode 
    i dont know how to draw as a item on scene .. please help me
    Last edited by wagmare; 22nd November 2013 at 06:07.
    "Behind every great fortune lies a crime" - Balzac

Similar Threads

  1. Replies: 1
    Last Post: 9th October 2012, 12:32
  2. Draw Line: QGraphicsView
    By vinaykusta in forum Qt Programming
    Replies: 5
    Last Post: 4th January 2012, 17:04
  3. QGraphicsView Draw Foreground
    By augusbas in forum Qt Programming
    Replies: 4
    Last Post: 22nd June 2011, 13:01
  4. Replies: 6
    Last Post: 20th January 2011, 01:47
  5. how to draw lines on image using QGraphicsView in Qt4
    By madhavilatha in forum What's New in Qt 4.4
    Replies: 1
    Last Post: 25th July 2008, 00:32

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.