From 4bcbfe67a7dea3ab7f5648311128503bd8a3c59b Mon Sep 17 00:00:00 2001 From: Casper Jeukendrup <48658420+cbjeukendrup@users.noreply.github.com> Date: Tue, 11 Jul 2023 02:00:26 +0200 Subject: [PATCH 1/6] Fix updating the Offset property in the Inspector when dragging item in the notation --- .../models/abstractinspectorproxymodel.h | 4 +-- .../models/general/generalsettingsmodel.cpp | 28 +++++++++---------- .../models/general/generalsettingsmodel.h | 12 ++------ 3 files changed, 19 insertions(+), 25 deletions(-) diff --git a/src/inspector/models/abstractinspectorproxymodel.h b/src/inspector/models/abstractinspectorproxymodel.h index edd0bc66b2c4d..2a76616328d28 100644 --- a/src/inspector/models/abstractinspectorproxymodel.h +++ b/src/inspector/models/abstractinspectorproxymodel.h @@ -63,6 +63,8 @@ class AbstractInspectorProxyModel : public AbstractInspectorModel void updateModels(const ElementKeySet& newElementKeySet); + void onCurrentNotationChanged() override; + public slots: void setDefaultSubModelType(mu::inspector::InspectorModelType modelType); @@ -74,8 +76,6 @@ public slots: void setModels(const QList& models); private: - void onCurrentNotationChanged() override; - QHash m_modelsHash; InspectorModelType m_defaultSubModelType = InspectorModelType::TYPE_UNDEFINED; }; diff --git a/src/inspector/models/general/generalsettingsmodel.cpp b/src/inspector/models/general/generalsettingsmodel.cpp index ed17dfb741cda..429c2e2994a28 100644 --- a/src/inspector/models/general/generalsettingsmodel.cpp +++ b/src/inspector/models/general/generalsettingsmodel.cpp @@ -33,8 +33,12 @@ GeneralSettingsModel::GeneralSettingsModel(QObject* parent, IElementRepositorySe setTitle(qtrc("inspector", "General")); setSectionType(InspectorSectionType::SECTION_GENERAL); - setPlaybackProxyModel(new PlaybackProxyModel(this, repository)); - setAppearanceSettingsModel(new AppearanceSettingsModel(this, repository)); + + m_playbackProxyModel = new PlaybackProxyModel(this, repository); + m_playbackProxyModel->init(); + + m_appearanceSettingsModel = new AppearanceSettingsModel(this, repository); + m_appearanceSettingsModel->init(); } void GeneralSettingsModel::createProperties() @@ -124,6 +128,14 @@ void GeneralSettingsModel::loadProperties(const mu::engraving::PropertyIdSet& pr } } +void GeneralSettingsModel::onCurrentNotationChanged() +{ + AbstractInspectorModel::onCurrentNotationChanged(); + + m_appearanceSettingsModel->onCurrentNotationChanged(); + m_playbackProxyModel->onCurrentNotationChanged(); +} + void GeneralSettingsModel::onVisibleChanged(bool visible) { beginCommand(); @@ -167,15 +179,3 @@ QObject* GeneralSettingsModel::appearanceSettingsModel() const { return m_appearanceSettingsModel; } - -void GeneralSettingsModel::setPlaybackProxyModel(PlaybackProxyModel* playbackProxyModel) -{ - m_playbackProxyModel = playbackProxyModel; - emit playbackProxyModelChanged(m_playbackProxyModel); -} - -void GeneralSettingsModel::setAppearanceSettingsModel(AppearanceSettingsModel* appearanceSettingsModel) -{ - m_appearanceSettingsModel = appearanceSettingsModel; - emit appearanceSettingsModelChanged(m_appearanceSettingsModel); -} diff --git a/src/inspector/models/general/generalsettingsmodel.h b/src/inspector/models/general/generalsettingsmodel.h index d22256a501c37..c943af668c220 100644 --- a/src/inspector/models/general/generalsettingsmodel.h +++ b/src/inspector/models/general/generalsettingsmodel.h @@ -36,8 +36,8 @@ class GeneralSettingsModel : public AbstractInspectorModel Q_PROPERTY(PropertyItem * isPlayable READ isPlayable CONSTANT) Q_PROPERTY(PropertyItem * isSmall READ isSmall CONSTANT) - Q_PROPERTY(QObject * playbackProxyModel READ playbackProxyModel NOTIFY playbackProxyModelChanged) - Q_PROPERTY(QObject * appearanceSettingsModel READ appearanceSettingsModel NOTIFY appearanceSettingsModelChanged) + Q_PROPERTY(QObject * playbackProxyModel READ playbackProxyModel CONSTANT) + Q_PROPERTY(QObject * appearanceSettingsModel READ appearanceSettingsModel CONSTANT) public: explicit GeneralSettingsModel(QObject* parent, IElementRepositoryService* repository); @@ -50,13 +50,7 @@ class GeneralSettingsModel : public AbstractInspectorModel QObject* playbackProxyModel() const; QObject* appearanceSettingsModel() const; -public slots: - void setPlaybackProxyModel(mu::inspector::PlaybackProxyModel* playbackProxyModel); - void setAppearanceSettingsModel(mu::inspector::AppearanceSettingsModel* appearanceSettingsModel); - -signals: - void playbackProxyModelChanged(QObject* playbackProxyModel); - void appearanceSettingsModelChanged(QObject* appearanceSettingsModel); + void onCurrentNotationChanged() override; private: void createProperties() override; From 451698f2f207e2f61ee1650c9489c03bfeaba940 Mon Sep 17 00:00:00 2001 From: Casper Jeukendrup <48658420+cbjeukendrup@users.noreply.github.com> Date: Tue, 11 Jul 2023 10:44:19 +0200 Subject: [PATCH 2/6] Init submodels of PlaybackProxyModel --- src/inspector/models/general/playback/playbackproxymodel.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/inspector/models/general/playback/playbackproxymodel.cpp b/src/inspector/models/general/playback/playbackproxymodel.cpp index 0f55e6eca1468..628db1577a754 100644 --- a/src/inspector/models/general/playback/playbackproxymodel.cpp +++ b/src/inspector/models/general/playback/playbackproxymodel.cpp @@ -43,5 +43,9 @@ PlaybackProxyModel::PlaybackProxyModel(QObject* parent, IElementRepositoryServic new GradualTempoChangePlaybackModel(this, repository) }; + for (AbstractInspectorModel* model : models) { + model->init(); + } + setModels(models); } From 05b05c53a448fa6780004a7e725550c7493f38a1 Mon Sep 17 00:00:00 2001 From: Casper Jeukendrup <48658420+cbjeukendrup@users.noreply.github.com> Date: Tue, 11 Jul 2023 10:50:32 +0200 Subject: [PATCH 3/6] Init submodels of BarlineSettingsModel --- .../models/notation/barlines/barlinesettingsproxymodel.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/inspector/models/notation/barlines/barlinesettingsproxymodel.cpp b/src/inspector/models/notation/barlines/barlinesettingsproxymodel.cpp index 55f8901b1db1a..1371d7c72e9cf 100644 --- a/src/inspector/models/notation/barlines/barlinesettingsproxymodel.cpp +++ b/src/inspector/models/notation/barlines/barlinesettingsproxymodel.cpp @@ -40,5 +40,9 @@ BarlineSettingsProxyModel::BarlineSettingsProxyModel(QObject* parent, IElementRe new StaffSettingsModel(this, repository) }; + for (AbstractInspectorModel* model : models) { + model->init(); + } + setModels(models); } From d4b0566e18c743ca2674315115db5812cf787756 Mon Sep 17 00:00:00 2001 From: Casper Jeukendrup <48658420+cbjeukendrup@users.noreply.github.com> Date: Tue, 11 Jul 2023 10:59:03 +0200 Subject: [PATCH 4/6] Init submodels of RestSettingsProxyModel --- .../models/notation/rests/restsettingsproxymodel.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/inspector/models/notation/rests/restsettingsproxymodel.cpp b/src/inspector/models/notation/rests/restsettingsproxymodel.cpp index 6aec8e27f4758..410e9a0297bcf 100644 --- a/src/inspector/models/notation/rests/restsettingsproxymodel.cpp +++ b/src/inspector/models/notation/rests/restsettingsproxymodel.cpp @@ -41,6 +41,10 @@ RestSettingsProxyModel::RestSettingsProxyModel(QObject* parent, IElementReposito models << inspectorModelCreator()->newInspectorModel(modelType, this, repository); } + for (AbstractInspectorModel* model : models) { + model->init(); + } + setModels(models); connect(m_repository->getQObject(), SIGNAL(elementsUpdated(const QList&)), this, From 7809bd682776aa513f9a9ff6930be297c3cc95d9 Mon Sep 17 00:00:00 2001 From: Casper Jeukendrup <48658420+cbjeukendrup@users.noreply.github.com> Date: Tue, 11 Jul 2023 11:00:13 +0200 Subject: [PATCH 5/6] Init submodels of NoteSettingsProxyModel --- .../models/notation/notes/notesettingsproxymodel.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/inspector/models/notation/notes/notesettingsproxymodel.cpp b/src/inspector/models/notation/notes/notesettingsproxymodel.cpp index f1357b2666974..b81f3aff77a16 100644 --- a/src/inspector/models/notation/notes/notesettingsproxymodel.cpp +++ b/src/inspector/models/notation/notes/notesettingsproxymodel.cpp @@ -50,6 +50,10 @@ NoteSettingsProxyModel::NoteSettingsProxyModel(QObject* parent, IElementReposito models << inspectorModelCreator()->newInspectorModel(modelType, this, repository); } + for (AbstractInspectorModel* model : models) { + model->init(); + } + setModels(models); connect(m_repository->getQObject(), SIGNAL(elementsUpdated(const QList&)), this, From 0423c039fddada315f0f6a79e8bcf9004fbd9d15 Mon Sep 17 00:00:00 2001 From: Roman Pudashkin Date: Tue, 11 Jul 2023 16:08:15 +0300 Subject: [PATCH 6/6] Init submodel of RestBeamSettingsModel --- .../models/notation/rests/beams/restbeamsettingsmodel.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/inspector/models/notation/rests/beams/restbeamsettingsmodel.cpp b/src/inspector/models/notation/rests/beams/restbeamsettingsmodel.cpp index fc286615de95a..527b17487a0e9 100644 --- a/src/inspector/models/notation/rests/beams/restbeamsettingsmodel.cpp +++ b/src/inspector/models/notation/rests/beams/restbeamsettingsmodel.cpp @@ -32,7 +32,11 @@ RestBeamSettingsModel::RestBeamSettingsModel(QObject* parent, IElementRepository { setModelType(InspectorModelType::TYPE_BEAM); setTitle(qtrc("inspector", "Beam")); - setBeamModesModel(new BeamModesModel(this, repository)); + + BeamModesModel* modesModel = new BeamModesModel(this, repository); + modesModel->init(); + + setBeamModesModel(modesModel); } QObject* RestBeamSettingsModel::beamModesModel() const