From b060dd534c56f9d601692a590e045ab41d870534 Mon Sep 17 00:00:00 2001
From: SeeLook <945374+SeeLook@users.noreply.github.com>
Date: Sun, 29 Jul 2018 12:53:15 +0200
Subject: [PATCH] Mark keyboard focus of custom controls. Possible solution
 (disabled) to have shortcuts of score control (without it works only for main
 score)

---
 changes                             | 1 +
 src/qml/settings/InstrumentPage.qml | 6 ++++++
 src/qml/shared/TcheckBox.qml        | 7 +++++--
 src/qml/shared/TcuteButton.qml      | 3 ++-
 src/qml/shared/TiconButton.qml      | 6 ++++--
 5 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/changes b/changes
index aa5867727..c867efc4d 100644
--- a/changes
+++ b/changes
@@ -1,6 +1,7 @@
 1.5.2 alpha3
      - extended grand staff, beaming notes on every staff separately
      - score supports bowing symbols, read them from XML
+     - keyboard shortcuts for changing rhythm, accidentals, etc.
      - all playing routines moved to separate thread
      - improved level creator
 
diff --git a/src/qml/settings/InstrumentPage.qml b/src/qml/settings/InstrumentPage.qml
index a22d1407b..e7d1ec7f7 100644
--- a/src/qml/settings/InstrumentPage.qml
+++ b/src/qml/settings/InstrumentPage.qml
@@ -91,6 +91,11 @@ Flickable {
         }
         Score {
           id: score
+//           onFocusChanged: { // FIXME: workaround to make score keyboard shortcuts working, but it stop other controls TAB navigation
+//             if (!focus)
+//               focus = true
+//           }
+//           bgRect.border { width: score.activeFocus ? 2 : 0; color: activPal.highlight }
           height: Noo.fontSize() * 20
           width: Math.min(parent.width * 0.9, Noo.fontSize() * 26)
           anchors.horizontalCenter: parent.horizontalCenter
@@ -100,6 +105,7 @@ Flickable {
           Component.onCompleted: {
             stringNrSpin.valueModified.connect(strNrChanged)
             tuningCombo.activated.connect(tuningSelected)
+            focus = true
           }
           function strNrChanged() {
             if (stringNrSpin.value > score.notesCount) {
diff --git a/src/qml/shared/TcheckBox.qml b/src/qml/shared/TcheckBox.qml
index d51c8fce0..c53f596f9 100755
--- a/src/qml/shared/TcheckBox.qml
+++ b/src/qml/shared/TcheckBox.qml
@@ -18,7 +18,10 @@ CheckBox {
     x: chB.leftPadding
     y: chB.height / 2 - height / 2
     radius: Noo.fontSize() * 0.1
-    border.color: chB.enabled ? (chB.down ? activPal.highlight : activPal.dark) : disdPal.text
+    border {
+      color: chB.enabled ? (chB.down ? activPal.highlight : activPal.dark) : disdPal.text
+      width: chB.activeFocus ? 3 : 1
+    }
     color: chB.enabled ? activPal.base : disdPal.base
 
     Rectangle {
@@ -38,6 +41,6 @@ CheckBox {
     y: (chB.height - height) / 2
     leftPadding: indicator.width + font.pixelSize / 2
     color: chB.enabled ? activPal.text : disdPal.text
-    font { family: chB.font.family; pixelSize: chB.font.pixelSize }
+    font { family: chB.font.family; pixelSize: chB.font.pixelSize; bold: chB.activeFocus }
   }
 }
diff --git a/src/qml/shared/TcuteButton.qml b/src/qml/shared/TcuteButton.qml
index 86444185d..7f910445f 100644
--- a/src/qml/shared/TcuteButton.qml
+++ b/src/qml/shared/TcuteButton.qml
@@ -8,7 +8,8 @@ import QtQuick.Controls 2.2
 
 AbstractButton {
   id: root
-  font.pixelSize: Noo.fontSize()
+  font { pixelSize: Noo.fontSize(); bold: activeFocus }
+  focus: true
 
   property alias radius: bg.radius
   property alias color: bg.color
diff --git a/src/qml/shared/TiconButton.qml b/src/qml/shared/TiconButton.qml
index 1cc6c46a5..462025a2a 100644
--- a/src/qml/shared/TiconButton.qml
+++ b/src/qml/shared/TiconButton.qml
@@ -1,5 +1,5 @@
 /** This file is part of Nootka (http://nootka.sf.net)               *
- * Copyright (C) 2017 by Tomasz Bojczuk (seelook@gmail.com)          *
+ * Copyright (C) 2017-2018 by Tomasz Bojczuk (seelook@gmail.com)     *
  * on the terms of GNU GPLv3 license (http://www.gnu.org/licenses)   */
 
 import QtQuick 2.9
@@ -8,7 +8,8 @@ import QtQuick.Controls 2.2
 
 AbstractButton {
   id: root
-  font.pixelSize: Noo.fontSize()
+  font { pixelSize: Noo.fontSize(); bold: activeFocus }
+  focus: true
 
   property alias radius: bg.radius
   property alias color: bg.color
@@ -24,6 +25,7 @@ AbstractButton {
         id: img
         sourceSize.height: Noo.fontSize() * 2
         anchors.verticalCenter: parent.verticalCenter
+        scale: root.activeFocus ? 1.1 : 1.0
       }
       Text {
         padding: Noo.fontSize() / 3
-- 
GitLab