First window with file dialog.

This commit is contained in:
Adam Bissen 2023-09-19 20:20:19 -05:00
parent 09221bb11f
commit 940e0cb85d

View File

@ -1,9 +1,36 @@
import QtQuick
import QtQuick.Window
import QtQuick.Dialogs
import QtQuick.Controls
Window {
width: 640
height: 480
visible: true
title: qsTr("Hello World")
color: "darkgrey"
Button {
id: btnVideoFile
anchors.centerIn: parent
text: "Video File"
onClicked: videoFileDialog.open()
}
TextEdit {
id: txtVideoFile
text: ""
anchors.top: btnVideoFile.bottom
anchors.horizontalCenter: btnVideoFile.horizontalCenter
readOnly: false
selectByMouse: true
}
FileDialog {
id: videoFileDialog
fileMode: FileDialog.OpenFile
nameFilters: ["Video files (*.mkv *.mp4)", "All files (*)"]
onAccepted: { const reg = /^file:\/\/\// //Remove "file:/// at start of URL
txtVideoFile.text = videoFileDialog.selectedFile.toString().replace(reg, "") }
}
}