Results 1 to 4 of 4

Thread: Curve color and legend identifier color are not consistent

  1. #1
    Join Date
    Apr 2012
    Location
    Paris
    Posts
    11
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Curve color and legend identifier color are not consistent

    Hello,

    I have a probleme with colors of my curves and the legend identifiers. The color of legend identifier seems to be a composition with the backgroud color of the QwtLegendWidget.
    Is it a bad use of QWT or a bug ?
    Do you see a workaround ?

    Thanks

    (Using Qt 4.7 and qwt 6.0.1)

    See the used code to create the plot (simplified):
    Qt Code:
    1. _plot = new QwtPlot();
    2.  
    3. QwtLegend* legend = new QwtLegend;
    4. legend->setFrameStyle(QFrame::Box|QFrame::Sunken);
    5. _plot->insertLegend(legend, QwtPlot::BottomLegend);
    To copy to clipboard, switch view to plain text mode 

    See the used code to create curves (simplified) :
    Qt Code:
    1. QwtPlotCurve* curve = new QwtPlotCurve(QString(resultName.c_str()));
    2. QwtPointSeriesData* seriesData = new QwtPointSeriesData(pointsList);
    3. curve->setData(seriesData);
    4. curve->setAxes(QwtPlot::xBottom,getOrdinateId());
    5.  
    6. QPen pen;
    7. pen.setColor(colorToUse);
    8. pen.setWidth(2);
    9. curve->setPen(pen);
    10. curve->attach(plot);
    To copy to clipboard, switch view to plain text mode 


    If I change the line 459 of qwt_plot_item.cpp file, colors are consistent
    Original line:
    Qt Code:
    1. identifier.fill( Qt::transparent );
    To copy to clipboard, switch view to plain text mode 
    Modified line:
    Qt Code:
    1. identifier.fill(); // (default value Qt::white)
    To copy to clipboard, switch view to plain text mode 

    See attached screenshot (without QWT modification)
    plot_1.jpg

    See attached screenshot (with QWT modification)
    plot_2.jpg

  2. #2
    Join Date
    Apr 2012
    Location
    Paris
    Posts
    11
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Curve color and legend identifier color are not consistent

    oops, the two screenshots are inverted...
    The first (plot_1.jpeg) is WITH QWT modification => The expected behaviour.
    And the second is my problem (WITHOUT QWT modification)

  3. #3
    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: Curve color and legend identifier color are not consistent

    Please post a small and compilable demo I can check on my system.

    Uwe

  4. #4
    Join Date
    Dec 2013
    Location
    Jerada, Morroco
    Posts
    106
    Thanks
    11
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Curve color and legend identifier color are not consistent

    I have the same problem
    Capture.PNG

Similar Threads

  1. Replies: 5
    Last Post: 17th December 2014, 13:07
  2. Curve with more than one color?
    By sylphide in forum Qwt
    Replies: 1
    Last Post: 16th August 2011, 22:01
  3. Replies: 3
    Last Post: 22nd January 2010, 17:46
  4. Display Label Color by selecting Color Picker
    By sosanjay in forum Qt Programming
    Replies: 1
    Last Post: 25th September 2009, 07:11
  5. how to change backgroup color, button color and shape?
    By lzha022 in forum Qt Programming
    Replies: 10
    Last Post: 16th June 2008, 23:25

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.