Results 1 to 7 of 7

Thread: Refreshing a Custom QwtScaleDraw

Hybrid View

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

    Default Re: Refreshing a Custom QwtScaleDraw

    Qt Code:
    1. TimeScaleDraw* scaleDraw = dynamic_cast<TimeScaleDraw*>( plot->axisScaleDraw( ... ) );
    2. scaleDraw->start();
    3. scaleDraw->invalidateCache();
    4. plot->replot();
    To copy to clipboard, switch view to plain text mode 
    HTH,
    Uwe

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

    grantbj74 (19th March 2012)

  3. #2
    Join Date
    Aug 2009
    Location
    Brisbane, Australia
    Posts
    75
    Thanks
    18
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Refreshing a Custom QwtScaleDraw

    The scaleDraw->invalidateCache() gives a protected error when compiling.

    If I put invalidateCache() inside a new function that changes appearance in TimeScaleDraw class: eg ms, sec, clock etc it changes straight away.

    However if invalidateCache() is put in the end of start() time still doesn't update until the plot starts moving etc. I guess this isn't too much of an issue.

    I just use the following for time atm:
    Qt Code:
    1. QwtText TimeScaleDraw::label(double /*v*/) const
    2. {
    3. return m_base_time.toString("H:mm:ss.zzz");
    4. }
    To copy to clipboard, switch view to plain text mode 

  4. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,321
    Thanks
    316
    Thanked 871 Times in 858 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Refreshing a Custom QwtScaleDraw

    The call to invalidateCache() won't cause a replot on its own, it is just a method to ensure that the labels are recalculated the next time there -is- a replot. So after you construct your TimeScaleDraw class, call replot() from where ever you are in the code.

  5. #4
    Join Date
    Aug 2009
    Location
    Brisbane, Australia
    Posts
    75
    Thanks
    18
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Refreshing a Custom QwtScaleDraw

    Yeah I was calling replot() last but made no difference.

Similar Threads

  1. Replies: 1
    Last Post: 13th October 2011, 16:52
  2. Replies: 2
    Last Post: 14th September 2011, 07:53
  3. QwtScaleDraw align label to xaxis
    By kja in forum Qwt
    Replies: 1
    Last Post: 21st November 2010, 19:55
  4. Replies: 1
    Last Post: 14th October 2010, 18:56
  5. Threaded refreshing of a TreeView with custom model
    By CLRS530 in forum Qt Programming
    Replies: 4
    Last Post: 25th August 2009, 08:23

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
  •  
Qt is a trademark of The Qt Company.