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);
Re: AddLine over QGraphicsscene Pixmap
:D
Hey I got solution for it
QPen pen(Qt::blue, 1);
QLineF line(10, 20, 300,300);
scene_LeftArrow->addLine(line,pen);
thats it!!!!
Re: AddLine over QGraphicsscene Pixmap
Can anyone tell me how to set thickness of line?????????
Re: AddLine over QGraphicsscene Pixmap
Code:
QPen pen
(Qt
::blue,
9878346374);
:D
EDIT: It is allways good if one understand his own code...