PDA

View Full Version : how to paint scene point by point



elessaar
3rd September 2008, 10:25
since there is no function like addPoint in qgraphicsscene, how can i paint point by point. cus i need to to change V value of HSV according to the data i recieved and i have to paint one point

aamer4yu
3rd September 2008, 10:31
Why are u using graphics scene for drawing points ?
you cud very well use pixmap / label .

Also if u want to use graphicsscene, you can create a graphics item, which draws one point ;)

elessaar
3rd September 2008, 15:35
Why are u using graphics scene for drawing points ?
you cud very well use pixmap / label .

Also if u want to use graphicsscene, you can create a graphics item, which draws one point ;)

a bit more detail plx if possible ^^

aamer4yu
3rd September 2008, 19:31
Can you first explain a bit more what you want to achieve, am sorry, I didnt get it completely :(

jacek
4th September 2008, 01:49
since there is no function like addPoint in qgraphicsscene, how can i paint point by point. cus i need to to change V value of HSV according to the data i recieved and i have to paint one point
If your data doesn't change often, you can paint on QImage or even better, set its pixel colours directly using QImage::setPixel(). Then you can add the image to the scene using QGraphicsPixmapItem.

If the data changes frequently, you will need a custom graphics item.

elessaar
4th September 2008, 07:45
http://www.students.itu.edu.tr/~ozkaner/files/ss.png

on the left side im drawing chart of an array[128]. values assigned and updated with rand()
so it may look weird. this is fort test right now.

on the right side (GPR), i have 128 data again. black labels are big enough to draw 128x128
chart. first 128 data that i recieved is gonna be used to paint the first column of 128x128 area. my main color is gonna be red and values will change it from dark to light (V of HSV).
after 128th draw, all area will be painted and im gonna have an image of surface that im scanning. when i get new data i will shift all columns to left , delete first cloumn and add last column to right
(edit: i have a thread that updates the data. after update it send a signal to refresh charts )

i tried to do it with adding lines but performance was very bad, window was getting frozen.

so now, how can i do it qgraphicsitem or do u have any other suggestion

elessaar
4th September 2008, 07:47
If the data changes frequently, you will need a custom graphics item.

yup my data changes frequently and i need to update charts frequently

aamer4yu
4th September 2008, 10:11
It will be better if u use QLabel for EMI and GPR, and render QImage on it.

I dont see need for using graphics item / scene

jacek
4th September 2008, 21:00
yup my data changes frequently and i need to update charts frequently
If you just have to paint some graphs a custom QWidget might be better. Also take a look at Qwt (http://qwt.sf.net).