Results 1 to 7 of 7

Thread: Avoid Qwt Plot Flickering on updating the QwtPlotMarker dynamically

  1. #1
    Join Date
    Feb 2007
    Posts
    63
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Avoid Qwt Plot Flickering on updating the QwtPlotMarker dynamically

    Hi all,
    I am developing an application in which i have to dynamically update the position of QwtPlotMarker based on the data .
    I have used QwtPlotMarker to draw a vertical line and i am calling following code in the timer function to update the position of the marker.
    Qt Code:
    1. mx->setXvalue(data);replot();
    To copy to clipboard, switch view to plain text mode 
    The position of the vertical line is updated but there is a lot of flickering of the plot which is very annoying.
    Plz tell me how to update position by using setXvalue() without flickering.
    Hope i am clear. I am using qwt version 5.1.1

    Raghav

  2. #2
    Join Date
    Feb 2007
    Posts
    63
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: Avoid Qwt Plot Flickering on updating the QwtPlotMarker dynamically

    w'll i am really appreciating a reply.
    any suggestions?????????????

  3. #3
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,309
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Avoid Qwt Plot Flickering on updating the QwtPlotMarker dynamically

    At least you have to explain what exactly happens ( visually ) , when you write about flickering.

    Uwe

  4. #4
    Join Date
    Feb 2007
    Posts
    63
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: Avoid Qwt Plot Flickering on updating the QwtPlotMarker dynamically

    Ok.
    I modified realtime (qwt) example such that instead of plotting points(default functionality) the program reads and plot some data from the file.
    The program plots the data correctly.
    After this i am moving a qwtmarker (VLine) over the plot by updating its position through a timer function.
    Now as the position of marker is updated the already drawn plot, the grid lines and the marker, all flickers(refreshes) too much. I know that the refreshing (or flickering) is happening due the replot() given in the timer function as posted by me in the previous post.
    But to update the position of marker dynamically i have to give a replot().
    Is this the correct approach???????????
    Is there other method to update the marker without redrawing the plot( by replot())
    Hope i am clear this time.

    Raghav

  5. #5
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,309
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Avoid Qwt Plot Flickering on updating the QwtPlotMarker dynamically

    Quote Originally Posted by raghvendramisra View Post
    I modified realtime (qwt) example such that instead of plotting points(default functionality) the program reads and plot some data from the file.
    The realtime example disables all available backing stores in the state where it is painting data incrementally. With these attribute combination a repaint of the canvas will flicker.

    Better use a plot canvas with its default attribute settings.

    Uwe

  6. #6
    Join Date
    Dec 2012
    Posts
    8
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Avoid Qwt Plot Flickering on updating the QwtPlotMarker dynamically

    I'm aware this thread is rather old, but my question is similiar:
    Is there any way to update QwtPlotMarker position on the screen without replotting? I have a really big plot with loads of points and it leads to long time when replotting, but I wanted to change marker position in real time :/
    I assume I should rewrite paintEvent function in my Plot class, right?

  7. #7
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,309
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Avoid Qwt Plot Flickering on updating the QwtPlotMarker dynamically

    The problem is not about painting the marker - it is about erasing its previous position.

    Your options are:


    • introduce a QPixmap cache for the plot items without the marker, f.e cache all items below a specific z-value ( overload QwtPlot::drawItems() )
    • use a QwtWidgetOverlay like in the itemeditor example ( drag the items to see how it works ).


    The second solution is what you need to do when it is about dragging a marker with the mouse. Guess you could use the code with replacing QwtPlotShapeItem by QwtPlotMarker.

    Uwe

  8. The following user says thank you to Uwe for this useful post:

    dontgonearthecastle (8th January 2013)

Similar Threads

  1. Replies: 3
    Last Post: 11th May 2011, 19:57
  2. Painting / moving in a single step to avoid flickering
    By nooky59 in forum Qt Programming
    Replies: 6
    Last Post: 21st February 2008, 11:33
  3. Replies: 8
    Last Post: 20th September 2007, 10:10
  4. Dynamically updating a qt application
    By dvmorris in forum Qt Programming
    Replies: 2
    Last Post: 9th July 2007, 15:55
  5. how to avoid QCanvasText flickering (Qt336)
    By oob2 in forum Qt Programming
    Replies: 5
    Last Post: 5th September 2006, 20:25

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.