为 FileDialog 设置默认起始目录
Setting default starting directory for FileDialog
我正在尝试在 QtQuick 中为 FileDialog
设置默认起始目录,但它不起作用(意味着它总是打开可执行文件的目录):
property url defPath : "/home/saeid/Work/data";
FileDialog {
id:dialogPosPath;
selectFolder: true;
title: "Please select folder";
folder: defPath;
//rest of stuff
但是如果我将文件夹 属性 设置为例如folder:shortcuts.home
效果很好!我不明白为什么。
The path to the currently selected folder. Setting this property
before invoking open() will cause the file browser to be initially
positioned on the specified folder.
The value of this property is also updated after the dialog is closed.
By default, the url is empty.
知道如何实现吗?
您应该使用 file
scheme:
"file:///home/saeid/work/data"
我正在尝试在 QtQuick 中为 FileDialog
设置默认起始目录,但它不起作用(意味着它总是打开可执行文件的目录):
property url defPath : "/home/saeid/Work/data";
FileDialog {
id:dialogPosPath;
selectFolder: true;
title: "Please select folder";
folder: defPath;
//rest of stuff
但是如果我将文件夹 属性 设置为例如folder:shortcuts.home
效果很好!我不明白为什么。
The path to the currently selected folder. Setting this property before invoking open() will cause the file browser to be initially positioned on the specified folder.
The value of this property is also updated after the dialog is closed.
By default, the url is empty.
知道如何实现吗?
您应该使用 file
scheme:
"file:///home/saeid/work/data"