Hi all, I’m writing a QGIS plugin which is kind of a 'wrapper' over layers in the database. Inside the plugin's dock widget, I have a QTreeView. Inside this tree, I’ve added QStandardItems. The plugin itself and these items hold information that allows creating a vector layer from the database using QgsDataSourceUri(). The layer is added after clicking a push button, but I want to be able to add a layer by dragging and dropping a QStandardItem onto the map canvas.
Now it looks like this: I can drag and drop an item, but when it hovers over the map canvas, a red icon appears, and dropping the item there does nothing. [image: draganddroperror.png] How should I handle this action? Do I need to write custom drag-and-drop handlers for QStandardItem? How to recognize from an item point of view that it's dropped onto a map canvas? Or should I use classes like QgsCustomDropHandler or QgsMimeDataUtils? How to recognize from a map canvas point of view that QStandardItem is being dropped? To be honest, I have no idea how to implement any of these solutions and how to start solving this problem. The mix of QStandardItem and QGIS classes confuses me. Can anyone give me some advice? Regards, Maryla
_______________________________________________ QGIS-Developer mailing list QGIS-Developer@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer