Fix: legend now showing up when enabled later by nicoddemus · Pull Request #91 · PlotPyStack/PythonQwt
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters