Skip to content

Commit

Permalink
ticket:4428 Set very low ration for legend so that plot gets more space.
Browse files Browse the repository at this point in the history
When we have several legend items then a scroll bar will appear.
  • Loading branch information
adeas31 committed May 30, 2017
1 parent 16532e5 commit e2f605d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion OMPlot/OMPlotGUI/Plot.cpp
Expand Up @@ -49,7 +49,7 @@ Plot::Plot(PlotWindow *pParent)
mpParentPlotWindow = pParent;
// create an instance of legend
mpLegend = new Legend(this);
insertLegend(mpLegend, QwtPlot::TopLegend);
insertLegend(mpLegend, QwtPlot::TopLegend, 0.1);
// create an instance of grid
mpPlotGrid = new PlotGrid(this);
// create an instance of zoomer
Expand Down
8 changes: 4 additions & 4 deletions OMPlot/OMPlotGUI/PlotWindow.cpp
Expand Up @@ -774,19 +774,19 @@ void PlotWindow::setLegendPosition(QString position)
{
mpPlot->insertLegend(0);
mpPlot->setLegend(new Legend(mpPlot));
mpPlot->insertLegend(mpPlot->getLegend(), QwtPlot::LeftLegend);
mpPlot->insertLegend(mpPlot->getLegend(), QwtPlot::LeftLegend, 0.1);
}
else if (position.toLower().compare("right") == 0)
{
mpPlot->insertLegend(0);
mpPlot->setLegend(new Legend(mpPlot));
mpPlot->insertLegend(mpPlot->getLegend(), QwtPlot::RightLegend);
mpPlot->insertLegend(mpPlot->getLegend(), QwtPlot::RightLegend, 0.1);
}
else if (position.toLower().compare("top") == 0)
{
mpPlot->insertLegend(0);
mpPlot->setLegend(new Legend(mpPlot));
mpPlot->insertLegend(mpPlot->getLegend(), QwtPlot::TopLegend);
mpPlot->insertLegend(mpPlot->getLegend(), QwtPlot::TopLegend, 0.1);
#if QWT_VERSION > 0x060000
/* we also want to align the legend to left. Stupid Qwt align it HCenter by default. */
QwtLegend *pQwtLegend = qobject_cast<QwtLegend*>(mpPlot->legend());
Expand All @@ -798,7 +798,7 @@ void PlotWindow::setLegendPosition(QString position)
{
mpPlot->insertLegend(0);
mpPlot->setLegend(new Legend(mpPlot));
mpPlot->insertLegend(mpPlot->getLegend(), QwtPlot::BottomLegend);
mpPlot->insertLegend(mpPlot->getLegend(), QwtPlot::BottomLegend, 0.1);
#if QWT_VERSION > 0x060000
/* we also want to align the legend to left. Stupid Qwt align it HCenter by default. */
QwtLegend *pQwtLegend = qobject_cast<QwtLegend*>(mpPlot->legend());
Expand Down

0 comments on commit e2f605d

Please sign in to comment.