Skip to content

Commit 5d29207

Browse files
qml, desktop: Fix custom datadir doubleclick
This is a desktop-only (not mobile) workaround to disable doubleclick on custom datadir which is on the StorageLocations.qml componennt. Double-clicking was causing the file dialog to get open but losing focus and moving to the background, bringing upfront the main window which was useless because the file dialog is modal.
1 parent e7bea2d commit 5d29207

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

src/qml/components/StorageLocations.qml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,28 @@ ColumnLayout {
3737
description: qsTr("Choose the directory and storage device.")
3838
customDir: customDirOption.checked ? fileDialog.folder : ""
3939
checked: optionsModel.dataDir !== optionsModel.getDefaultDataDirString
40-
onClicked: fileDialog.open()
40+
onClicked: {
41+
if (AppMode.isDesktop) {
42+
if (!singleClickTimer.running) {
43+
// Start the timer if it's not already running
44+
singleClickTimer.start();
45+
} else {
46+
// If the timer is running, it's a double-click
47+
singleClickTimer.stop();
48+
}
49+
} else {
50+
fileDialog.open()
51+
}
52+
}
53+
Timer {
54+
id: singleClickTimer
55+
interval: 50
56+
onTriggered: {
57+
// If the timer times out, it's a single-click
58+
fileDialog.open()
59+
}
60+
repeat: false // No need to repeat the timer
61+
}
4162
}
4263
FileDialog {
4364
id: fileDialog

0 commit comments

Comments
 (0)