From bbb40d9b11cae3335378d65e3cf874f22a1738b6 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 25 Jan 2022 18:19:08 +0100 Subject: [PATCH] Allow double-clicking on a file to open it Contributes to issue CURA-8686. --- .../DigitalLibrary/resources/qml/OpenProjectFilesPage.qml | 5 +++++ plugins/DigitalLibrary/resources/qml/Table.qml | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/plugins/DigitalLibrary/resources/qml/OpenProjectFilesPage.qml b/plugins/DigitalLibrary/resources/qml/OpenProjectFilesPage.qml index e0009d20e3..6a03bca27b 100644 --- a/plugins/DigitalLibrary/resources/qml/OpenProjectFilesPage.qml +++ b/plugins/DigitalLibrary/resources/qml/OpenProjectFilesPage.qml @@ -78,6 +78,11 @@ Item { manager.setSelectedFileIndices([currentRow]); } + onDoubleClicked: function(row) + { + manager.setSelectedFileIndices([row]); + openFilesButton.clicked(); + } } Label diff --git a/plugins/DigitalLibrary/resources/qml/Table.qml b/plugins/DigitalLibrary/resources/qml/Table.qml index 66144b3ea3..0ae97792dc 100644 --- a/plugins/DigitalLibrary/resources/qml/Table.qml +++ b/plugins/DigitalLibrary/resources/qml/Table.qml @@ -24,6 +24,7 @@ Item required property var columnHeaders //The text to show in the headers of each column. property alias model: tableView.model //A TableModel to display in this table. To use a ListModel for the rows, use "rows: listModel.items" property int currentRow: -1 //The selected row index. + property var onDoubleClicked: function(row) {} //Something to execute when double clicked. Accepts one argument: The index of the row that was clicked on. Row { @@ -128,6 +129,10 @@ Item { tableScrollView.currentRow = row; //Select this row. } + onDoubleClicked: + { + tableScrollView.onDoubleClicked(row); + } } } }