Results 1 to 3 of 3

Thread: Resizing QwtSymbol during zoom in QwtPlot

  1. #1
    Join Date
    Nov 2012
    Posts
    11
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Resizing QwtSymbol during zoom in QwtPlot

    Hello,

    I am drawing a curve using QwtPlotCurve in a derived QwtPlot class, and I display some markers and symbols at given locations to show particular points of the curve. I am using rectangle as symbols, and I want these rectangle to have a defined height, starting at the bottom x axis, to represent some value.

    So, I calculate the symbol size QSize(nx,ny) with :
    int ny = (int)abs(transform(QwtPlot::yLeft,ym) - transform(QwtPlot::yLeft,0));
    and this works perfectly well. BUT, when I zoom in the graph, the symbol are not resized accordingly to the new zoomed window and everything is messed up.

    Digging a bit on the forum, I have read that I could overload QwtSymbol::drawSymbols to get the job done. However, this is a virtual const function, and qtcreator/gcc does not allow me to modify the symbol size (object data) within the overloaded function. Removing the const qualifier just changes the signature and the overloaded function is not called.

    Any help warmly welcomed,

    best regards

    Oliver

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

    Default Re: Resizing QwtSymbol during zoom in QwtPlot

    Well the size of a symbol is in paint device coordinates and is not intended to be scalable. Sounds like you want don't want to display a curve or markers ( points ) - instead it seems to be something, according to rectangles.

    Could you elaborate your use case ( what you want to display - not how you have implemented it so far ) ?

    Uwe

  3. #3
    Join Date
    Nov 2012
    Posts
    11
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Resizing QwtSymbol during zoom in QwtPlot

    Hi Uwe,

    Thanks for the fast reply. Your reply draw my attention to the fact that I might have misused QwtSymbol, so I went back to the documentation and found that painting rectangles with QwtPlotItem would do it much better. I implemented it and it work perfectly.

    thanks for your help and best regards

    Oliver

Similar Threads

  1. Tooltip to QwtSymbol ???
    By jesse_mark in forum Qwt
    Replies: 15
    Last Post: 17th October 2012, 09:49
  2. QwtPlot - detect zoom
    By gaminn in forum Qwt
    Replies: 2
    Last Post: 8th June 2012, 11:24
  3. Multitouch Zoom with QWTPLOT in Windows
    By cristian.a in forum Qwt
    Replies: 1
    Last Post: 17th January 2012, 09:42
  4. QWTPlot Zoom: cannot zoom negative value
    By jwieland in forum Qwt
    Replies: 0
    Last Post: 8th January 2010, 16:16
  5. QwtSymbol highlighting?
    By shud in forum Qwt
    Replies: 1
    Last Post: 2nd October 2009, 21:42

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.