#8676 QtChart : Create curve legend widget for multiplot

This commit is contained in:
Magne Sjaastad
2022-03-23 13:07:08 +01:00
parent f45637b7f0
commit 696c6a15fa
14 changed files with 267 additions and 25 deletions

View File

@@ -18,6 +18,7 @@
#include "RiuQwtPlotLegend.h"
#include "qwt_dyngrid_layout.h"
#include "qwt_legend_label.h"
#include <QDebug>
#include <QResizeEvent>
@@ -109,3 +110,28 @@ void RiuQwtPlotLegend::updateLegend( const QVariant& variant, const QList<QwtLeg
QwtLegend::updateLegend( variant, legendItems );
emit legendUpdated();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQwtPlotLegend::updateLegend( const QList<QwtLegendData>& legendData )
{
// Delete all existing widgets
deleteAll();
// Create legend widgets based on legendData
updateLegend( QVariant(), legendData );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQwtPlotLegend::deleteAll()
{
auto widgets = contentsWidget()->findChildren<QwtLegendLabel*>();
for ( auto w : widgets )
{
w->hide();
w->deleteLater();
}
}