FileDialog in QTQuick (QML): save the file with the given name

We are creating a Qt Quick application that should be able to save a file with the given name .

In the FileDialog component, you can only install the directory. This is not very convenient, because you do not want to enter the file name manually each time you download the file.

So far we have tried different things

  • FileDialog from QtQuick.Dialogs: file name cannot be set

  • Built-in dialog via QPlatformFileDialogHelper (naughty closed C ++ hack): file name cannot be set on Linux (Gnome)

  • Internal dialog via static QFileDialog :: getSaveFileName (): in the Quick application there is no QWidget for the parent

  • Dialog QT through an instance of QFileDialog: the doeas modality does not work, since the "parent" is not installed. There is no QWidget in the Quick application to call setParent ()

(using C ++ with QT 5.1 and QtQuick 2.1, including all desktop components)

+6
source share
2 answers

This blog post covers the whole problem and provides a possible solution: Advanced FileDialog in QML (save file under given name)

+4
source

Try setting the FileDialog selectExisting property to false.

-1
source

Source: https://habr.com/ru/post/959085/


All Articles