Results 1 to 2 of 2

Thread: QwtPlotCurve color for connecting lines

  1. #1
    Join Date
    Apr 2011
    Posts
    9
    Thanks
    1

    Default QwtPlotCurve color for connecting lines

    I'm trying to draw various styles for a QwtPlotCurve, and the only color I get is black. I can make the symbols whatever color I choose, but the symbol color isn't changing the connecting lines.

    Qt Code:
    1. ... // m_graphics is a QwtPlotCurve*
    2.  
    3. int curve_style = get_curve_style();
    4. int symbol_style = get_symbol_style();
    5. int pen_style = get_pen_style();
    6. QColor c = get_color();
    7.  
    8. m_graphics->setStyle(static_cast<QwtPlotCurve::CurveStyle>(curve_style));
    9. m_graphics->setPaintAttribute(QwtPlotCurve::PaintFiltered);
    10.  
    11. QwtSymbol symbol;
    12. QPen p;
    13. QBrush b;
    14. b.setStyle(Qt::SolidPattern);
    15. b.setColor(c);
    16.  
    17. p.setStyle(static_cast<Qt::PenStyle>(pen_style));
    18. p.setColor(c);
    19.  
    20. symbol.setBrush(b);
    21. symbol.setPen(p);
    22. symbol.setSize(QSize(5,5));
    23. symbol.setStyle(static_cast<QwtSymbol::Style>(symbol_style));
    24.  
    25. m_graphics->setSymbol(symbol);
    To copy to clipboard, switch view to plain text mode 

    m_graphics is later used by calling setRawData() and then draw(int, int). I'm using Qwt 5.2.1.

    Why doesn't the color "c" get used for the lines connecting the symbols?

    Thanks,
    Tom

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

    Default Re: QwtPlotCurve color for connecting lines

    Use QwtPlotCurve::setPen(), see: http://qwt.sourceforge.net/class_qwt...9d1e485d2d0c4d

    Uwe

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

    orignihn (28th April 2011)

Similar Threads

  1. Replies: 4
    Last Post: 7th March 2011, 05:17
  2. Draw lines connecting two sub-windows of QMdiArea
    By tom701 in forum Qt Programming
    Replies: 2
    Last Post: 12th September 2010, 20:24
  3. Replies: 2
    Last Post: 6th July 2010, 14:21
  4. Replies: 2
    Last Post: 7th July 2009, 07:44
  5. connecting lines?
    By konvex in forum Qt Programming
    Replies: 8
    Last Post: 16th December 2008, 09:00

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.