PDA

View Full Version : Adding my own file deletion method to QFileDialog.getSaveFileName



bubu.italia
23rd January 2018, 15:21
I'm writing a plugin for QGis (a geospatial software), using PyQT4
I need to let the user save its processing result to a "shapefile", and the dialog should propose to overwrite the filename if it already exists.

The output file format is "shapefile" which is made of 3 or more files with different extension (*.shp, *.shx, *.dbf).
The problem is that QFileDialog.getSaveFileName detects if the file "*.shp" exists, and proposes to delete it, which creates problem.
I would like to overload the existing deleteFile method with my own method to check if the file is not already open in the software, and which files to delete if not already open.

My question is:
- can I implement my own delete function
- can I have an example?

Bruno