Herr von Wurst
Herr von Wurst

Reputation: 2621

How to draw an Qwt plot into an image

I'd like to overlay a graph over a video stream, i.e. a QImage within a custom widget. How would I go about drawing the Qwt plot to a surface other than a Qwt Plot?

What would be the Qt way to do this? Subclass Qwt Plot? Define a custom canvas with the ability to set images as the background? Or is there something obvious that I am missing?

Upvotes: 2

Views: 2150

Answers (2)

Uwe
Uwe

Reputation: 725

Use QwtPlotRenderer.

In almost all Qwt examples you can see how to render the plot to Pdf, Postscript, SVG or any Image format supported by Qt.

Better ask on the official Qwt support channel.

Upvotes: 5

mantler
mantler

Reputation: 889

I have seem similar things of what you describe that you want to do and they have all been custom implementations using QPixmap( or QImage).

You could try to subclass qwt plot but I think you will find that the performance will be worse than a custom implementation.

You will probably want to be able to scale your axes(or image/pixmap) relative to each other and that would probably be easier if you implement that part as QGraphicsViews(like zoom for example). If it is just a simple x/y plot then it should be relatively painless to implement your self.

Good luck!

Upvotes: 1

Related Questions