Results 1 to 2 of 2

Thread: Qwt Plot Picker as position indicator

  1. #1
    Join Date
    Aug 2012
    Posts
    5
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Qwt Plot Picker as position indicator

    Hi everyone!
    I use qwt plot in my project showing audio waveform. I need a qwt plot picker now to represent the current playback position. But I dont know how to set the value of a picker because AFAIK it responds to mouse movement or selecting polygons and stuff. All I want is a vertical line representing the current playback position but the QwtPlotMarker is not good for this because it uses replot() and in bigger files there are too many replots. QwtPlotPicker doesnt use replot I think. So this is maybe the solution but I can't find any code to set the picker's value manually and the bode example shows only the mouse movement tracking but I dont need it at all. I want a vertical line on my plot which doesnt use replot!!! please help me! Thanks in advance!

  2. #2
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,277
    Thanked 871 Times in 819 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qwt Plot Picker as position indicator

    In one of the Qwt support channels I posted once a complete implementation of such a thing ( basically it was a picker with a QwtPickerTrackerMachine, where the append and move calls were set manually instead of being triggered by user input ). Of course this is a hack - but check the archives.

    Today I would recommend to use QwtPlotOverlay from SVN trunk ( copy it to your code when you want to use Qwt 6.0 ):
    Qt Code:
    1. class YourIndicator: public QwtPlotOverlay
    2. {
    3. public:
    4. void setPosition( double x )
    5. {
    6. m_position = x;
    7. updateOverlay();
    8. }
    9.  
    10. virtual void drawOverlay( QPainter *painter ) const
    11. {
    12. const QwtPlot *plot = dynamic_cast<const QwtPlot *>( parent()->parent() );
    13. const double x = plot->canvasMap( QwtPlot::xBottom ).transform( m_position );
    14.  
    15. painter->setPen( ... );
    16. painter->drawLine( x, 0, x, height() );
    17. }
    18.  
    19. private:
    20. double m_position;
    21. }
    To copy to clipboard, switch view to plain text mode 

    When it is time I will add something like above to the examples.

    HTH,
    Uwe

Similar Threads

  1. PPI (Plan-position Indicator) creation
    By bengone in forum Newbie
    Replies: 1
    Last Post: 29th December 2011, 16:46
  2. Drag and Drop indicator Position
    By whitefurrows in forum Qt Programming
    Replies: 1
    Last Post: 14th July 2011, 11:35
  3. Replies: 1
    Last Post: 24th February 2009, 18:35
  4. Plot Picker x=0
    By sun in forum Qwt
    Replies: 2
    Last Post: 7th October 2008, 07:43
  5. Replies: 0
    Last Post: 27th May 2008, 01:00

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.