Results 1 to 3 of 3

Thread: QwtPlotCurve shift by 1 pixel

  1. #1
    Join Date
    Jun 2012
    Posts
    33
    Thanks
    6

    Default QwtPlotCurve shift by 1 pixel

    Hello!

    How can I shift curve by 1 pixel?

    I try to do in this way, but this doesn't help: I have QVector<QPointF> and than I do smth like:

    Qt Code:
    1. for (int i = 0; i < sample.size(); i++) {
    2. tmp = samples.at(i);
    3.  
    4. newVector.append(tmp.x, tmp.y - 1);
    5. }
    6. setSamples(newVector);
    To copy to clipboard, switch view to plain text mode 

    tmp there is struct like:
    struct {
    double x;
    double y;
    }

    Problem is that scale is to big: 0 - 8*10^8
    and when curves have same value i need some value shift down by 1 pixel...
    Last edited by carhun; 20th August 2012 at 10:25.

  2. #2
    Join Date
    Sep 2011
    Location
    Manchester
    Posts
    538
    Thanks
    3
    Thanked 106 Times in 103 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QwtPlotCurve shift by 1 pixel

    problem is that single value unit quite likely doesn't represent single pixel on the screen.
    If you have point ( 500, 20000 ) changing it to ( 500, 19999 ) won't do any good.

    You could reimplement QwtPlotCurve::draw() and introduce offset there using QPainter::translate( 1, 1 ) for example.

  3. The following user says thank you to Spitfire for this useful post:

    carhun (20th August 2012)

  4. #3
    Join Date
    Jun 2012
    Posts
    33
    Thanks
    6

    Default Re: QwtPlotCurve shift by 1 pixel

    Sorry, but can U explain more how it help me if start of coordinate system will be on 1,1 ?

    Now I have that all my graphics start at 0,0 ...

    Thanks, I think I understand how it can help me...

    If I will have some questions, Ill write here.
    Last edited by carhun; 20th August 2012 at 15:32.

Similar Threads

  1. Replies: 1
    Last Post: 11th May 2012, 08:02
  2. Replies: 2
    Last Post: 16th February 2012, 23:10
  3. shift + key
    By jajdoo in forum Newbie
    Replies: 5
    Last Post: 22nd July 2010, 18:25
  4. QPen color shift
    By Alberto in forum Qt Programming
    Replies: 0
    Last Post: 22nd October 2008, 11:35
  5. QPixmap pixel by pixel ?
    By tommy in forum Qt Programming
    Replies: 19
    Last Post: 3rd December 2007, 22:52

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.