From 007dc2f8cf3f5a0ea232d18b881c2f359033ebcb Mon Sep 17 00:00:00 2001 From: Eism Date: Thu, 13 Jan 2022 12:05:26 +0200 Subject: [PATCH] Toggle off palette cell after adding to score --- .../MuseScore/UiComponents/ListItemBlank.qml | 4 ++++ .../MuseScore/Palette/internal/Palette.qml | 23 ++++++++----------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/framework/uicomponents/qml/MuseScore/UiComponents/ListItemBlank.qml b/src/framework/uicomponents/qml/MuseScore/UiComponents/ListItemBlank.qml index 8d3505f3f6..bc765577d1 100644 --- a/src/framework/uicomponents/qml/MuseScore/UiComponents/ListItemBlank.qml +++ b/src/framework/uicomponents/qml/MuseScore/UiComponents/ListItemBlank.qml @@ -70,6 +70,10 @@ FocusableControl { } } + mouseArea.onPressed: { + ui.tooltip.hide(root) + } + onNavigationTriggered: root.clicked(null) states: [ diff --git a/src/palette/qml/MuseScore/Palette/internal/Palette.qml b/src/palette/qml/MuseScore/Palette/internal/Palette.qml index 3143e6d5c4..8013a136f8 100644 --- a/src/palette/qml/MuseScore/Palette/internal/Palette.qml +++ b/src/palette/qml/MuseScore/Palette/internal/Palette.qml @@ -486,13 +486,6 @@ GridView { //property int cellRow: paletteView.ncolumns == 0 ? 0 : Math.floor(model.index / paletteView.ncolumns) //property int cellCol: model.index - (cellRow * paletteView.ncolumns) - onActiveFocusChanged: { - if (activeFocus) { - paletteTree.currentTreeItem = this; - paletteView.updateSelection(false); - } - } - readonly property bool dragged: Drag.active && !dragDropReorderTimer.running property bool paletteDrag: false property bool internalDrag: false @@ -515,7 +508,7 @@ GridView { navigation.column: 1 navigation.onActiveChanged: { - if (navigation.active) { + if (navigation.highlight) { paletteView.currentIndex = paletteCell.rowIndex; paletteView.updateSelection(true); } @@ -535,15 +528,13 @@ GridView { // leftClickArea mouseArea.drag.target: draggedIcon mouseArea.onPressed: { - paletteView.currentIndex = paletteCell.rowIndex; - paletteView.updateSelection(true); - paletteCell.forceActiveFocus(); - paletteCell.beginDrag(); + paletteCell.beginDrag() } onClicked: { - if (paletteView.paletteController.applyPaletteElement(paletteCell.modelIndex, ui.keyboardModifiers())) { - paletteView.selectionModel.setCurrentIndex(paletteCell.modelIndex, ItemSelectionModel.Current); + if (!paletteView.paletteController.applyPaletteElement(paletteCell.modelIndex, ui.keyboardModifiers())) { + paletteView.currentIndex = paletteCell.rowIndex; + paletteView.updateSelection(true); } } @@ -597,6 +588,10 @@ GridView { dropData = null; } + + if (Boolean(paletteView)) { + paletteView.selectionModel.clearSelection() + } } function beginDrag() {