Check the bode example and replace QwtPlot::BottomLegend by QwtPlot::TopLegend.

If this is what you are looking for check your code and remove everything you did, what has to do with the legend - beside the line you find in the example.

Uwe