Using Qt 4.6.0 and qwt 5.2.0
I want the text in my legend to match the color of the curve it represents. Is there a way to do that?
Using Qt 4.6.0 and qwt 5.2.0
I want the text in my legend to match the color of the curve it represents. Is there a way to do that?
The text of the legend is copied from the curve title. If you assign a color to the title (QwtText::setColor) I would expect to see it on the legend as well.
Uwe
Yup, that did it, thanks. How about changing the background color of the legend? I've tried setPalette() on the legend, but this didn't have any effect.
The legend is a container widget around a scrollview, that contains another containter widget (QwtLegend::contentsWidget()), with the legend item widgets inside.
If you want to find the legend item widget, that corresponds to a specific plot item ( f.e for assigning the color of the curve to its palette ) you can use QwtLegend::find ( QwtPlotItem is derived from QwtLegendItemManager ). Overloading QwtPlotItem::updateLegend() is the place to do this.
If you want to have your own type of widget (instead of QwtLegendItem) to be displayed on the legend, implement YourCurve::legendItem() and YourCurve::updateLegend().
Uwe
PS: Qwt is open source - why not looking into the code to identify the internal widget trees.
AwareWolf (22nd January 2010)
Bookmarks