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/// defaultText - Placeholder shown when the Fact value is empty.
21 property string label: fact.shortDescription
23 property string dialogTitle: label
24 property bool selectFolder: true
25 property string defaultText: qsTr("<not set>")
27 spacing: ScreenTools.defaultFontPixelWidth * 2
30 Layout.fillWidth: true
31 Layout.minimumWidth: implicitWidth
35 Layout.fillWidth: true
40 Layout.fillWidth: true
41 font.pointSize: ScreenTools.smallFontPointSize
42 text: root.fact.rawValue === "" ? root.defaultText : root.fact.value
43 elide: Text.ElideMiddle
49 onClicked: _browseDialog.openForLoad()
53 title: root.dialogTitle
54 folder: root.fact.rawValue
55 selectFolder: root.selectFolder
56 onAcceptedForLoad: (file) => root.fact.rawValue = file