mirror of
https://github.com/283375/arcaea-offline-pyside-ui.git
synced 2025-11-06 20:42:15 +00:00
34 lines
729 B
QML
34 lines
729 B
QML
import QtQuick
|
|
import QtQuick.Dialogs
|
|
|
|
import internal.ui.utils
|
|
|
|
SelectorBase {
|
|
id: base
|
|
|
|
FileDialog {
|
|
id: fileDialog
|
|
onAccepted: {
|
|
base.url = this.selectedFile;
|
|
}
|
|
}
|
|
|
|
function isFileUrlValid(url: url): bool {
|
|
return url.toString().startsWith("file://");
|
|
}
|
|
|
|
property alias fileUrl: base.url
|
|
onFileUrlChanged: {
|
|
if (isFileUrlValid(fileUrl)) {
|
|
fileDialog.selectedFile = fileUrl;
|
|
fileDialog.currentFolder = UrlUtils.parent(fileUrl);
|
|
}
|
|
}
|
|
|
|
shouldAcceptUrl: url => UrlUtils.isFile(url)
|
|
onBrowseButtonClicked: {
|
|
fileDialog.open();
|
|
}
|
|
placeholderText: '<font color="gray">Select a file…</font>'
|
|
}
|