Disable horz. scrollbar for legends

This commit is contained in:
jonjenssen 2023-03-14 15:12:36 +01:00 committed by jonjenssen
parent 09c04cbcd0
commit a926421825

View File

@ -26,6 +26,7 @@
#include <QDebug>
#include <QResizeEvent>
#include <QScrollArea>
#include <QVariant>
#include <utility>
@ -35,7 +36,6 @@
//--------------------------------------------------------------------------------------------------
RiuQwtPlotLegend::RiuQwtPlotLegend( QWidget* parent /*= nullptr */ )
: QwtLegend( parent )
{
auto* legendLayout = qobject_cast<QwtDynGridLayout*>( contentsWidget()->layout() );
if ( legendLayout )
@ -44,6 +44,9 @@ RiuQwtPlotLegend::RiuQwtPlotLegend( QWidget* parent /*= nullptr */ )
legendLayout->setSpacing( 1 );
}
setSizePolicy( QSizePolicy::Preferred, QSizePolicy::MinimumExpanding );
QScrollArea* scrollArea = findChild<QScrollArea*>( "QwtLegendView" );
if ( scrollArea ) scrollArea->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
}
//--------------------------------------------------------------------------------------------------