Results 1 to 2 of 2

Thread: Sublcassing QwtPlotItem to customize its drawing behaviour

  1. #1
    Join Date
    Jul 2010
    Posts
    37
    Thanks
    13
    Qt products
    Qt4
    Platforms
    Windows

    Default Sublcassing QwtPlotItem to customize its drawing behaviour

    I don't know if my trouble is properly related to Qwt or widely to c++

    How do I override draw method of an item (curve, marker) for customize its drawing behaviour ?

    I tried with this code, but I can't take the control of overrided draw method, seems that compiler is ignoring it:

    This is the code that is not working:
    Qt Code:
    1. class train_evt_marker: public QwtPlotMarker
    2. {
    3. public:
    4. train_evt_marker():QwtPlotMarker()
    5. {
    6. // here I see this log message
    7. QLOG_TRACE()<<"-------------constructor MARKER-------------";
    8. }
    9.  
    10. void draw(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect)
    11. {
    12. // here I can't see the log messages... is this overrided method ignored??
    13. QLOG_TRACE()<<"-------------DRAw MARKER-------------";
    14. // calling the parent method continuing the draw of the curve
    15. QwtPlotMarker::draw(painter,xMap,yMap,canvasRect);
    16. }
    17. };
    To copy to clipboard, switch view to plain text mode 

    TIA

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

    Default Re: Sublcassing QwtPlotItem to customize its drawing behaviour

    Wrong signature of train_evt_marker::draw( ... ) - the const is missing.

    Uwe

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

    corrado1972 (17th March 2011)

Similar Threads

  1. Replies: 0
    Last Post: 18th January 2011, 03:19
  2. Replies: 1
    Last Post: 15th May 2010, 19:22
  3. QwtPlotItem inverting qwtPlot scale
    By jmsbc in forum Qwt
    Replies: 1
    Last Post: 25th August 2009, 15:09
  4. Replies: 3
    Last Post: 16th May 2009, 11:16
  5. How customize my .exe with a icon.
    By jiveaxe in forum Qt Programming
    Replies: 2
    Last Post: 30th December 2007, 19:30

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.