5import QGroundControl.Controls
6import QGroundControl.FactControls
8/// File or folder browser control for a string-valued Fact.
9/// Shows a label, the current path (or a default placeholder), and a
10/// "Browse" button that opens a native file dialog.
13/// fact - The string Fact whose rawValue stores the path (required).
14/// label - Display label (defaults to fact.shortDescription).
15/// dialogTitle - Title for the file dialog (defaults to label).
16/// selectFolder - true to browse folders, false for files (default true).
17/// nameFilters - Name filters for file browsing (simple wildcards only).
18/// defaultText - Placeholder shown when the Fact value is empty.
22 property string label: fact.shortDescription
24 property string dialogTitle: label
25 property bool selectFolder: true
26 property var nameFilters: []
27 property string defaultText: qsTr("<not set>")
29 spacing: ScreenTools.defaultFontPixelWidth * 2
32 Layout.fillWidth: true
33 Layout.minimumWidth: implicitWidth
37 Layout.fillWidth: true
42 Layout.fillWidth: true
43 font.pointSize: ScreenTools.smallFontPointSize
44 text: root.fact.rawValue === "" ? root.defaultText : root.fact.value
45 elide: Text.ElideMiddle
51 onClicked: _browseDialog.openForLoad()
55 title: root.dialogTitle
56 folder: root.fact.rawValue
57 selectFolder: root.selectFolder
58 nameFilters: root.nameFilters
59 onAcceptedForLoad: (file) => root.fact.rawValue = file