c++/Qt how to handle clipboard to copy files
Hi,
I'm currently developing an app in C++/Qt . I have made some modifications in the Drag and Drop to be able to copy a file from the local machine (Mac OSX) to an Android Device (using the MTP access). The Mtp part is already done. now, I'm not able to copy a file from the android device to local machine using the Drag and Drop move.
Below is the init of the class TreeWidget which contain items
TreeView::TreeView(mtp_wrapper& device, MainWindow& parent) :
m_device(device), w_parent(parent)
{
//new FileMimeType();
setSortingEnabled(true);
setColumnWidth(0, 400);
setExpandsOnDoubleClick(true);
setDragDropMode(DragDrop);
setDragEnabled(true);
setDropIndicatorShown(true);
setMouseTracking(true);
setAcceptDrops(true);
setAutoFillBackground(true);
the header of the class is defined
class TreeView : public QTreeWidget
{
Q_OBJECT
public:
TreeView(mtp_wrapper& device, MainWindow& parent);
I have also reuse all the private slots below
void dragEnterEvent(QDragEnterEvent *event);
void dropEvent(QDropEvent *event);
void dragMoveEvent(QDragMoveEvent * event);
void dragLeaveEvent(QDragLeaveEvent* event);
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
What is strange is that by default when moving a file from my app to the local machine (desktop or finder), a file is created with the filename of my file. By default Qt create a filename.textClipping file.
What I need is to block this creation of the Clipping file and replace it by my own copy function from the android dev to the machine.
My other concerns is that when my mouse is on the desktop or somewhere in the finder, I don't see which type of event/mimeData can be use to catch the destination
Any idea on what class need to be addressed
Thanks