Fix: legend now showing up when enabled later by nicoddemus · Pull Request #91 · PlotPyStack/PythonQwt

@nicoddemus

In our code base we had code which does:

1. Create a plot
2. Attach a curve
3. Enable legend

This worked in Qwt 5, but with PythonQwt the legend was not showing up. Switching the order of 2 and 3 caused the legend to then appear.

Debugging I found out blocking signals around `updateLegend` inside `insertLegend` was the culprit. The original source code [does not block signals](https://sourceforge.net/p/qwt/code/HEAD/tree/trunk/qwt/src/qwt_plot.cpp#l943), but calls [`qwtEnableLegendItems`](https://sourceforge.net/p/qwt/code/HEAD/tree/trunk/qwt/src/qwt_plot.cpp#l27), which only disconnects/connects `updateLegendItems`.

Doing the same here fixed the issue: now enabling the legend in a plot which already has curves causes the legend to appear correctly.