View Full Version : Problem with Drag Drop for QWT Graph

Ankitha Varsha
22nd January 2008, 12:11

I am trying to drag the graph which is plotted on a widget using QWT to a word document.

canvas->paintCache returns pointer to QPixmap.
I am using this pixmap to set as Image data to QMimeData.

When I actually drop the QMimeData to the word document, I can see only the curves. Axis ,Labels and Legends are not dragged/copied at all from my qwt graph to the word document!.

I have not implemented this feature before, hence I am wondering whether my logic is right with respect to Drag and Drop of QWT graphs.

Kindly let me know.


22nd January 2008, 12:43
Tha paint cache of the canvas is for the content of the plot canvas. So no surprise, that is doesn't contain axes, legend and plot title.

You can render to a QPixmap using QPixmap::grabWidget(). You can also use QWidget::render() if you like to have someting different as a QPixmap. F.e. a scalable vector graphics format like PDF or SVG makes a lot of sense in a text document.

Finally you can also use QwtPlot::print, that also renders to any specific type of QPaintDevice. In opposite to QWiget::render you can render the plot in a different geometry than the widget is. F.e you can align your plot to your paper geometries without any scaling effects.


Ankitha Varsha
23rd January 2008, 05:21
It works with grabwidget :)