[Qt-interest] painting on graphicsviews in real time
caius ligarius
caius9090 at gmail.com
Wed Jun 9 18:37:27 CEST 2010
I thought as much. Yes I don't have much experience, I will look at the
examples again. Let me know if you think there is particular example which
is close to what I am trying to do.
Thanks,
Caius
On Tue, Jun 8, 2010 at 11:58 PM, Mihail Naydenov <mlists at ymail.com> wrote:
> You was given general directions already, but I it is assumed you have some
> knowledge about the topic.
>
> I suggest you give it a break for few days, and study both the samples
> and the docs related to The Graphics View Framework.
> Its really not hard at all, and you will get broader understanding of the
> topic, because right now its evident you dont have much experience .
> (For instance in DisplayImage I dont see a reason to addItem and to
> setScene every time) Just study the samples to see how its done.
>
> thumbs up
> MihailNaydenov
>
> >
> >From: caius ligarius <caius9090 at gmail.com>
> >To: Qt Interest <qt-interest at trolltech.com>
> >Sent: Wed, June 9, 2010 3:57:48 AM
> >Subject: [Qt-interest] painting on graphicsviews in real time
> >
> >>I am still struggling to find a solution to my problem. I basically have
> a QGraphicsView widget which displays a QImage. I call a "Process" function
> when a button is pressed. This function basically calculates some line
> co-ordinates w.r.t to the QImage which I would like to draw on the viewport
> in real time.
> >
> >Pseudo code below to display QImage-
> >
> >void Class:: DisplayImage(QImage* currImg)
> >{
> > QPixmap np =
> >QPixmap::fromImage(*currImg);
> > graphicpixmapitem->setPixmap(np); //QGraphicPixmapItem Class
> >
> >
> >graphicsscene->setSceneRect(0, 0, currImg->width(),
> >currImg->height()); //QGraphicsSceneClass
> > graphicsscene->addItem(graphicitemSingleView);
> >
> >
> > ui.graphicsView->setScene(graphicssceneSingleView);//QGraphicsView Class
> >> ui.graphicsView->show();
> >}
> >
> >
> >void Class:: Process()
> >{
> > QLine line1(x,x,x,x)
> > <draw line1 on viewport>
> >....
> >....
> >....
> > QLine line2(x,x,x,x)
> >> <draw line2 on viewport>
> >....
> >....
> >...cont....
> >}
> >
> >Can somebody give me an example on how to go about implementing this? I am
> assuming I should be able to paint on the viewport and update it relatively
> quickly with minimal delay. I guess I need to use QPainter somewhere but I
> am confused about where to implement and call it so that the viewport is
> updated with the new line.If possible please send me some sample pseudo
> code.
> >
> >Thanks,
> >Caius
> >
> >
> >
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100609/c816d693/attachment.html
More information about the Qt-interest-old
mailing list