2

I am writing a QGis 2.18 plugin. I am designing the plugin with QT, using QGis widgets. I can use QgsFileWidget to open file, but I did not find how to use it to save file. If I try to define an output filename from my plugin, I read an error saying the file could not be found, which I believe means that the widget is in 'read' mode not in 'save' mode.

How can I set, from my python code, the QgsFileWidget to operate in save mode, and therefore let me define a filename for saving my output?

3

That's not possible in 2.18 - the file save mode was not added until 3.0

0

I know the question is regarding QGIS 2.18, however for anyone viewing for QGIS 3.x, you can use:

QgsFileWidget.setStorageMode(QgsFileWidget.SaveFile)

(which is the equivalent of QgsFileWidget.setStorageMode(3) as QgsFileWidget.SaveFile returns 3)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.