diff --git a/src/framework/uicomponents/view/popupview.cpp b/src/framework/uicomponents/view/popupview.cpp index c28f7111c33c3..918e91f7f5eac 100644 --- a/src/framework/uicomponents/view/popupview.cpp +++ b/src/framework/uicomponents/view/popupview.cpp @@ -150,6 +150,17 @@ void PopupView::init() } }); + navigationController()->navigationChanged().onNotify(this, [this]() { + ui::INavigationPanel* navigationPanel = navigationController()->activePanel(); + if (!navigationPanel) { + return; + } + + if (navigationPanel->window() == m_window->qWindow() && !m_window->hasActiveFocus()) { + m_window->forceActiveFocus(); + } + }); + emit windowChanged(); } diff --git a/src/framework/uicomponents/view/popupview.h b/src/framework/uicomponents/view/popupview.h index a2973c7d3598a..8ae8254dcc239 100644 --- a/src/framework/uicomponents/view/popupview.h +++ b/src/framework/uicomponents/view/popupview.h @@ -93,7 +93,7 @@ class PopupView : public QObject, public QQmlParserStatus, public Injectable, pu public: Inject mainWindow = { this }; Inject uiConfiguration = { this }; - Inject navigationController= { this }; + Inject navigationController = { this }; public: diff --git a/src/framework/uicomponents/view/popupwindow/ipopupwindow.h b/src/framework/uicomponents/view/popupwindow/ipopupwindow.h index d5dddc2fb9b71..a92a4e3f8f448 100644 --- a/src/framework/uicomponents/view/popupwindow/ipopupwindow.h +++ b/src/framework/uicomponents/view/popupwindow/ipopupwindow.h @@ -61,6 +61,7 @@ class IPopupWindow : public QObject virtual void setPosition(const QPoint& position) const = 0; + virtual bool hasActiveFocus() const = 0; virtual void forceActiveFocus() = 0; virtual void setOnHidden(const std::function& callback) = 0; diff --git a/src/framework/uicomponents/view/popupwindow/popupwindow_qquickview.cpp b/src/framework/uicomponents/view/popupwindow/popupwindow_qquickview.cpp index f5eb34a2e244a..f30ce60a3ed5c 100644 --- a/src/framework/uicomponents/view/popupwindow/popupwindow_qquickview.cpp +++ b/src/framework/uicomponents/view/popupwindow/popupwindow_qquickview.cpp @@ -136,6 +136,9 @@ void PopupWindow_QQuickView::forceActiveFocus() return; } + m_view->setFlags(m_view->flags() & (~Qt::WindowDoesNotAcceptFocus)); + m_view->requestActivate(); + QQuickItem* rootObject = m_view->rootObject(); if (!rootObject) { return; @@ -244,6 +247,11 @@ void PopupWindow_QQuickView::setPosition(const QPoint& position) const m_view->setPosition(position); } +bool PopupWindow_QQuickView::hasActiveFocus() const +{ + return m_view && m_view->activeFocusItem() != nullptr; +} + void PopupWindow_QQuickView::setOnHidden(const std::function& callback) { m_onHidden = callback; diff --git a/src/framework/uicomponents/view/popupwindow/popupwindow_qquickview.h b/src/framework/uicomponents/view/popupwindow/popupwindow_qquickview.h index 08374423421da..91bf30637be9b 100644 --- a/src/framework/uicomponents/view/popupwindow/popupwindow_qquickview.h +++ b/src/framework/uicomponents/view/popupwindow/popupwindow_qquickview.h @@ -68,6 +68,7 @@ class PopupWindow_QQuickView : public IPopupWindow, public muse::Injectable, pub void setPosition(const QPoint& position) const override; + bool hasActiveFocus() const override; void forceActiveFocus() override; void setOnHidden(const std::function& callback) override; diff --git a/src/notation/qml/MuseScore/NotationScene/internal/ElementPopupLoader.qml b/src/notation/qml/MuseScore/NotationScene/internal/ElementPopupLoader.qml index 7af3e4661c800..4a2cb1262d0f9 100644 --- a/src/notation/qml/MuseScore/NotationScene/internal/ElementPopupLoader.qml +++ b/src/notation/qml/MuseScore/NotationScene/internal/ElementPopupLoader.qml @@ -118,6 +118,7 @@ Item { // This is necessary so that popups do not activate navigation in the new section, // but at the same time, when clicking on the component (text input), the focus in popup's window should be activated popup.navigationSection = null + popup.openPolicies = PopupView.NoActivateFocus popup.notationViewNavigationSection = container.notationViewNavigationSection popup.navigationOrderStart = container.navigationOrderStart diff --git a/src/notation/view/internal/dynamicpopupmodel.cpp b/src/notation/view/internal/dynamicpopupmodel.cpp index cc309002cb6e0..756a0aac82219 100644 --- a/src/notation/view/internal/dynamicpopupmodel.cpp +++ b/src/notation/view/internal/dynamicpopupmodel.cpp @@ -64,15 +64,15 @@ static const QList > DYN_POPUP_PAGES = { { DynamicType::PPPPPP, 74, 2.0, DynamicPopupModel::Dynamic }, { DynamicType::FFFFFF, 60, 2.5, DynamicPopupModel::Dynamic }, }, - { // Page 6 + { // Page 6 - Hairpins + { DynamicType::OTHER, 62, 0.0, DynamicPopupModel::Crescendo }, + { DynamicType::OTHER, 62, 0.0, DynamicPopupModel::Decrescendo }, + }, + { // Page 7 { DynamicType::PPPPP, 64, 2.0, DynamicPopupModel::Dynamic }, { DynamicType::PPPP, 52, 2.0, DynamicPopupModel::Dynamic }, { DynamicType::PPP, 44, 2.0, DynamicPopupModel::Dynamic }, }, - { // Page 7 - Hairpins - { DynamicType::OTHER, 62, 0.0, DynamicPopupModel::Crescendo }, - { DynamicType::OTHER, 62, 0.0, DynamicPopupModel::Decrescendo }, - }, }; DynamicPopupModel::DynamicPopupModel(QObject* parent)