Hi,

I am new to Qt.

I have to implement Drag and Drop feature on QTableWidget and QTableView in my application. I need to drag the table and drop it into another application such as ms-word.

I have already implemented something which works partially...in the sense that, when i drag the table and drop it in ms-word, it gets copied there, but the problem is, if the table contains any scroll bars, the cells behind the scroll bars dont get copied, only that part of the table which is visible gets copied into ms-word.

The code which i use to achieve this is,

QDrag *drag = new QDrag(this);
QMimeData *mimeData = new QMimeData;

QPixmap img = QPixmap::grabWidget(this);

mimeData->setImageData(img.toImage());
drag->setMimeData(mimeData);

I have subclassed QTableWidget and QTableView and implemented the above code in the mouseMoveEvent.

I was hoping the grabWidget() would get the entire TableWidget.

I think the mimeData has to be used properly, but I am not sure how to proceed further on this.

Any help would be very much appreciated.
Thanks and Regards.