Results 1 to 9 of 9

Thread: how to paint scene point by point

  1. #1
    Join Date
    Aug 2008
    Posts
    11
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Unhappy how to paint scene point by point

    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

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to paint scene point by point

    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

  3. #3
    Join Date
    Aug 2008
    Posts
    11
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: how to paint scene point by point

    Quote Originally Posted by aamer4yu View Post
    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 ^^

  4. #4
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to paint scene point by point

    Can you first explain a bit more what you want to achieve, am sorry, I didnt get it completely

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to paint scene point by point

    Quote Originally Posted by elessaar View Post
    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.

  6. #6
    Join Date
    Aug 2008
    Posts
    11
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: how to paint scene point by point



    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
    Last edited by elessaar; 4th September 2008 at 08:15.

  7. #7
    Join Date
    Aug 2008
    Posts
    11
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: how to paint scene point by point

    Quote Originally Posted by jacek View Post
    If the data changes frequently, you will need a custom graphics item.
    yup my data changes frequently and i need to update charts frequently

  8. #8
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to paint scene point by point

    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

  9. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: how to paint scene point by point

    Quote Originally Posted by elessaar View Post
    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.

Similar Threads

  1. Moving the (0.0) point on the scene
    By maverick_pol in forum Qt Programming
    Replies: 1
    Last Post: 6th September 2007, 15:34

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.