diff --git a/Source/GUI/PlotLegend.cpp b/Source/GUI/PlotLegend.cpp index 87912e4f5..d61d73847 100644 --- a/Source/GUI/PlotLegend.cpp +++ b/Source/GUI/PlotLegend.cpp @@ -7,7 +7,9 @@ //--------------------------------------------------------------------------- #include "GUI/PlotLegend.h" +#include #include +#include #include #include @@ -23,9 +25,10 @@ PlotLegend::PlotLegend( QWidget *parent ): setMaxColumns( 1 ); setContentsMargins( 0, 0, 0, 0 ); - QLayout* layout = contentsWidget()->layout(); + QwtDynGridLayout* layout = qobject_cast (contentsWidget()->layout()); layout->setAlignment( Qt::AlignLeft | Qt::AlignTop ); - layout->setSpacing( 0 ); + layout->setSpacing(0); + layout->setExpandingDirections(Qt::Horizontal); QScrollArea *scrollArea = findChild(); if ( scrollArea ) @@ -51,12 +54,15 @@ PlotLegend::~PlotLegend() QWidget *PlotLegend::createWidget( const QwtLegendData &data ) const { QWidget *w = QwtLegend::createWidget( data ); - w->setMaximumHeight(10); + auto icon = data.icon(); + if(!icon.isNull()) + w->setMaximumHeight(10); QwtLegendLabel *label = dynamic_cast( w ); if ( label ) { label->setMargin( 0 ); + label->setContentsMargins(0, 0, 0, 0); } return w;