Results 1 to 1 of 1

Thread: QwtPlotPicker/ Curvetracker - change Rubberband position

  1. #1
    Join Date
    Jun 2012
    Posts
    8
    Thanks
    3
    Thanked 1 Time in 1 Post

    Lightbulb QwtPlotPicker/ Curvetracker - change Rubberband position

    Hi all,

    I am experiencing a problem when using the Curvetracker-Example to display data of my curve. While modifying the trackertext Function works perfectly for my purposes I do not seem to be able to modify the drawrubberband function properly.
    I simply want to move the V-Line-Rubberband to a position, where the Curve actually has a sample, while the trackerlabel keeps aligned to my Cursor.

    To accomplish that, I modified drawRubberband the following way:
    void CurveTracker::drawRubberBand( QPainter *painter ) const
    {

    const QRect pRect = pickArea().boundingRect().toRect();

    QwtScaleMap xmap= plot()->canvasMap(QwtPlot::xBottom);

    float pos_x = xmap.transform(QwtDate::toDouble( QDateTime( Dates[dates_index], QTime( 0, 0 ), Qt::UTC)));

    QLineF line;
    line.setLine( pos_x, pRect.top(), pos_x, pRect.bottom() );

    QwtPainter::drawLine( painter,line);

    }
    While pos_x definitely calculates the right x-Coordinate, the Rubberband is only visible when moving the Cursor exactly at the point, where the Rubberband should be drawn.

    I have already looked into QwtPicker.cpp, but cannot figure out, what I am missing.
    I am using Qwt 6.1rc3 an Qt 4.7.3.


    Help would be highly appreciated .


    Edit: Looked into it for days, and when posting here, I got it. Of course one has to reimplement QwtPicker::rubberBandMask() as well. Hope it helps someone at least.
    Last edited by bisasatan; 13th May 2013 at 15:19. Reason: Solved

Similar Threads

  1. Replies: 2
    Last Post: 1st January 2011, 18:00
  2. puzzle about change QModelIndex's position?
    By Raul in forum Qt Programming
    Replies: 3
    Last Post: 27th October 2010, 10:54
  3. Change position according to QCheckBox State
    By champ in forum Qt Programming
    Replies: 5
    Last Post: 6th June 2010, 19:37
  4. How to change the content's position in viewport?
    By aaron in forum Qt Programming
    Replies: 3
    Last Post: 24th March 2009, 09:37
  5. Replies: 1
    Last Post: 13th September 2008, 12:00

Tags for this Thread

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.