Hi,

I want to recover the color of the curve for the background legend (<--- ) but any success... For the title, it's OK

Qt Code:
  1. void Legend::updateItem( QStandardItem *item, const QwtLegendData &data )
  2. {
  3. const QVariant titleValue = data.value( QwtLegendData::TitleRole );
  4. const QVariant colorValue = data.value(QwtLegendData::IconRole); <---
  5.  
  6. QwtText title;
  7. if ( titleValue.canConvert<QwtText>() )
  8. {
  9. item->setText( title.text() );
  10. title = titleValue.value<QwtText>();
  11. }
  12. else if ( titleValue.canConvert<QString>() )
  13. {
  14. title.setText( titleValue.value<QString>() );
  15. }
  16. item->setText( title.text() );
  17. item->setBackground(QBrush(QColor(colorValue.Color))); <---
  18.  
  19. const QVariant iconValue = data.value( QwtLegendData::IconRole );
  20.  
  21. QPixmap pm;
  22. if ( iconValue.canConvert<QPixmap>() )
  23. pm = iconValue.value<QPixmap>();
  24.  
  25. item->setData(pm, Qt::DecorationRole);
  26. }
To copy to clipboard, switch view to plain text mode 

Thank you for your lights