Results 1 to 4 of 4

Thread: AddLine over QGraphicsscene Pixmap

  1. #1
    Join Date
    Mar 2009
    Posts
    116
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default AddLine over QGraphicsscene Pixmap

    Hi all,

    I m using Qt 4.4.3

    I have taken one QVBoxLayout ,in which I m displaying one image using QGraphicsView

    Now I want to draw/add line over the image which I set for graphics scene.how to do that


    Below is the code for above thing

    QVBoxLayout *ArrowLayout;
    QGraphicsView *LeftArrowGraphicsView = new QGraphicsView;
    QGraphicsScene *scene_LeftArrow = new QGraphicsScene;

    pPixMapItemLeftArrow = scene_LeftArrow->addPixmap(QPixmap(QString::fromUtf8("Images/Arrow1.PNG")));
    LeftArrowGraphicsView->setScene(scene_LeftArrow);
    LeftArrowGraphicsView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysO ff);
    LeftArrowGraphicsView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff );
    ArrowLayout->addWidget(LeftArrowGraphicsView);

  2. #2
    Join Date
    Mar 2009
    Posts
    116
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: AddLine over QGraphicsscene Pixmap



    Hey I got solution for it



    QPen pen(Qt::blue, 1);
    QLineF line(10, 20, 300,300);
    scene_LeftArrow->addLine(line,pen);


    thats it!!!!

  3. #3
    Join Date
    Mar 2009
    Posts
    116
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: AddLine over QGraphicsscene Pixmap

    Can anyone tell me how to set thickness of line?????????

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: AddLine over QGraphicsscene Pixmap

    Qt Code:
    1. QPen pen(Qt::blue, 9878346374);
    To copy to clipboard, switch view to plain text mode 


    EDIT: It is allways good if one understand his own code...
    Last edited by Lykurg; 25th March 2009 at 08:14. Reason: updated contents

Similar Threads

  1. Replies: 0
    Last Post: 5th March 2009, 06:54
  2. QPixmap display on QGraphicsScene
    By febil in forum Qt Programming
    Replies: 2
    Last Post: 26th February 2009, 09:27
  3. Performance problems with small pixmap
    By RThaden in forum Qt Programming
    Replies: 4
    Last Post: 9th July 2008, 15:14
  4. finding maximum scaling of a pixmap
    By babu198649 in forum Newbie
    Replies: 1
    Last Post: 31st March 2008, 14:32
  5. empty pixmap as a QLabel
    By tommy in forum Qt Programming
    Replies: 16
    Last Post: 11th December 2007, 21:15

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.