Results 1 to 5 of 5

Thread: Unset raster data pointer in QwtPlotSpectrogram without deleting it?

Hybrid View

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

    Default Re: Unset raster data pointer in QwtPlotSpectrogram without deleting it?

    QwtMatrixRasterData is a bridge between plot item and the real data, that is here stored as a QVector. What is the reason for keeping a copy such a bridge in your code ?

    Note that QVector is implicitly shared - like all Qt containers. So you can fill a QVector in your class and copy it then to the raster data object easily without any overhead.

    Uwe

  2. #2
    Join Date
    Mar 2013
    Posts
    19
    Qt products
    Qt5
    Platforms
    Unix/X11
    Thanks
    1

    Default Re: Unset raster data pointer in QwtPlotSpectrogram without deleting it?

    Thank Uwe,
    this is finally what I have done. I removed the QwtMatrixRasterData object from my IO class. I still have the QVector handled by this class.

    Since the QVector content can change (user move somewhere else to see another slice, for instance in depth) do I have to call following code each time QVector is updated?
    Qt Code:
    1. QwtMatrixRasterData* raster=dynamic_cast<QwtMatrixRasterData*>(spectro_seismic->data());
    2. raster->setValueMatrix(seismic->data(),seismic->nx());
    To copy to clipboard, switch view to plain text mode 

    I tried without but the updated content was not ploted.

    Thank again.

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

    Default Re: Unset raster data pointer in QwtPlotSpectrogram without deleting it?

    You are changing the data behind the back of the item - what means that its internal caches ( see QwtPlotRasterItem::invalidateCache() ) are not invalidated. Better create a new QwtMatrixRasterData object each time you are updating the value to avoid having to deal with them.

    Of course you also need to have a final replot to rebuild the plot.

    Uwe

  4. #4
    Join Date
    Mar 2013
    Posts
    19
    Qt products
    Qt5
    Platforms
    Unix/X11
    Thanks
    1

    Default Re: Unset raster data pointer in QwtPlotSpectrogram without deleting it?

    Ok,
    thanks for all.

Similar Threads

  1. Replies: 8
    Last Post: 17th November 2025, 17:09
  2. Replies: 2
    Last Post: 29th July 2012, 20:09
  3. Replies: 2
    Last Post: 17th October 2011, 00:25
  4. deleting invalid pointer
    By hollowhead in forum General Programming
    Replies: 11
    Last Post: 30th April 2010, 11:47
  5. deleting internal pointer in QModelIndex
    By rickbsgu in forum Qt Programming
    Replies: 18
    Last Post: 24th December 2008, 03:24

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.