FileDialog save file default name
-
wrote on 12 Dec 2016, 11:46 last edited by
Hi,
how to preset file name in qml save file dialog (I want to set some default file name in the dialog)?Thanks
-
wrote on 29 Dec 2016, 12:59 last edited by
It's not possible. Even worse, if you reuse the FileDialog, it will default to the last file selected even if this is not what you want. This is one of many bugs and missing features why I think that QtQuick Controls are simply not ready for production use.
There is no simple workaround but if you are willing to add custom C++ code to your QML project, have a look at Advanced FileDialog in QML, which presents a solution that works on Windows, Mac and Gnome.
-
Hi,
how to preset file name in qml save file dialog (I want to set some default file name in the dialog)?Thanks
Qt Champions 2016wrote on 5 Jan 2017, 12:35 last edited by benlau 1 May 2017, 12:41@MartinD Set the
folder
property of FileDialog to the url of the target folder with the preset file name.e.g
file:/tmp/filename.txt
-
wrote on 17 May 2021, 20:36 last edited by
Doesn't appear to be working on windows with Qt 5.15.2?
-
wrote on 17 May 2021, 21:28 last edited by
I used qt labs platform. YMMV:
import Qt.labs.platform 1.1 as QLP ... QLP.FileDialog { id: filedialog currentFile: "file:///home/user/test2.txt" }