fixed using NotationPaintView

This commit is contained in:
Igor Korsukov 2021-11-25 15:32:58 +02:00
parent 022c874121
commit 3c0c94e6b0
6 changed files with 49 additions and 11 deletions

View file

@ -381,6 +381,7 @@ DockPage {
central: NotationView {
id: notationView
name: "MainNotationView"
isNavigatorVisible: pageModel.isNavigatorVisible

View file

@ -123,7 +123,9 @@ DockPage {
}
]
central: NotationView {}
central: NotationView {
name: "PublishNotationView"
}
statusBar: DockStatusBar {
objectName: "publishStatusBar"

View file

@ -26,7 +26,7 @@ import MuseScore.Dock 1.0
DockPageView {
id: root
property alias central: central.sourceComponent
property Component central: null
property var toolBarLeftDropDestination: { "dock": toolBarLeftDockingHolder, "dropLocation": Location.Top }
property var toolBarRightDropDestination: { "dock": toolBarRightDockingHolder, "dropLocation": Location.Top }
@ -38,13 +38,17 @@ DockPageView {
property var panelTopDropDestination: { "dock": panelTopDockingHolder, "dropLocation": Location.Left }
property var panelBottomDropDestination: { "dock": panelBottomDockingHolder, "dropLocation": Location.Left }
property bool complited: false
Component.onCompleted: root.complited = true
Component.onDestruction: root.complited = false
centralDock: DockCentralView {
objectName: root.objectName + "_central"
Loader {
id: central
anchors.fill: parent
sourceComponent: (root.complited && central.visible) ? root.central : null
}
}

View file

@ -32,6 +32,8 @@ import "internal"
FocusScope {
id: root
property string name
property alias isNavigatorVisible: notationNavigator.visible
signal textEdittingStarted()
@ -54,7 +56,6 @@ FocusScope {
Component.onCompleted: {
notationView.load()
notationNavigator.load()
}
ColumnLayout {
@ -90,6 +91,8 @@ FocusScope {
id: notationView
anchors.fill: parent
objectName: root.name
NavigationPanel {
id: navPanel
name: "ScoreView"
@ -154,18 +157,41 @@ FocusScope {
}
}
NotationNavigator {
Loader {
id: notationNavigator
property bool isVertical: orientation === Qt.Vertical
property var orientation: notationNavigator.item ? notationNavigator.item.orientation : Qt.Horizontal
visible: false
SplitView.preferredHeight: 100
SplitView.preferredWidth: 100
onMoveNotationRequested: function (dx, dy) {
notationView.moveCanvas(dx, dy)
sourceComponent: notationNavigator.visible ? navigatorComp : null
function setCursorRect(viewport) {
if (notationNavigator.item) {
notationNavigator.item.setCursorRect(viewport)
}
}
}
Component {
id: navigatorComp
NotationNavigator {
property bool isVertical: orientation === Qt.Vertical
objectName: root.name + "Navigator"
Component.onCompleted: {
load()
}
onMoveNotationRequested: function (dx, dy) {
notationView.moveCanvas(dx, dy)
}
}
}

View file

@ -28,9 +28,10 @@
#include "stringutils.h"
#include "log.h"
using namespace mu::notation;
using namespace mu::ui;
using namespace mu;
using namespace mu::ui;
using namespace mu::draw;
using namespace mu::notation;
static constexpr qreal SCROLL_LIMIT_OFF_OFFSET = 0.75;
static constexpr qreal SCROLL_LIMIT_ON_OFFSET = 0.02;
@ -197,6 +198,7 @@ void NotationPaintView::onCurrentNotationChanged()
});
onNoteInputChanged();
onSelectionChanged();
INotationInteractionPtr interaction = notationInteraction();
interaction->noteInput()->stateChanged().onNotify(this, [this]() {
@ -233,6 +235,7 @@ void NotationPaintView::onCurrentNotationChanged()
void NotationPaintView::onViewSizeChanged()
{
TRACEFUNC;
if (!notation()) {
return;
}
@ -378,7 +381,8 @@ void NotationPaintView::paint(QPainter* qp)
void NotationPaintView::onNotationSetup()
{
TRACEFUNC;
m_notation = globalContext()->currentNotation();
onCurrentNotationChanged();
onPlayingChanged();
globalContext()->currentNotationChanged().onNotify(this, [this]() {
onCurrentNotationChanged();

View file

@ -59,6 +59,7 @@ Item {
TemplatePaintView {
id: templateView
objectName: "TemplatePreview"
anchors.fill: parent
}
}