Results 1 to 10 of 10

Thread: QwtPlotIntervalCurve's constant width.

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: QwtPlotIntervalCurve's constant width.

    Well then the size of the square depends on some QFontMetrics and is of course in widget coordinates.

    This is something you can do with symbols - in you case ( as you need to draw a value inside ) it would be a symbol made of a QPixmap or QwtGraphic ( what would give nicer results in a PDF document ). All geometries of a symbol are in widget coordinates, what means, that a square remains a square ( but don't you have this already using QwtPlotMarker ? ).

    Another option would be to derive from QwtPlotItem and do the squares for each vector in YourItem::draw(). Implementing such an item wouldn't be hard - simply translating the center into widget coordinates, then doing a QPainter::fillRect() followed by a QPainter::drawText().

    Uwe

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

    Toniy (17th August 2015)

  3. #2
    Join Date
    Jul 2015
    Posts
    22
    Thanks
    23
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QwtPlotIntervalCurve's constant width.

    Thanks! I almost get it. One more question: are coordinates on canvas widget and coordinates that shown at QwtScaleDraw not the same (coordinates that shown at QwtScaleDraw are converted coordinates of canvas widget)? I mean if, for example, our Y axis has 100 as min value and 200 for max value and X axis has the same limits, then is point [0;0] of canvas widget (top-left corner) the same as point [200, 100] of our graph (or it is more complicated)?

  4. #3
    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: QwtPlotIntervalCurve's constant width.

    The widget coordinates are usually bounded by plot->canvas()->contentsRect() ( = QWidget::rect() without margins ). Then it depends on your configuration how the scales are aligned to the canvas - f.e. there might be extra margins to have some space for the tick labels ( see QwtPlotLayout ). The necessary space depends on some factors f.e if a horizontal scale can be extended below a vertical scale etc.

    So the answer is yes - usually it is more complicated. Better use QwtPlot::canvasMap() to translate between plot ( = what is spanned by the scales ) and paint device coordinates ( = widget ).

    Uwe

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

    Toniy (18th August 2015)

Similar Threads

  1. Replies: 1
    Last Post: 10th August 2015, 23:38
  2. Problem with QwtPlotIntervalCurve
    By SandyEmerald in forum Qwt
    Replies: 2
    Last Post: 11th October 2013, 16:16
  3. yLeft axis constant width
    By baray98 in forum Qwt
    Replies: 4
    Last Post: 4th January 2013, 16:40
  4. Auto-adjusting height of a constant width window
    By akiross in forum Qt Programming
    Replies: 0
    Last Post: 7th July 2010, 01:46
  5. Replies: 1
    Last Post: 28th January 2009, 14:47

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