mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#8676 QtChart : Create curve legend widget for multiplot
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user